# amitht007/archflow architecture

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

- Interactive diagram: https://gitdiagram.com/amitht007/archflow
- Repository: https://github.com/amitht007/archflow

## Overview

ArchFlow is a visual editor for designing microservice architectures in SDL, with a collaboration-ready canvas and an API for reading and validating SDL. The main workflow is a user editing a canvas, whose architecture state is held in Yjs and represented by interactive service, datastore, and annotation nodes; SDL parsing and API endpoints provide the document and validation layer. The excerpts show canvas component references, API route behavior, and the Yjs provider setup. The websocket connection is indicated by matching client/server conventions, but its full runtime behavior was not sampled.

Main entry points: [`apps/web/src/components/BaseCanvas.tsx`](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/BaseCanvas.tsx) (Canvas editor), [`apps/web/src/components/Inspector.tsx`](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/Inspector.tsx) (Selection inspector), [`apps/api/src/index.ts`](https://github.com/amitht007/archflow/blob/master/apps/api/src/index.ts) (API server), [`apps/api/src/routes/sdl.ts`](https://github.com/amitht007/archflow/blob/master/apps/api/src/routes/sdl.ts) (SDL routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Architecture editor"]
  node_app["Editor shell<br/>[App.tsx]"]
  node_canvas["Canvas editor<br/>[BaseCanvas.tsx]"]
  node_library["Component library"]
  node_creation["Canvas creation"]
  node_context["Canvas context menu<br/>[ContextMenu.tsx]"]
  node_inspector["Selection inspector<br/>[Inspector.tsx]"]
  node_service["Service node<br/>[ServiceNode.tsx]"]
  node_database[("Datastore node<br/>[DatabaseNode.tsx]")]
  node_gateway["Gateway node<br/>[GatewayNode.tsx]"]
  node_external["External node<br/>[ExternalNode.tsx]"]
  node_lambda["Lambda node<br/>[LambdaNode.tsx]"]
  node_notes["Annotations and groups<br/>[StickyNote.tsx]"]
end

subgraph group_collab["Shared canvas state"]
  node_selection["Selection state<br/>[selectionStore.ts]"]
  node_yjs["Collaborative document<br/>[yjs.ts]"]
end

subgraph group_api["SDL API"]
  node_apiapp["API server<br/>[index.ts]"]
  node_health["Health route<br/>[health.ts]"]
  node_sdlroutes["SDL routes<br/>[sdl.ts]"]
  node_loader["SDL loading<br/>[sdl-loader.ts]"]
  node_websocket["Websocket handlers<br/>[websocket.ts]"]
end

subgraph group_sdl["SDL processing"]
  node_parser["SDL parser and validator<br/>[parser.ts]"]
  node_yjsparser["SDL-Yjs conversion<br/>[SDLParser.ts]"]
  node_types["Shared SDL types<br/>[index.ts]"]
end

node_user(("Architecture designer"))
node_apiuser(("API client"))

node_user -->|"opens editor"| node_app
node_app -->|"renders"| node_canvas
node_canvas -->|"renders"| node_library
node_canvas -->|"renders"| node_creation
node_canvas -->|"renders"| node_context
node_canvas -->|"renders"| node_inspector
node_canvas -->|"renders"| node_service
node_canvas -->|"renders"| node_database
node_canvas -->|"renders"| node_gateway
node_canvas -->|"renders"| node_external
node_canvas -->|"renders"| node_lambda
node_canvas -->|"renders"| node_notes
node_canvas -->|"uses selection"| node_selection
node_canvas -->|"updates document"| node_yjs
node_inspector -->|"reads selection"| node_selection
node_inspector -->|"edits document"| node_yjs
node_inspector -->|"uses conversion"| node_yjsparser
node_canvas -->|"uses conversion"| node_yjsparser
node_yjs -.->|"syncs over websocket"| node_websocket
node_apiuser -->|"sends requests"| node_apiapp
node_apiapp -->|"routes health"| node_health
node_apiapp -->|"routes SDL"| node_sdlroutes
node_apiapp -->|"upgrades websocket"| node_websocket
node_sdlroutes -->|"loads SDL"| node_loader
node_sdlroutes -->|"validates payload"| node_parser
node_parser -->|"uses definitions"| node_types

click node_app "https://github.com/amitht007/archflow/blob/master/apps/web/src/App.tsx"
click node_canvas "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/BaseCanvas.tsx"
click node_library "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/ComponentLibrary.tsx"
click node_creation "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/CanvasCreationPopover.tsx"
click node_context "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/ContextMenu.tsx"
click node_inspector "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/Inspector.tsx"
click node_service "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/ServiceNode.tsx"
click node_database "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/DatabaseNode.tsx"
click node_gateway "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/GatewayNode.tsx"
click node_external "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/ExternalNode.tsx"
click node_lambda "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/LambdaNode.tsx"
click node_notes "https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/StickyNote.tsx"
click node_selection "https://github.com/amitht007/archflow/blob/master/apps/web/src/store/selectionStore.ts"
click node_yjs "https://github.com/amitht007/archflow/blob/master/apps/web/src/lib/yjs.ts"
click node_apiapp "https://github.com/amitht007/archflow/blob/master/apps/api/src/index.ts"
click node_health "https://github.com/amitht007/archflow/blob/master/apps/api/src/routes/health.ts"
click node_sdlroutes "https://github.com/amitht007/archflow/blob/master/apps/api/src/routes/sdl.ts"
click node_loader "https://github.com/amitht007/archflow/blob/master/apps/api/src/lib/sdl-loader.ts"
click node_websocket "https://github.com/amitht007/archflow/blob/master/apps/api/src/websocket.ts"
click node_parser "https://github.com/amitht007/archflow/blob/master/packages/sdl/src/sdl/parser.ts"
click node_yjsparser "https://github.com/amitht007/archflow/blob/master/packages/sdl/src/SDLParser.ts"
click node_types "https://github.com/amitht007/archflow/blob/master/packages/types/src/index.ts"

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_canvas,node_library,node_creation,node_context,node_inspector,node_service,node_database,node_gateway,node_external,node_lambda,node_notes,node_apiuser toneBlue
class node_selection,node_yjs toneAmber
class node_apiapp,node_health,node_sdlroutes,node_loader,node_websocket toneMint
class node_parser,node_yjsparser,node_types toneRose
class node_user toneIndigo
```

## Components

### Architecture editor

- [Editor shell](https://github.com/amitht007/archflow/blob/master/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Canvas editor](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/BaseCanvas.tsx): `apps/web/src/components/BaseCanvas.tsx`
- [Component library](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/ComponentLibrary.tsx): `apps/web/src/components/ComponentLibrary.tsx`
- [Canvas creation](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/CanvasCreationPopover.tsx): `apps/web/src/components/CanvasCreationPopover.tsx`
- [Canvas context menu](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/ContextMenu.tsx): `apps/web/src/components/ContextMenu.tsx`
- [Selection inspector](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/Inspector.tsx): `apps/web/src/components/Inspector.tsx`
- [Service node](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/ServiceNode.tsx): `apps/web/src/components/nodes/ServiceNode.tsx`
- [Datastore node](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/DatabaseNode.tsx): `apps/web/src/components/nodes/DatabaseNode.tsx`
- [Gateway node](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/GatewayNode.tsx): `apps/web/src/components/nodes/GatewayNode.tsx`
- [External node](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/ExternalNode.tsx): `apps/web/src/components/nodes/ExternalNode.tsx`
- [Lambda node](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/LambdaNode.tsx): `apps/web/src/components/nodes/LambdaNode.tsx`
- [Annotations and groups](https://github.com/amitht007/archflow/blob/master/apps/web/src/components/nodes/StickyNote.tsx): `apps/web/src/components/nodes/StickyNote.tsx`

### Shared canvas state

- [Selection state](https://github.com/amitht007/archflow/blob/master/apps/web/src/store/selectionStore.ts): `apps/web/src/store/selectionStore.ts`
- [Collaborative document](https://github.com/amitht007/archflow/blob/master/apps/web/src/lib/yjs.ts): `apps/web/src/lib/yjs.ts`

### SDL API

- [API server](https://github.com/amitht007/archflow/blob/master/apps/api/src/index.ts): `apps/api/src/index.ts`
- [Health route](https://github.com/amitht007/archflow/blob/master/apps/api/src/routes/health.ts): `apps/api/src/routes/health.ts`
- [SDL routes](https://github.com/amitht007/archflow/blob/master/apps/api/src/routes/sdl.ts): `apps/api/src/routes/sdl.ts`
- [SDL loading](https://github.com/amitht007/archflow/blob/master/apps/api/src/lib/sdl-loader.ts): `apps/api/src/lib/sdl-loader.ts`
- [Websocket handlers](https://github.com/amitht007/archflow/blob/master/apps/api/src/websocket.ts): `apps/api/src/websocket.ts`

### SDL processing

- [SDL parser and validator](https://github.com/amitht007/archflow/blob/master/packages/sdl/src/sdl/parser.ts): `packages/sdl/src/sdl/parser.ts`
- [SDL-Yjs conversion](https://github.com/amitht007/archflow/blob/master/packages/sdl/src/SDLParser.ts): `packages/sdl/src/SDLParser.ts`
- [Shared SDL types](https://github.com/amitht007/archflow/blob/master/packages/types/src/index.ts): `packages/types/src/index.ts`

### Other components

- **Architecture designer**
- **API client**

## Connections

- Architecture designer → Editor shell: opens editor (evidence: `README.md`)
- Editor shell → Canvas editor: renders (evidence: `apps/web/src/App.tsx`)
- Canvas editor → Component library: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Canvas creation: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Canvas context menu: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Selection inspector: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Service node: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Datastore node: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Gateway node: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → External node: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Lambda node: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Annotations and groups: renders (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Selection state: uses selection (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Canvas editor → Collaborative document: updates document (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Selection inspector → Selection state: reads selection (evidence: `apps/web/src/components/Inspector.tsx`)
- Selection inspector → Collaborative document: edits document (evidence: `apps/web/src/components/Inspector.tsx`)
- Selection inspector → SDL-Yjs conversion: uses conversion (evidence: `apps/web/src/components/Inspector.tsx`)
- Canvas editor → SDL-Yjs conversion: uses conversion (evidence: `apps/web/src/components/BaseCanvas.tsx`)
- Collaborative document → Websocket handlers: syncs over websocket
- API client → API server: sends requests (evidence: `README.md`)
- API server → Health route: routes health (evidence: `apps/api/src/index.ts`)
- API server → SDL routes: routes SDL (evidence: `apps/api/src/index.ts`)
- API server → Websocket handlers: upgrades websocket (evidence: `apps/api/src/index.ts`)
- SDL routes → SDL loading: loads SDL (evidence: `apps/api/src/routes/sdl.ts`)
- SDL routes → SDL parser and validator: validates payload (evidence: `apps/api/src/routes/sdl.ts`)
- SDL parser and validator → Shared SDL types: uses definitions (evidence: `packages/sdl/src/sdl/parser.ts`)
