# indredk/history architecture

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

- Interactive diagram: https://gitdiagram.com/indredk/history
- Repository: https://github.com/indredk/history

## Overview

Chinese Historical Panorama is an interactive platform for exploring Chinese history across time, people, events, culture, mythology, dynasties, and evolving historical maps. Users enter through a feature page, explore and filter historical material, and can manage event records; the backend exposes domain APIs backed by SQLite. The README documents synchronized timeline/map/event exploration, while sampled source confirms route registration and several controller-to-service calls. Frontend-to-API wiring and several domain implementations were not sampled, so those connections are shown only as unverified dashed links or omitted.

Main entry points: [`frontend/src/router/routes.ts`](https://github.com/indredk/history/blob/main/frontend/src/router/routes.ts) (Feature routes), [`backend/src/prisma/prisma.service.ts`](https://github.com/indredk/history/blob/main/backend/src/prisma/prisma.service.ts) (Prisma access), [`frontend/src/features/timeline`](https://github.com/indredk/history/tree/main/frontend/src/features/timeline) (Timeline explorer), [`frontend/src/services/timeline/timelineApi.ts`](https://github.com/indredk/history/blob/main/frontend/src/services/timeline/timelineApi.ts) (Timeline API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_explore["Explore UI"]
  node_routes["Feature routes<br/>[routes.ts]"]
  node_timeline["Timeline explorer"]
  node_mapui["Historical maps"]
  node_peopleui["People archive"]
  node_cultureui["Culture explorer"]
  node_mythui["Mythology graph"]
  node_dynastyui["Dynasty views"]
  node_eventmanager["Event manager<br/>[EventManager.tsx]"]
end

subgraph group_history["Historical domains"]
  node_eventdomain["Event operations<br/>[event.service.ts]"]
end

subgraph group_api["API layer"]
  node_timelineapi["Timeline API client<br/>[timelineApi.ts]"]
  node_mapservice["Map data service<br/>[mapDataService.ts]"]
  node_eventapi["Event endpoints"]
  node_mapapi["Places and boundaries<br/>[map.controller.ts]"]
  node_dynastyapi["Dynasty records"]
  node_cultureapi["Schools and scholars"]
  node_peopleapi["People records"]
  node_mythapi["Mythology records"]
  node_religionapi["Religion graph API"]
end

subgraph group_storage["Persistence"]
  node_prisma["Prisma access<br/>[prisma.service.ts]"]
  node_sqlite[("SQLite database")]
end

node_visitor(("History explorer"))

node_visitor -->|"opens"| node_routes
node_routes -->|"routes to"| node_timeline
node_routes -->|"routes to"| node_mapui
node_routes -->|"routes to"| node_peopleui
node_routes -->|"routes to"| node_cultureui
node_routes -->|"routes to"| node_mythui
node_routes -->|"routes to"| node_dynastyui
node_timeline -.->|"includes"| node_eventmanager
node_eventmanager -->|"mutates events"| node_timelineapi
node_timeline -.->|"loads timeline"| node_timelineapi
node_mapui -.->|"loads map data"| node_mapservice
node_timelineapi -.->|"calls API"| node_eventapi
node_eventapi -->|"delegates"| node_eventdomain
node_mapapi -->|"delegates"| node_mapservice
node_dynastyapi -->|"queries via"| node_prisma
node_cultureapi -->|"queries via"| node_prisma
node_peopleapi -.->|"queries via"| node_prisma
node_mythapi -.->|"queries via"| node_prisma
node_religionapi -.->|"queries via"| node_prisma
node_eventdomain -.->|"queries via"| node_prisma
node_prisma -.->|"persists to"| node_sqlite

click node_routes "https://github.com/indredk/history/blob/main/frontend/src/router/routes.ts"
click node_timeline "https://github.com/indredk/history/tree/main/frontend/src/features/timeline"
click node_mapui "https://github.com/indredk/history/tree/main/frontend/src/features/map"
click node_peopleui "https://github.com/indredk/history/tree/main/frontend/src/features/people"
click node_cultureui "https://github.com/indredk/history/tree/main/frontend/src/features/culture"
click node_mythui "https://github.com/indredk/history/tree/main/frontend/src/features/mythology"
click node_dynastyui "https://github.com/indredk/history/tree/main/frontend/src/features/dynasties"
click node_eventmanager "https://github.com/indredk/history/blob/main/frontend/src/features/timeline/components/EventManager.tsx"
click node_timelineapi "https://github.com/indredk/history/blob/main/frontend/src/services/timeline/timelineApi.ts"
click node_mapservice "https://github.com/indredk/history/blob/main/frontend/src/services/map/mapDataService.ts"
click node_eventapi "https://github.com/indredk/history/blob/main/backend/src/event/event.controller.ts"
click node_eventdomain "https://github.com/indredk/history/blob/main/backend/src/event/event.service.ts"
click node_mapapi "https://github.com/indredk/history/blob/main/backend/src/map/map.controller.ts"
click node_dynastyapi "https://github.com/indredk/history/blob/main/backend/src/dynasty/dynasty.controller.ts"
click node_cultureapi "https://github.com/indredk/history/blob/main/backend/src/culture/school.controller.ts"
click node_peopleapi "https://github.com/indredk/history/blob/main/backend/src/person/person.controller.ts"
click node_mythapi "https://github.com/indredk/history/blob/main/backend/src/mythology/mythology.controller.ts"
click node_religionapi "https://github.com/indredk/history/blob/main/backend/src/religion/religion.controller.ts"
click node_prisma "https://github.com/indredk/history/blob/main/backend/src/prisma/prisma.service.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_routes,node_timeline,node_mapui,node_peopleui,node_cultureui,node_mythui,node_dynastyui,node_eventmanager toneBlue
class node_eventdomain toneAmber
class node_timelineapi,node_mapservice,node_eventapi,node_mapapi,node_dynastyapi,node_cultureapi,node_peopleapi,node_mythapi,node_religionapi toneMint
class node_prisma,node_sqlite toneRose
class node_visitor toneIndigo
```

## Components

### Explore UI

- [Feature routes](https://github.com/indredk/history/blob/main/frontend/src/router/routes.ts): `frontend/src/router/routes.ts`
- [Timeline explorer](https://github.com/indredk/history/tree/main/frontend/src/features/timeline): `frontend/src/features/timeline`
- [Historical maps](https://github.com/indredk/history/tree/main/frontend/src/features/map): `frontend/src/features/map`
- [People archive](https://github.com/indredk/history/tree/main/frontend/src/features/people): `frontend/src/features/people`
- [Culture explorer](https://github.com/indredk/history/tree/main/frontend/src/features/culture): `frontend/src/features/culture`
- [Mythology graph](https://github.com/indredk/history/tree/main/frontend/src/features/mythology): `frontend/src/features/mythology`
- [Dynasty views](https://github.com/indredk/history/tree/main/frontend/src/features/dynasties): `frontend/src/features/dynasties`
- [Event manager](https://github.com/indredk/history/blob/main/frontend/src/features/timeline/components/EventManager.tsx): `frontend/src/features/timeline/components/EventManager.tsx`

### Historical domains

- [Event operations](https://github.com/indredk/history/blob/main/backend/src/event/event.service.ts): `backend/src/event/event.service.ts`

### API layer

- [Timeline API client](https://github.com/indredk/history/blob/main/frontend/src/services/timeline/timelineApi.ts): `frontend/src/services/timeline/timelineApi.ts`
- [Map data service](https://github.com/indredk/history/blob/main/frontend/src/services/map/mapDataService.ts): `frontend/src/services/map/mapDataService.ts`
- [Event endpoints](https://github.com/indredk/history/blob/main/backend/src/event/event.controller.ts): `backend/src/event/event.controller.ts`
- [Places and boundaries](https://github.com/indredk/history/blob/main/backend/src/map/map.controller.ts): `backend/src/map/map.controller.ts`
- [Dynasty records](https://github.com/indredk/history/blob/main/backend/src/dynasty/dynasty.controller.ts): `backend/src/dynasty/dynasty.controller.ts`
- [Schools and scholars](https://github.com/indredk/history/blob/main/backend/src/culture/school.controller.ts): `backend/src/culture/school.controller.ts`
- [People records](https://github.com/indredk/history/blob/main/backend/src/person/person.controller.ts): `backend/src/person/person.controller.ts`
- [Mythology records](https://github.com/indredk/history/blob/main/backend/src/mythology/mythology.controller.ts): `backend/src/mythology/mythology.controller.ts`
- [Religion graph API](https://github.com/indredk/history/blob/main/backend/src/religion/religion.controller.ts): `backend/src/religion/religion.controller.ts`

### Persistence

- [Prisma access](https://github.com/indredk/history/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- **SQLite database**

### Other components

- **History explorer**

## Connections

- History explorer → Feature routes: opens (evidence: `README.md`)
- Feature routes → Timeline explorer: routes to (evidence: `frontend/src/router/routes.ts`)
- Feature routes → Historical maps: routes to (evidence: `frontend/src/router/routes.ts`)
- Feature routes → People archive: routes to (evidence: `frontend/src/router/routes.ts`)
- Feature routes → Culture explorer: routes to (evidence: `frontend/src/router/routes.ts`)
- Feature routes → Mythology graph: routes to (evidence: `frontend/src/router/routes.ts`)
- Feature routes → Dynasty views: routes to (evidence: `frontend/src/router/routes.ts`)
- Timeline explorer → Event manager: includes (evidence: `frontend/src/features/timeline/components/EventManager.tsx`)
- Event manager → Timeline API client: mutates events (evidence: `frontend/src/features/timeline/components/EventManager.tsx`)
- Timeline explorer → Timeline API client: loads timeline
- Historical maps → Map data service: loads map data
- Timeline API client → Event endpoints: calls API
- Event endpoints → Event operations: delegates (evidence: `backend/src/event/event.controller.ts`)
- Places and boundaries → Map data service: delegates (evidence: `backend/src/map/map.controller.ts`)
- Dynasty records → Prisma access: queries via
- Schools and scholars → Prisma access: queries via
- People records → Prisma access: queries via
- Mythology records → Prisma access: queries via
- Religion graph API → Prisma access: queries via
- Event operations → Prisma access: queries via
- Prisma access → SQLite database: persists to
