# prem-the-designer/workflow architecture

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

- Interactive diagram: https://gitdiagram.com/prem-the-designer/workflow
- Repository: https://github.com/prem-the-designer/workflow

## Overview

Flowboard lets editors model one application as High, Design, and Core views on a shared board. The main workflow is to create or seed a board, edit modules and connections in the canvas, then review AI-generated proposals individually; approval applies a proposal, while rejection records visible disagreement. Board data, proposals, claims, and logs persist in Postgres. The graph preserves documented subboards and proposal safeguards; comments, exports, and revision history are described as not yet built. Some route and UI details are unsampled, so their internal links are omitted unless documented or indexed.

Main entry points: [`src/components/BoardClient.tsx`](https://github.com/prem-the-designer/workflow/blob/main/src/components/BoardClient.tsx) (Board canvas), [`src/db/index.ts`](https://github.com/prem-the-designer/workflow/blob/main/src/db/index.ts) (Database connector), [`src/app/api/propose/route.ts`](https://github.com/prem-the-designer/workflow/blob/main/src/app/api/propose/route.ts) (Proposal generation), [`src/app/api/proposals/[id]/decide/route.ts`](https://github.com/prem-the-designer/workflow/blob/main/src/app/api/proposals/%5Bid%5D/decide/route.ts) (Proposal decision)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Board experience"]
  node_board_entry["Board entry<br/>[page.tsx]"]
  node_board_canvas["Board canvas<br/>[BoardClient.tsx]"]
  node_new_board["New board<br/>[NewBoard.tsx]"]
  node_properties["Module editor"]
  node_proposal_panel["Proposal review<br/>[ProposalsPanel.tsx]"]
  node_seed_dialog["Seed dialog<br/>[SeedDialog.tsx]"]
  node_wires["Connection drawing<br/>[Wires.tsx]"]
end

subgraph group_routes["Application routes"]
  node_board_routes["Board routes"]
  node_module_routes["Module routes"]
  node_connection_routes["Connection routes"]
  node_propose_route["Proposal generation<br/>[route.ts]"]
  node_proposal_decision["Proposal decision<br/>[route.ts]"]
  node_proposal_claim["Proposal claims<br/>[route.ts]"]
end

subgraph group_domain["Board and proposals"]
  node_board_domain["Board reads and log<br/>[board.ts]"]
  node_view_model["Three-view model<br/>[types.ts]"]
  node_layout_geometry["Canvas geometry<br/>[geometry.ts]"]
  node_fingerprinting["Staleness fingerprint<br/>[fingerprint.ts]"]
end

subgraph group_persistence["Persistence"]
  node_database[("Board database<br/>[schema.ts]")]
  node_db_connector["Database connector<br/>[index.ts]"]
end

subgraph group_integrations["Identity and AI"]
  node_identity["Cookie identity<br/>[session.ts]"]
  node_ai_service["Proposal and draft AI<br/>[ai.ts]"]
end

node_editor(("Editor"))
node_anthropic{{"Anthropic API"}}
node_postgres[("Postgres")]

node_editor -->|"opens board"| node_board_entry
node_board_entry -->|"creates board"| node_new_board
node_editor -->|"edits views"| node_board_canvas
node_board_canvas -->|"opens editor"| node_properties
node_board_canvas -->|"opens review"| node_proposal_panel
node_board_canvas -->|"opens seeding"| node_seed_dialog
node_board_canvas -->|"renders connections"| node_wires
node_board_canvas -->|"creates modules"| node_module_routes
node_board_canvas -->|"creates connections"| node_connection_routes
node_board_canvas -->|"finds free slot"| node_layout_geometry
node_board_routes -->|"reads board"| node_board_domain
node_board_routes -->|"queries database"| node_db_connector
node_module_routes -->|"places module"| node_layout_geometry
node_module_routes -->|"writes modules"| node_db_connector
node_connection_routes -->|"writes connections"| node_db_connector
node_propose_route -->|"requests proposals"| node_ai_service
node_propose_route -->|"fingerprints targets"| node_fingerprinting
node_propose_route -->|"reads and stores proposals"| node_db_connector
node_propose_route -->|"logs edit and proposals"| node_board_domain
node_proposal_decision -->|"checks freshness"| node_fingerprinting
node_proposal_decision -->|"applies decision"| node_db_connector
node_proposal_decision -->|"logs decision"| node_board_domain
node_proposal_claim -->|"updates claim"| node_db_connector
node_board_domain -->|"reads and writes"| node_db_connector
node_db_connector -->|"uses schema"| node_database
node_db_connector -->|"connects"| node_postgres
node_ai_service -->|"calls model"| node_anthropic
node_propose_route -->|"gets actor"| node_identity
node_proposal_decision -->|"gets actor"| node_identity
node_board_canvas -->|"uses view data"| node_view_model
node_wires -->|"uses routing"| node_layout_geometry
node_new_board -.->|"creates board"| node_board_routes
node_seed_dialog -.->|"seeds board"| node_board_routes
node_seed_dialog -->|"requests draft"| node_ai_service
node_properties -.->|"submits edit"| node_propose_route
node_proposal_panel -.->|"submits decision"| node_proposal_decision

click node_board_entry "https://github.com/prem-the-designer/workflow/blob/main/src/app/page.tsx"
click node_board_canvas "https://github.com/prem-the-designer/workflow/blob/main/src/components/BoardClient.tsx"
click node_new_board "https://github.com/prem-the-designer/workflow/blob/main/src/components/NewBoard.tsx"
click node_properties "https://github.com/prem-the-designer/workflow/blob/main/src/components/PropertiesPanel.tsx"
click node_proposal_panel "https://github.com/prem-the-designer/workflow/blob/main/src/components/ProposalsPanel.tsx"
click node_seed_dialog "https://github.com/prem-the-designer/workflow/blob/main/src/components/SeedDialog.tsx"
click node_wires "https://github.com/prem-the-designer/workflow/blob/main/src/components/Wires.tsx"
click node_board_routes "https://github.com/prem-the-designer/workflow/tree/main/src/app/api/boards"
click node_module_routes "https://github.com/prem-the-designer/workflow/tree/main/src/app/api/modules"
click node_connection_routes "https://github.com/prem-the-designer/workflow/tree/main/src/app/api/connections"
click node_propose_route "https://github.com/prem-the-designer/workflow/blob/main/src/app/api/propose/route.ts"
click node_proposal_decision "https://github.com/prem-the-designer/workflow/blob/main/src/app/api/proposals/%5Bid%5D/decide/route.ts"
click node_proposal_claim "https://github.com/prem-the-designer/workflow/blob/main/src/app/api/proposals/%5Bid%5D/claim/route.ts"
click node_board_domain "https://github.com/prem-the-designer/workflow/blob/main/src/lib/board.ts"
click node_view_model "https://github.com/prem-the-designer/workflow/blob/main/src/lib/types.ts"
click node_layout_geometry "https://github.com/prem-the-designer/workflow/blob/main/src/lib/geometry.ts"
click node_fingerprinting "https://github.com/prem-the-designer/workflow/blob/main/src/lib/fingerprint.ts"
click node_database "https://github.com/prem-the-designer/workflow/blob/main/src/db/schema.ts"
click node_db_connector "https://github.com/prem-the-designer/workflow/blob/main/src/db/index.ts"
click node_identity "https://github.com/prem-the-designer/workflow/blob/main/src/lib/session.ts"
click node_ai_service "https://github.com/prem-the-designer/workflow/blob/main/src/lib/ai.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_board_entry,node_board_canvas,node_new_board,node_properties,node_proposal_panel,node_seed_dialog,node_wires toneBlue
class node_board_routes,node_module_routes,node_connection_routes,node_propose_route,node_proposal_decision,node_proposal_claim,node_postgres toneAmber
class node_board_domain,node_view_model,node_layout_geometry,node_fingerprinting,node_anthropic toneMint
class node_database,node_db_connector toneRose
class node_identity,node_ai_service,node_editor toneIndigo
```

## Components

### Board experience

- [Board entry](https://github.com/prem-the-designer/workflow/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Board canvas](https://github.com/prem-the-designer/workflow/blob/main/src/components/BoardClient.tsx): `src/components/BoardClient.tsx`
- [New board](https://github.com/prem-the-designer/workflow/blob/main/src/components/NewBoard.tsx): `src/components/NewBoard.tsx`
- [Module editor](https://github.com/prem-the-designer/workflow/blob/main/src/components/PropertiesPanel.tsx): `src/components/PropertiesPanel.tsx`
- [Proposal review](https://github.com/prem-the-designer/workflow/blob/main/src/components/ProposalsPanel.tsx): `src/components/ProposalsPanel.tsx`
- [Seed dialog](https://github.com/prem-the-designer/workflow/blob/main/src/components/SeedDialog.tsx): `src/components/SeedDialog.tsx`
- [Connection drawing](https://github.com/prem-the-designer/workflow/blob/main/src/components/Wires.tsx): `src/components/Wires.tsx`

### Application routes

- [Board routes](https://github.com/prem-the-designer/workflow/tree/main/src/app/api/boards): `src/app/api/boards`
- [Module routes](https://github.com/prem-the-designer/workflow/tree/main/src/app/api/modules): `src/app/api/modules`
- [Connection routes](https://github.com/prem-the-designer/workflow/tree/main/src/app/api/connections): `src/app/api/connections`
- [Proposal generation](https://github.com/prem-the-designer/workflow/blob/main/src/app/api/propose/route.ts): `src/app/api/propose/route.ts`
- [Proposal decision](https://github.com/prem-the-designer/workflow/blob/main/src/app/api/proposals/%5Bid%5D/decide/route.ts): `src/app/api/proposals/[id]/decide/route.ts`
- [Proposal claims](https://github.com/prem-the-designer/workflow/blob/main/src/app/api/proposals/%5Bid%5D/claim/route.ts): `src/app/api/proposals/[id]/claim/route.ts`

### Board and proposals

- [Board reads and log](https://github.com/prem-the-designer/workflow/blob/main/src/lib/board.ts): `src/lib/board.ts`
- [Three-view model](https://github.com/prem-the-designer/workflow/blob/main/src/lib/types.ts): `src/lib/types.ts`
- [Canvas geometry](https://github.com/prem-the-designer/workflow/blob/main/src/lib/geometry.ts): `src/lib/geometry.ts`
- [Staleness fingerprint](https://github.com/prem-the-designer/workflow/blob/main/src/lib/fingerprint.ts): `src/lib/fingerprint.ts`

### Persistence

- [Board database](https://github.com/prem-the-designer/workflow/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Database connector](https://github.com/prem-the-designer/workflow/blob/main/src/db/index.ts): `src/db/index.ts`

### Identity and AI

- [Cookie identity](https://github.com/prem-the-designer/workflow/blob/main/src/lib/session.ts): `src/lib/session.ts`
- [Proposal and draft AI](https://github.com/prem-the-designer/workflow/blob/main/src/lib/ai.ts): `src/lib/ai.ts`

### Other components

- **Editor**
- **Anthropic API**
- **Postgres**

## Connections

- Editor → Board entry: opens board (evidence: `README.md`)
- Board entry → New board: creates board (evidence: `src/app/page.tsx`)
- Editor → Board canvas: edits views (evidence: `README.md`)
- Board canvas → Module editor: opens editor (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Proposal review: opens review (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Seed dialog: opens seeding (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Connection drawing: renders connections (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Module routes: creates modules (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Connection routes: creates connections (evidence: `src/components/BoardClient.tsx`)
- Board canvas → Canvas geometry: finds free slot (evidence: `src/components/BoardClient.tsx`)
- Board routes → Board reads and log: reads board (evidence: `src/app/api/boards/[id]/route.ts`)
- Board routes → Database connector: queries database (evidence: `src/app/api/boards/route.ts`)
- Module routes → Canvas geometry: places module (evidence: `src/app/api/modules/route.ts`)
- Module routes → Database connector: writes modules (evidence: `src/app/api/modules/route.ts`)
- Connection routes → Database connector: writes connections (evidence: `src/app/api/connections/route.ts`)
- Proposal generation → Proposal and draft AI: requests proposals (evidence: `src/app/api/propose/route.ts`)
- Proposal generation → Staleness fingerprint: fingerprints targets (evidence: `src/app/api/propose/route.ts`)
- Proposal generation → Database connector: reads and stores proposals (evidence: `src/app/api/propose/route.ts`)
- Proposal generation → Board reads and log: logs edit and proposals (evidence: `src/app/api/propose/route.ts`)
- Proposal decision → Staleness fingerprint: checks freshness (evidence: `src/app/api/proposals/[id]/decide/route.ts`)
- Proposal decision → Database connector: applies decision (evidence: `src/app/api/proposals/[id]/decide/route.ts`)
- Proposal decision → Board reads and log: logs decision (evidence: `src/app/api/proposals/[id]/decide/route.ts`)
- Proposal claims → Database connector: updates claim (evidence: `src/app/api/proposals/[id]/claim/route.ts`)
- Board reads and log → Database connector: reads and writes (evidence: `src/lib/board.ts`)
- Database connector → Board database: uses schema (evidence: `src/db/index.ts`)
- Database connector → Postgres: connects (evidence: `src/db/index.ts`)
- Proposal and draft AI → Anthropic API: calls model (evidence: `src/lib/ai.ts`)
- Proposal generation → Cookie identity: gets actor (evidence: `src/app/api/propose/route.ts`)
- Proposal decision → Cookie identity: gets actor (evidence: `src/app/api/proposals/[id]/decide/route.ts`)
- Board canvas → Three-view model: uses view data (evidence: `src/components/BoardClient.tsx`)
- Connection drawing → Canvas geometry: uses routing (evidence: `src/components/Wires.tsx`)
- New board → Board routes: creates board
- Seed dialog → Board routes: seeds board
- Seed dialog → Proposal and draft AI: requests draft (evidence: `src/components/SeedDialog.tsx`)
- Module editor → Proposal generation: submits edit
- Proposal review → Proposal decision: submits decision
