# mhitza/database-graphviz architecture

> Architecture diagram of the GitHub repository mhitza/database-graphviz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mhitza/database-graphviz
- Repository: https://github.com/mhitza/database-graphviz

## Overview

##### Main Components

a. Input Layer:
- Command Line Interface (represented by bin/database-graphviz)
- Database Connection Handler (implicit from functionality)

b. Core Processing Components:
- Command Handler (src/Command/GenerateCommand.php)
- Generator System
- Generator Interface (src/Generator/GeneratorInterface.php)
- Simple Generator (src/Generator/Simple.php)
- Record Handler (src/Generator/Record.php)

c. Output Layer:
- Graphviz DOT file generation

**[User/CLI Input] → [Command Handler] → [Generator System] → [Graphviz Output]**
- ↑                        ↑

- [Database Connection] ←→ [Schema Analysis]

##### Detailed Component Relationships

a. Command Flow:
- How the CLI command (bin/database-graphviz) interfaces with GenerateCommand
- Command's interaction with the generator system

b. Generator System:
- GeneratorInterface as an abstract component
- Simple generator as an implementation
- Record handler to the generator system

c. Database Interaction:
- Database connection flow
- Schema reading process
- Relationship to graph generation

##### Implementation Details

- A note about the composer dependency management
- GitHub Actions workflow indicators for CI/CD
- Relationship between the generator components and the final Graphviz output

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        CLI["CLI Interface"]
        DB[(Database)]
    end

    subgraph Core["Core Processing"]
        CH["Command Handler"]
        GS["Generator System"]
        
        subgraph Generators
            GI["Generator Interface"]
            SG["Simple Generator"]
            RH["Record Handler"]
        end
    end

    subgraph Output
        GV["Graphviz DOT File"]
    end

    subgraph CI/CD["Build & Release"]
        CI["CI Pipeline"]
        RB["Release Build"]
        EG["Example Generation"]
    end

    subgraph Documentation
        DOC["Documentation"]
        EX["Example Schema"]
    end

    %% Relationships
    CLI --> CH
    DB --> CH
    CH --> GS
    GS --> GI
    GI --> SG
    GI --> RH
    SG --> GV
    RH --> GV

    %% CI/CD Relationships
    CI --> RB
    RB --> EG
    EG -.-> DOC
    EX -.-> DOC

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef input fill:#d4e6f1,stroke:#2874a6
    classDef core fill:#d4efdf,stroke:#27ae60
    classDef output fill:#fdebd0,stroke:#f39c12
    classDef cicd fill:#ebdef0,stroke:#8e44ad
    classDef doc fill:#f5eef8,stroke:#af7ac5

    class CLI,DB input
    class CH,GS,GI,SG,RH core
    class GV output
    class CI,RB,EG cicd
    class DOC,EX doc

    %% Click Events
    click CLI "https://github.com/mhitza/database-graphviz/tree/master/bin/database-graphviz"
    click CH "https://github.com/mhitza/database-graphviz/blob/master/src/Command/GenerateCommand.php"
    click GI "https://github.com/mhitza/database-graphviz/blob/master/src/Generator/GeneratorInterface.php"
    click SG "https://github.com/mhitza/database-graphviz/blob/master/src/Generator/Simple.php"
    click RH "https://github.com/mhitza/database-graphviz/blob/master/src/Generator/Record.php"
    click CI "https://github.com/mhitza/database-graphviz/blob/master/.github/workflows/php.yml"
    click RB "https://github.com/mhitza/database-graphviz/blob/master/.github/workflows/release-build.yml"
    click EG "https://github.com/mhitza/database-graphviz/blob/master/.github/workflows/example-graphviz.yml"
    click DOC "https://github.com/mhitza/database-graphviz/blob/master/doc/example.md"
    click EX "https://github.com/mhitza/database-graphviz/blob/master/doc/example.sql"
```
