# pvbgeek/ai-based-system-design-builder architecture

> Architecture diagram of the GitHub repository pvbgeek/ai-based-system-design-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pvbgeek/ai-based-system-design-builder
- Repository: https://github.com/pvbgeek/ai-based-system-design-builder
- Video tour (about a minute): https://gitdiagram.com/pvbgeek/ai-based-system-design-builder/video

## Overview

This is a browser-based system-design builder with a Flask-backed AI generation path. Users describe requirements by typing or speaking, request a generated design, and see its components and connections on the canvas; they can also build or edit a design manually. The README additionally documents deletion and predefined architecture components. The excerpts support the API and canvas interactions shown below; template wiring and some UI details are not sampled, so those relationships are omitted.

Main entry points: [`static/scripts/api.js`](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js) (Generation client), [`code/main.py`](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py) (Generate endpoint), [`static/scripts/mic.js`](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/mic.js) (Speech input), [`static/scripts/graph.js`](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/graph.js) (Component palette)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Design authoring"]
  node_speech["Speech input<br/>[mic.js]"]
  node_prompt["Requirement input<br/>[api.js]"]
  node_palette["Component palette<br/>[graph.js]"]
end

subgraph group_generation["AI generation"]
  node_request["Generation client<br/>[api.js]"]
  node_route["Generate endpoint<br/>[main.py]"]
  node_generator["Design generator<br/>[main.py]"]
  node_graphdata["Design JSON<br/>[main.py]"]
end

subgraph group_canvas["Graph canvas"]
  node_processor["Graph processor<br/>[api.js]"]
  node_canvas["Graph canvas<br/>[graph.js]"]
  node_editor["Connection editor<br/>[build_path.js]"]
end

node_user(("User"))
node_llm{{"OpenAI service"}}

node_user -->|"speaks into"| node_speech
node_speech -->|"fills"| node_prompt
node_user -->|"enters requirements"| node_prompt
node_user -->|"selects components"| node_palette
node_prompt -->|"submits"| node_request
node_request -->|"posts JSON"| node_route
node_route -->|"calls"| node_generator
node_generator -->|"requests design"| node_llm
node_generator -->|"produces JSON"| node_graphdata
node_route -->|"returns JSON"| node_request
node_request -->|"passes response"| node_processor
node_processor -->|"creates components"| node_canvas
node_processor -->|"creates arrows"| node_editor
node_user -->|"builds or deletes"| node_editor
node_palette -->|"adds components"| node_canvas

click node_speech "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/mic.js"
click node_prompt "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js"
click node_palette "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/graph.js"
click node_request "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js"
click node_route "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py"
click node_generator "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py"
click node_graphdata "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py"
click node_processor "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js"
click node_canvas "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/graph.js"
click node_editor "https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/components/build_path.js"

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_speech,node_prompt,node_palette,node_user toneBlue
class node_request,node_route,node_generator,node_graphdata toneAmber
class node_processor,node_canvas,node_editor toneMint
class node_llm toneIndigo
```

## Components

### Design authoring

- [Speech input](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/mic.js): `static/scripts/mic.js`
- [Requirement input](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js): `static/scripts/api.js`
- [Component palette](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/graph.js): `static/scripts/graph.js`

### AI generation

- [Generation client](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js): `static/scripts/api.js`
- [Generate endpoint](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py): `code/main.py`
- [Design generator](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py): `code/main.py`
- [Design JSON](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/code/main.py): `code/main.py`

### Graph canvas

- [Graph processor](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/api.js): `static/scripts/api.js`
- [Graph canvas](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/scripts/graph.js): `static/scripts/graph.js`
- [Connection editor](https://github.com/pvbgeek/ai-based-system-design-builder/blob/main/static/components/build_path.js): `static/components/build_path.js`

### Other components

- **User**
- **OpenAI service**

## Connections

- User → Speech input: speaks into (evidence: `README.md`)
- Speech input → Requirement input: fills (evidence: `static/scripts/mic.js`)
- User → Requirement input: enters requirements (evidence: `README.md`)
- User → Component palette: selects components (evidence: `README.md`)
- Requirement input → Generation client: submits (evidence: `static/scripts/api.js`)
- Generation client → Generate endpoint: posts JSON (evidence: `static/scripts/api.js`)
- Generate endpoint → Design generator: calls (evidence: `code/main.py`)
- Design generator → OpenAI service: requests design (evidence: `code/main.py`)
- Design generator → Design JSON: produces JSON (evidence: `code/main.py`)
- Generate endpoint → Generation client: returns JSON (evidence: `code/main.py`)
- Generation client → Graph processor: passes response (evidence: `static/scripts/api.js`)
- Graph processor → Graph canvas: creates components (evidence: `static/scripts/api.js`)
- Graph processor → Connection editor: creates arrows (evidence: `static/scripts/api.js`)
- User → Connection editor: builds or deletes (evidence: `README.md`)
- Component palette → Graph canvas: adds components (evidence: `static/scripts/graph.js`)
