# andrea-salvatore/er_diagram architecture

> Architecture diagram of the GitHub repository andrea-salvatore/er_diagram, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andrea-salvatore/er_diagram
- Repository: https://github.com/andrea-salvatore/er_diagram

## Overview

E/R Diagram is a cross-platform, diagram-as-code application: users describe relational schemas as text, and the app validates and lays them out as an ER diagram rendered on a canvas. The README documents the parser-to-model-to-layout-to-renderer boundaries, including routing and interaction capabilities. The only Dart source path in the tree is lib/main.dart; implementation details for these subsystems were not sampled, so the graph reflects documented architecture rather than verified internal calls.

Main entry points: [`lib/main.dart`](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart) (Typed graph model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Schema input"]
  node_app["Flutter application<br/>[main.dart]"]
  node_parser["Lexer and parser<br/>[main.dart]"]
end

subgraph group_engine["Model and geometry"]
  node_model["Typed graph model<br/>[main.dart]"]
  node_validation["Semantic checks<br/>[main.dart]"]
  node_topology["Topological ordering<br/>[main.dart]"]
  node_layering["Layer assignment<br/>[main.dart]"]
  node_coordinates["Coordinate layout<br/>[main.dart]"]
  node_routing["Orthogonal routing<br/>[main.dart]"]
end

subgraph group_presentation["Rendering and interaction"]
  node_renderer["Canvas renderer<br/>[main.dart]"]
  node_interaction["Diagram interaction<br/>[main.dart]"]
end

node_user(("Schema author"))

node_user -->|"enters schema"| node_app
node_app -->|"submits text"| node_parser
node_parser -->|"builds model"| node_model
node_model -->|"checks semantics"| node_validation
node_model -->|"provides graph"| node_topology
node_topology -->|"orders layers"| node_layering
node_layering -->|"assigns positions"| node_coordinates
node_coordinates -->|"routes edges"| node_routing
node_routing -->|"supplies layout"| node_renderer
node_renderer -->|"handles input"| node_interaction

click node_app "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_parser "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_model "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_validation "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_topology "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_layering "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_coordinates "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_routing "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_renderer "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"
click node_interaction "https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_parser toneBlue
class node_model,node_validation,node_topology,node_layering,node_coordinates,node_routing toneAmber
class node_renderer,node_interaction toneMint
class node_user toneIndigo
```

## Components

### Schema input

- [Flutter application](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Lexer and parser](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`

### Model and geometry

- [Typed graph model](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Semantic checks](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Topological ordering](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Layer assignment](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Coordinate layout](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Orthogonal routing](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`

### Rendering and interaction

- [Canvas renderer](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`
- [Diagram interaction](https://github.com/andrea-salvatore/er_diagram/blob/main/lib/main.dart): `lib/main.dart`

### Other components

- **Schema author**

## Connections

- Schema author → Flutter application: enters schema (evidence: `README.md`)
- Flutter application → Lexer and parser: submits text (evidence: `README.md`)
- Lexer and parser → Typed graph model: builds model (evidence: `README.md`)
- Typed graph model → Semantic checks: checks semantics (evidence: `README.md`)
- Typed graph model → Topological ordering: provides graph (evidence: `README.md`)
- Topological ordering → Layer assignment: orders layers (evidence: `README.md`)
- Layer assignment → Coordinate layout: assigns positions (evidence: `README.md`)
- Coordinate layout → Orthogonal routing: routes edges (evidence: `README.md`)
- Orthogonal routing → Canvas renderer: supplies layout (evidence: `README.md`)
- Canvas renderer → Diagram interaction: handles input (evidence: `README.md`)
