# yangshun2005/utopia-cn architecture

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

- Interactive diagram: https://gitdiagram.com/yangshun2005/utopia-cn
- Repository: https://github.com/yangshun2005/utopia-cn

## Overview

Utopia is an enterprise knowledge platform: users connect or upload sources, ingest documents, extract and govern time-aware facts, then explore the graph or ask questions through search and chat. The repository separates a React application, Rust API and workflow services, domain crates, and PostgreSQL-backed persistence. README-described capabilities include ontology editing, reasoning, entity resolution, conflict review, database querying, and audit history. Some subsystem links below are documented rather than verified in sampled source; those edges are marked dashed where appropriate.

Main entry points: [`crates/utopia-server/src/pipeline.rs`](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/pipeline.rs) (Document pipeline), [`crates/utopia-store/src/db.rs`](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-store/src/db.rs) (PostgreSQL knowledge store), [`web/src/router.tsx`](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/router.tsx) (Product screens), [`crates/utopia-server/src/ingest_sources.rs`](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/ingest_sources.rs) (Source synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web_app["Web application<br/>[main.tsx]"]
  node_web_routes["Product screens<br/>[router.tsx]"]
  node_search_chat["Search and chat<br/>[Chat.tsx]"]
  node_graph_ui["Graph explorer<br/>[Graph.tsx]"]
  node_ontology_ui["Ontology workbench<br/>[Ontology.tsx]"]
  node_review_ui["Review console<br/>[Review.tsx]"]
end

subgraph group_api["API and orchestration"]
  node_server["Rust application server<br/>[main.rs]"]
  node_auth["Authentication<br/>[auth.rs]"]
  node_source_api["Source and document APIs<br/>[sources_routes.rs]"]
  node_graph_api["Graph API<br/>[graph_routes.rs]"]
  node_ontology_api["Ontology API<br/>[ontology_routes.rs]"]
  node_review_api["Review API<br/>[review_routes.rs]"]
end

subgraph group_knowledge["Knowledge processing"]
  node_ingest_sync["Source synchronization<br/>[ingest_sources.rs]"]
  node_ingest_parsers["Document parsing<br/>[parsers.rs]"]
  node_extract["Fact extraction<br/>[lib.rs]"]
  node_pipeline["Document pipeline<br/>[pipeline.rs]"]
  node_search_engine["Full-text search<br/>[lib.rs]"]
  node_llm["LLM integration<br/>[lib.rs]"]
end

subgraph group_governance["Knowledge governance"]
  node_ontology["Ontology and reasoning<br/>[derive.rs]"]
  node_resolution["Entity resolution<br/>[type_resolution.rs]"]
  node_temporal["Temporal graph<br/>[temporal.rs]"]
  node_query_engine["Mounted database queries<br/>[mod.rs]"]
end

subgraph group_persistence["Persistence and integrations"]
  node_store[("PostgreSQL knowledge store<br/>[db.rs]")]
  node_blob_store[("Document object storage<br/>[object_storage.rs]")]
end

node_user(("Workspace user"))
node_external_sources["Connected content sources"]
node_mounted_db[("Mounted enterprise database")]

node_user -->|"uses"| node_web_app
node_web_app -->|"renders routes"| node_web_routes
node_web_routes -->|"routes to"| node_search_chat
node_web_routes -->|"routes to"| node_graph_ui
node_web_routes -->|"routes to"| node_ontology_ui
node_web_routes -->|"routes to"| node_review_ui
node_web_app -.->|"calls APIs"| node_server
node_server -.->|"authenticates"| node_auth
node_source_api -->|"schedules sync"| node_ingest_sync
node_external_sources -->|"provides content"| node_ingest_sync
node_ingest_sync -->|"submits documents"| node_pipeline
node_pipeline -.->|"parses documents"| node_ingest_parsers
node_pipeline -.->|"extracts facts"| node_extract
node_pipeline -.->|"persists results"| node_store
node_pipeline -.->|"indexes documents"| node_search_engine
node_pipeline -->|"requests models"| node_llm
node_search_chat -.->|"searches knowledge"| node_search_engine
node_search_chat -.->|"queries mounted data"| node_query_engine
node_query_engine -.->|"queries"| node_mounted_db
node_graph_ui -.->|"requests graph"| node_graph_api
node_ontology_ui -.->|"edits ontology"| node_ontology_api
node_review_ui -->|"submits decisions"| node_review_api
node_graph_api -->|"reads graph"| node_store
node_review_api -->|"resolves decisions"| node_store
node_ontology_api -->|"saves ontology"| node_store
node_ontology -.->|"derives facts"| node_temporal
node_resolution -.->|"records merges"| node_store
node_temporal -.->|"stores fact history"| node_store
node_blob_store -->|"supplies objects"| node_ingest_sync

click node_web_app "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/main.tsx"
click node_web_routes "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/router.tsx"
click node_search_chat "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Chat.tsx"
click node_graph_ui "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Graph.tsx"
click node_ontology_ui "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Ontology.tsx"
click node_review_ui "https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Review.tsx"
click node_server "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/main.rs"
click node_auth "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/auth.rs"
click node_source_api "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/sources_routes.rs"
click node_graph_api "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/graph_routes.rs"
click node_ontology_api "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/ontology_routes.rs"
click node_review_api "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/review_routes.rs"
click node_ingest_sync "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/ingest_sources.rs"
click node_ingest_parsers "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-ingest/src/parsers.rs"
click node_extract "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-extract/src/lib.rs"
click node_pipeline "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/pipeline.rs"
click node_search_engine "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-search/src/lib.rs"
click node_llm "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-llm/src/lib.rs"
click node_ontology "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-reason/src/derive.rs"
click node_resolution "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/type_resolution.rs"
click node_temporal "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-store/src/temporal.rs"
click node_query_engine "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/query_engine/mod.rs"
click node_store "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-store/src/db.rs"
click node_blob_store "https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/object_storage.rs"

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_web_app,node_web_routes,node_search_chat,node_graph_ui,node_ontology_ui,node_review_ui,node_user toneBlue
class node_server,node_auth,node_source_api,node_graph_api,node_ontology_api,node_review_api,node_mounted_db toneAmber
class node_ingest_sync,node_ingest_parsers,node_extract,node_pipeline,node_search_engine,node_llm toneMint
class node_ontology,node_resolution,node_temporal,node_query_engine toneRose
class node_store,node_blob_store,node_external_sources toneIndigo
```

## Components

### User experience

- [Web application](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/main.tsx): `web/src/main.tsx`
- [Product screens](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/router.tsx): `web/src/router.tsx`
- [Search and chat](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Chat.tsx): `web/src/pages/Chat.tsx`
- [Graph explorer](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Graph.tsx): `web/src/pages/Graph.tsx`
- [Ontology workbench](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Ontology.tsx): `web/src/pages/Ontology.tsx`
- [Review console](https://github.com/yangshun2005/utopia-cn/blob/main/web/src/pages/Review.tsx): `web/src/pages/Review.tsx`

### API and orchestration

- [Rust application server](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/main.rs): `crates/utopia-server/src/main.rs`
- [Authentication](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/auth.rs): `crates/utopia-server/src/auth.rs`
- [Source and document APIs](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/sources_routes.rs): `crates/utopia-server/src/api/sources_routes.rs`
- [Graph API](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/graph_routes.rs): `crates/utopia-server/src/api/graph_routes.rs`
- [Ontology API](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/ontology_routes.rs): `crates/utopia-server/src/api/ontology_routes.rs`
- [Review API](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/api/review_routes.rs): `crates/utopia-server/src/api/review_routes.rs`

### Knowledge processing

- [Source synchronization](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/ingest_sources.rs): `crates/utopia-server/src/ingest_sources.rs`
- [Document parsing](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-ingest/src/parsers.rs): `crates/utopia-ingest/src/parsers.rs`
- [Fact extraction](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-extract/src/lib.rs): `crates/utopia-extract/src/lib.rs`
- [Document pipeline](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/pipeline.rs): `crates/utopia-server/src/pipeline.rs`
- [Full-text search](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-search/src/lib.rs): `crates/utopia-search/src/lib.rs`
- [LLM integration](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-llm/src/lib.rs): `crates/utopia-llm/src/lib.rs`

### Knowledge governance

- [Ontology and reasoning](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-reason/src/derive.rs): `crates/utopia-reason/src/derive.rs`
- [Entity resolution](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/type_resolution.rs): `crates/utopia-server/src/type_resolution.rs`
- [Temporal graph](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-store/src/temporal.rs): `crates/utopia-store/src/temporal.rs`
- [Mounted database queries](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/query_engine/mod.rs): `crates/utopia-server/src/query_engine/mod.rs`

### Persistence and integrations

- [PostgreSQL knowledge store](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-store/src/db.rs): `crates/utopia-store/src/db.rs`
- [Document object storage](https://github.com/yangshun2005/utopia-cn/blob/main/crates/utopia-server/src/object_storage.rs): `crates/utopia-server/src/object_storage.rs`

### Other components

- **Workspace user**
- **Connected content sources**
- **Mounted enterprise database**

## Connections

- Workspace user → Web application: uses (evidence: `README.md`)
- Web application → Product screens: renders routes (evidence: `web/src/main.tsx`)
- Product screens → Search and chat: routes to (evidence: `web/src/router.tsx`)
- Product screens → Graph explorer: routes to (evidence: `web/src/router.tsx`)
- Product screens → Ontology workbench: routes to (evidence: `web/src/router.tsx`)
- Product screens → Review console: routes to (evidence: `web/src/router.tsx`)
- Web application → Rust application server: calls APIs
- Rust application server → Authentication: authenticates
- Source and document APIs → Source synchronization: schedules sync (evidence: `crates/utopia-server/src/api/sources_routes.rs`)
- Connected content sources → Source synchronization: provides content (evidence: `README.md`)
- Source synchronization → Document pipeline: submits documents (evidence: `crates/utopia-server/src/ingest_sources.rs`)
- Document pipeline → Document parsing: parses documents (evidence: `README.md`)
- Document pipeline → Fact extraction: extracts facts (evidence: `README.md`)
- Document pipeline → PostgreSQL knowledge store: persists results (evidence: `README.md`)
- Document pipeline → Full-text search: indexes documents (evidence: `README.md`)
- Document pipeline → LLM integration: requests models (evidence: `crates/utopia-server/src/pipeline.rs`)
- Search and chat → Full-text search: searches knowledge (evidence: `README.md`)
- Search and chat → Mounted database queries: queries mounted data (evidence: `README.md`)
- Mounted database queries → Mounted enterprise database: queries (evidence: `README.md`)
- Graph explorer → Graph API: requests graph
- Ontology workbench → Ontology API: edits ontology
- Review console → Review API: submits decisions (evidence: `web/src/pages/Review.tsx`)
- Graph API → PostgreSQL knowledge store: reads graph (evidence: `crates/utopia-server/src/api/graph_routes.rs`)
- Review API → PostgreSQL knowledge store: resolves decisions (evidence: `crates/utopia-server/src/api/review_routes.rs`)
- Ontology API → PostgreSQL knowledge store: saves ontology (evidence: `crates/utopia-server/src/api/ontology_routes.rs`)
- Ontology and reasoning → Temporal graph: derives facts (evidence: `README.md`)
- Entity resolution → PostgreSQL knowledge store: records merges (evidence: `README.md`)
- Temporal graph → PostgreSQL knowledge store: stores fact history (evidence: `README.md`)
- Document object storage → Source synchronization: supplies objects (evidence: `crates/utopia-server/src/ingest_sources.rs`)
