# tumainihope00-creator/project-hub architecture

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

- Interactive diagram: https://gitdiagram.com/tumainihope00-creator/project-hub
- Repository: https://github.com/tumainihope00-creator/project-hub

## Overview

Project Hub is a project lifecycle and AI-coding history manager. Users capture an idea, develop it through structured project records and stages, generate prompts, maintain documents, and retain activity history. The React workspace calls an Express REST API backed by PostgreSQL/Prisma, with project files supporting a separate document-sync capability. The graph preserves the documented lifecycle, import, search, prompts, and monitoring branches; some route details are documented rather than sampled, so those relationships cite the README.

Main entry points: [`backend/src/app.ts`](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/app.ts) (Express API), [`backend/src/lib/projectDocumentSyncService.ts`](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentSyncService.ts) (Document sync service), [`backend/src/lib/prisma.ts`](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/prisma.ts) (PostgreSQL records), [`frontend/src/App.tsx`](https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/App.tsx) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Project workspace"]
  node_app["App routes<br/>[App.tsx]"]
  node_workspace["Lifecycle workspace<br/>[ProjectLayout.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_doc_ui["Document monitor UI"]
end

subgraph group_api["REST application"]
  node_api_app["Express API<br/>[app.ts]"]
end

subgraph group_lifecycle["Project lifecycle"]
  node_project_routes["Project routes<br/>[projects.ts]"]
  node_resource_routes["Generic resources<br/>[generic.ts]"]
  node_resource_defs["Resource definitions<br/>[resources.ts]"]
  node_import_routes["Import API<br/>[import.ts]"]
  node_import_pipeline["Import processing"]
  node_analytics_routes["Dashboard and search<br/>[misc.ts]"]
end

subgraph group_generation["Prompt generation"]
  node_generator_routes["Generator API<br/>[generator.ts]"]
  node_generator_pipeline["Generation pipeline<br/>[pipeline.ts]"]
  node_generation_data["Project context<br/>[collect.ts]"]
  node_prompt_context["Prompt context<br/>[promptContext.ts]"]
end

subgraph group_persistence["State and documents"]
  node_document_routes["Document monitoring API<br/>[documentMonitor.ts]"]
  node_doc_monitor["Document monitor"]
  node_doc_sync_service["Document sync service"]
  node_doc_parser["Document parser"]
  node_doc_sync["Change reconciliation"]
  node_project_document["Project document I/O<br/>[projectDocument.ts]"]
  node_database[("PostgreSQL records<br/>[prisma.ts]")]
end

node_user(("Project user"))
node_project_files["Project files"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_workspace
node_workspace -.->|"requests data"| node_api_client
node_api_client -->|"sends REST requests"| node_api_app
node_api_app -->|"mounts"| node_project_routes
node_api_app -->|"mounts"| node_resource_routes
node_api_app -.->|"mounts"| node_import_routes
node_api_app -.->|"mounts"| node_analytics_routes
node_api_app -->|"mounts"| node_generator_routes
node_project_routes -.->|"reads and writes"| node_database
node_resource_routes -->|"uses definitions"| node_resource_defs
node_resource_routes -.->|"reads and writes"| node_database
node_import_routes -.->|"dispatches import"| node_import_pipeline
node_import_pipeline -->|"maps resource types"| node_resource_defs
node_analytics_routes -.->|"queries summaries"| node_database
node_generator_routes -.->|"runs generation"| node_generator_pipeline
node_generator_pipeline -->|"collects context"| node_generation_data
node_generator_pipeline -.->|"uses prompt context"| node_prompt_context
node_generation_data -->|"reads project records"| node_database
node_app -->|"provides monitor"| node_doc_ui
node_doc_ui -->|"fetches and subscribes"| node_document_routes
node_api_app -.->|"mounts"| node_document_routes
node_document_routes -.->|"serves monitor"| node_doc_monitor
node_project_routes -->|"resolves conflicts"| node_doc_sync_service
node_doc_monitor -->|"coordinates sync"| node_doc_sync_service
node_doc_sync_service -->|"parses markdown"| node_doc_parser
node_doc_sync_service -->|"applies changes"| node_doc_sync
node_doc_sync_service -->|"resolves file path"| node_project_document
node_doc_sync_service -->|"loads and updates baseline"| node_database
node_project_document -.->|"reads and writes"| node_project_files

click node_app "https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/App.tsx"
click node_workspace "https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/pages/ProjectLayout.tsx"
click node_api_client "https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/api/client.ts"
click node_doc_ui "https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/lib/useDocumentMonitor.tsx"
click node_api_app "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/app.ts"
click node_project_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/projects.ts"
click node_resource_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/generic.ts"
click node_resource_defs "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/resources.ts"
click node_import_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/import.ts"
click node_import_pipeline "https://github.com/tumainihope00-creator/project-hub/tree/main/backend/src/lib/import"
click node_analytics_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/misc.ts"
click node_generator_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/generator.ts"
click node_generator_pipeline "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/generator/pipeline.ts"
click node_generation_data "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/generator/collect.ts"
click node_prompt_context "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/promptContext.ts"
click node_document_routes "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/documentMonitor.ts"
click node_doc_monitor "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentMonitor.ts"
click node_doc_sync_service "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentSyncService.ts"
click node_doc_parser "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentParser.ts"
click node_doc_sync "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentSync.ts"
click node_project_document "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocument.ts"
click node_database "https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/prisma.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_workspace,node_api_client,node_doc_ui,node_user toneBlue
class node_api_app toneAmber
class node_project_routes,node_resource_routes,node_resource_defs,node_import_routes,node_import_pipeline,node_analytics_routes toneMint
class node_generator_routes,node_generator_pipeline,node_generation_data,node_prompt_context toneRose
class node_document_routes,node_doc_monitor,node_doc_sync_service,node_doc_parser,node_doc_sync,node_project_document,node_database,node_project_files toneIndigo
```

## Components

### Project workspace

- [App routes](https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Lifecycle workspace](https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/pages/ProjectLayout.tsx): `frontend/src/pages/ProjectLayout.tsx`
- [API client](https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Document monitor UI](https://github.com/tumainihope00-creator/project-hub/blob/main/frontend/src/lib/useDocumentMonitor.tsx): `frontend/src/lib/useDocumentMonitor.tsx`

### REST application

- [Express API](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/app.ts): `backend/src/app.ts`

### Project lifecycle

- [Project routes](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/projects.ts): `backend/src/routes/projects.ts`
- [Generic resources](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/generic.ts): `backend/src/routes/generic.ts`
- [Resource definitions](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/resources.ts): `backend/src/resources.ts`
- [Import API](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/import.ts): `backend/src/routes/import.ts`
- [Import processing](https://github.com/tumainihope00-creator/project-hub/tree/main/backend/src/lib/import): `backend/src/lib/import`
- [Dashboard and search](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/misc.ts): `backend/src/routes/misc.ts`

### Prompt generation

- [Generator API](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/generator.ts): `backend/src/routes/generator.ts`
- [Generation pipeline](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/generator/pipeline.ts): `backend/src/lib/generator/pipeline.ts`
- [Project context](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/generator/collect.ts): `backend/src/lib/generator/collect.ts`
- [Prompt context](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/promptContext.ts): `backend/src/lib/promptContext.ts`

### State and documents

- [Document monitoring API](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/routes/documentMonitor.ts): `backend/src/routes/documentMonitor.ts`
- [Document monitor](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentMonitor.ts): `backend/src/lib/projectDocumentMonitor.ts`
- [Document sync service](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentSyncService.ts): `backend/src/lib/projectDocumentSyncService.ts`
- [Document parser](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentParser.ts): `backend/src/lib/projectDocumentParser.ts`
- [Change reconciliation](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocumentSync.ts): `backend/src/lib/projectDocumentSync.ts`
- [Project document I/O](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/projectDocument.ts): `backend/src/lib/projectDocument.ts`
- [PostgreSQL records](https://github.com/tumainihope00-creator/project-hub/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`

### Other components

- **Project user**
- **Project files**

## Connections

- Project user → App routes: uses (evidence: `frontend/src/App.tsx`)
- App routes → Lifecycle workspace: routes to (evidence: `frontend/src/App.tsx`)
- Lifecycle workspace → API client: requests data
- API client → Express API: sends REST requests
- Express API → Project routes: mounts (evidence: `backend/src/app.ts`)
- Express API → Generic resources: mounts (evidence: `backend/src/app.ts`)
- Express API → Import API: mounts (evidence: `backend/src/app.ts`)
- Express API → Dashboard and search: mounts (evidence: `backend/src/app.ts`)
- Express API → Generator API: mounts (evidence: `backend/src/app.ts`)
- Project routes → PostgreSQL records: reads and writes (evidence: `backend/src/routes/projects.ts`)
- Generic resources → Resource definitions: uses definitions (evidence: `backend/src/routes/generic.ts`)
- Generic resources → PostgreSQL records: reads and writes (evidence: `backend/src/routes/generic.ts`)
- Import API → Import processing: dispatches import
- Import processing → Resource definitions: maps resource types (evidence: `backend/src/lib/import/discovery.ts`)
- Dashboard and search → PostgreSQL records: queries summaries
- Generator API → Generation pipeline: runs generation
- Generation pipeline → Project context: collects context (evidence: `backend/src/lib/generator/pipeline.ts`)
- Generation pipeline → Prompt context: uses prompt context
- Project context → PostgreSQL records: reads project records (evidence: `backend/src/lib/generator/collect.ts`)
- App routes → Document monitor UI: provides monitor (evidence: `frontend/src/App.tsx`)
- Document monitor UI → Document monitoring API: fetches and subscribes (evidence: `frontend/src/lib/useDocumentMonitor.tsx`)
- Express API → Document monitoring API: mounts (evidence: `backend/src/app.ts`)
- Document monitoring API → Document monitor: serves monitor
- Project routes → Document sync service: resolves conflicts (evidence: `backend/src/routes/projects.ts`)
- Document monitor → Document sync service: coordinates sync (evidence: `backend/src/lib/projectDocumentMonitor.ts`)
- Document sync service → Document parser: parses markdown (evidence: `backend/src/lib/projectDocumentSyncService.ts`)
- Document sync service → Change reconciliation: applies changes (evidence: `backend/src/lib/projectDocumentSyncService.ts`)
- Document sync service → Project document I/O: resolves file path (evidence: `backend/src/lib/projectDocumentSyncService.ts`)
- Document sync service → PostgreSQL records: loads and updates baseline (evidence: `backend/src/lib/projectDocumentSyncService.ts`)
- Project document I/O → Project files: reads and writes
