# loganthp/gitcity architecture

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

- Interactive diagram: https://gitdiagram.com/loganthp/gitcity
- Repository: https://github.com/loganthp/gitcity

## Overview

GitCity turns a GitHub profile into a deterministic, explorable contribution city and reusable profile assets. The main workflow runs from a username in the web explorer through the API, GitHub data retrieval and normalization, city generation, and browser rendering. Separate branches cover achievements, themes, export formats, and CLI/Action generation. The README documents the overall flow; sampled source confirms several API, engine, and renderer calls. Other frontend and service internals were not sampled, so their links rely on README statements rather than inspected implementation.

Main entry points: [`packages/api-server/src/app.ts`](https://github.com/loganthp/gitcity/blob/main/packages/api-server/src/app.ts) (Hono API), [`packages/city-engine/src/generator.ts`](https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/generator.ts) (City generator), [`apps/web/src/pages/CityExplorerPage.tsx`](https://github.com/loganthp/gitcity/blob/main/apps/web/src/pages/CityExplorerPage.tsx) (City explorer), [`packages/renderer-3d/src/index.ts`](https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/index.ts) (3D renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web["City explorer"]
  node_webscene["3D / 2D scene<br/>[CityScene3D.tsx]"]
  node_webcontrols["Explorer controls"]
  node_inspector["Context inspector"]
  node_webapi["Web API service<br/>[api.ts]"]
end

subgraph group_data["GitHub data"]
  node_github["GitHub client<br/>[client.ts]"]
  node_normalizer["Data normalizer<br/>[index.ts]"]
  node_dataset["Normalized profile data<br/>[schemas.ts]"]
end

subgraph group_city["City domain"]
  node_engine["City generator<br/>[generator.ts]"]
  node_districts["District assignment<br/>[districts.ts]"]
  node_spatial["Spatial placement<br/>[spatial.ts]"]
  node_achievements["Achievement engine<br/>[index.ts]"]
  node_timeline["Growth timeline<br/>[generator.ts]"]
end

subgraph group_render["Rendering and themes"]
  node_theme["Theme SDK<br/>[themes.ts]"]
  node_themevalidation["Theme schemas<br/>[schemas.ts]"]
  node_renderer3d["3D renderer<br/>[index.ts]"]
  node_camera["Camera presets<br/>[camera.ts]"]
  node_lighting["Lighting<br/>[lighting.ts]"]
  node_textures["Textures<br/>[textures.ts]"]
  node_rendererpark["Contribution park"]
  node_rendererskyline["Skyline exports"]
  node_gif["GIF encoder<br/>[gif-encoder.ts]"]
  node_readmeembed["README embed<br/>[readme-embed.ts]"]
end

subgraph group_delivery["API and generation"]
  node_api["Hono API<br/>[app.ts]"]
  node_cli["Asset CLI<br/>[index.ts]"]
  node_action["Scheduled asset action"]
end

node_user(("GitHub username"))
node_githubservice["GitHub API"]
node_profile["Profile README"]
node_database[("Optional city database")]

node_user -->|"opens profile"| node_web
node_web -->|"requests city"| node_webapi
node_web -->|"shows city"| node_webscene
node_web -.->|"controls animation"| node_webcontrols
node_webscene -.->|"selects details"| node_inspector
node_webapi -->|"calls API"| node_api
node_api -->|"fetches profile"| node_github
node_github -->|"queries"| node_githubservice
node_github -->|"returns raw data"| node_normalizer
node_normalizer -->|"produces"| node_dataset
node_api -->|"generates city"| node_engine
node_api -->|"normalizes profile"| node_normalizer
node_engine -->|"assigns districts"| node_districts
node_engine -->|"places buildings"| node_spatial
node_engine -->|"evaluates milestones"| node_achievements
node_api -->|"evaluates profile"| node_achievements
node_api -->|"builds timeline"| node_timeline
node_engine -->|"consumes data"| node_dataset
node_engine -->|"uses theme"| node_theme
node_theme -->|"validates themes"| node_themevalidation
node_webscene -->|"renders city"| node_renderer3d
node_renderer3d -->|"uses presets"| node_camera
node_renderer3d -->|"uses lighting"| node_lighting
node_renderer3d -->|"uses textures"| node_textures
node_api -->|"renders skyline"| node_rendererskyline
node_api -->|"exports park"| node_rendererpark
node_rendererpark -->|"encodes animation"| node_gif
node_rendererpark -->|"uses palette"| node_theme
node_api -.->|"persists optionally"| node_database
node_cli -->|"generates city"| node_engine
node_cli -->|"renders assets"| node_rendererskyline
node_cli -->|"exports park"| node_rendererpark
node_action -->|"refreshes assets"| node_profile
node_readmeembed -->|"embeds exports"| node_profile

click node_web "https://github.com/loganthp/gitcity/blob/main/apps/web/src/pages/CityExplorerPage.tsx"
click node_webscene "https://github.com/loganthp/gitcity/blob/main/apps/web/src/scene/CityScene3D.tsx"
click node_webcontrols "https://github.com/loganthp/gitcity/blob/main/apps/web/src/components/AnimationControlCenter.tsx"
click node_inspector "https://github.com/loganthp/gitcity/blob/main/apps/web/src/components/ContextualInspector.tsx"
click node_webapi "https://github.com/loganthp/gitcity/blob/main/apps/web/src/services/api.ts"
click node_api "https://github.com/loganthp/gitcity/blob/main/packages/api-server/src/app.ts"
click node_github "https://github.com/loganthp/gitcity/blob/main/packages/github-client/src/client.ts"
click node_normalizer "https://github.com/loganthp/gitcity/blob/main/packages/data-normalizer/src/index.ts"
click node_dataset "https://github.com/loganthp/gitcity/blob/main/packages/shared-types/src/schemas.ts"
click node_engine "https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/generator.ts"
click node_districts "https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/districts.ts"
click node_spatial "https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/spatial.ts"
click node_achievements "https://github.com/loganthp/gitcity/blob/main/packages/achievements/src/index.ts"
click node_timeline "https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/generator.ts"
click node_theme "https://github.com/loganthp/gitcity/blob/main/packages/theme-sdk/src/themes.ts"
click node_themevalidation "https://github.com/loganthp/gitcity/blob/main/packages/theme-sdk/src/schemas.ts"
click node_renderer3d "https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/index.ts"
click node_camera "https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/camera.ts"
click node_lighting "https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/lighting.ts"
click node_textures "https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/textures.ts"
click node_rendererpark "https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/contribution-park.ts"
click node_rendererskyline "https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/contribution-skyline.ts"
click node_gif "https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/gif-encoder.ts"
click node_readmeembed "https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/readme-embed.ts"
click node_cli "https://github.com/loganthp/gitcity/blob/main/packages/cli/src/index.ts"
click node_action "https://github.com/loganthp/gitcity/blob/main/scripts/action-generate.mjs"

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,node_webscene,node_webcontrols,node_inspector,node_webapi,node_user toneBlue
class node_github,node_normalizer,node_dataset,node_database toneAmber
class node_engine,node_districts,node_spatial,node_achievements,node_timeline,node_githubservice toneMint
class node_theme,node_themevalidation,node_renderer3d,node_camera,node_lighting,node_textures,node_rendererpark,node_rendererskyline,node_gif,node_readmeembed toneRose
class node_api,node_cli,node_action,node_profile toneIndigo
```

## Components

### Web experience

- [City explorer](https://github.com/loganthp/gitcity/blob/main/apps/web/src/pages/CityExplorerPage.tsx): `apps/web/src/pages/CityExplorerPage.tsx`
- [3D / 2D scene](https://github.com/loganthp/gitcity/blob/main/apps/web/src/scene/CityScene3D.tsx): `apps/web/src/scene/CityScene3D.tsx`
- [Explorer controls](https://github.com/loganthp/gitcity/blob/main/apps/web/src/components/AnimationControlCenter.tsx): `apps/web/src/components/AnimationControlCenter.tsx`
- [Context inspector](https://github.com/loganthp/gitcity/blob/main/apps/web/src/components/ContextualInspector.tsx): `apps/web/src/components/ContextualInspector.tsx`
- [Web API service](https://github.com/loganthp/gitcity/blob/main/apps/web/src/services/api.ts): `apps/web/src/services/api.ts`

### GitHub data

- [GitHub client](https://github.com/loganthp/gitcity/blob/main/packages/github-client/src/client.ts): `packages/github-client/src/client.ts`
- [Data normalizer](https://github.com/loganthp/gitcity/blob/main/packages/data-normalizer/src/index.ts): `packages/data-normalizer/src/index.ts`
- [Normalized profile data](https://github.com/loganthp/gitcity/blob/main/packages/shared-types/src/schemas.ts): `packages/shared-types/src/schemas.ts`

### City domain

- [City generator](https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/generator.ts): `packages/city-engine/src/generator.ts`
- [District assignment](https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/districts.ts): `packages/city-engine/src/districts.ts`
- [Spatial placement](https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/spatial.ts): `packages/city-engine/src/spatial.ts`
- [Achievement engine](https://github.com/loganthp/gitcity/blob/main/packages/achievements/src/index.ts): `packages/achievements/src/index.ts`
- [Growth timeline](https://github.com/loganthp/gitcity/blob/main/packages/city-engine/src/generator.ts): `packages/city-engine/src/generator.ts`

### Rendering and themes

- [Theme SDK](https://github.com/loganthp/gitcity/blob/main/packages/theme-sdk/src/themes.ts): `packages/theme-sdk/src/themes.ts`
- [Theme schemas](https://github.com/loganthp/gitcity/blob/main/packages/theme-sdk/src/schemas.ts): `packages/theme-sdk/src/schemas.ts`
- [3D renderer](https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/index.ts): `packages/renderer-3d/src/index.ts`
- [Camera presets](https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/camera.ts): `packages/renderer-3d/src/camera.ts`
- [Lighting](https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/lighting.ts): `packages/renderer-3d/src/lighting.ts`
- [Textures](https://github.com/loganthp/gitcity/blob/main/packages/renderer-3d/src/textures.ts): `packages/renderer-3d/src/textures.ts`
- [Contribution park](https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/contribution-park.ts): `packages/renderer-svg/src/contribution-park.ts`
- [Skyline exports](https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/contribution-skyline.ts): `packages/renderer-svg/src/contribution-skyline.ts`
- [GIF encoder](https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/gif-encoder.ts): `packages/renderer-svg/src/gif-encoder.ts`
- [README embed](https://github.com/loganthp/gitcity/blob/main/packages/renderer-svg/src/readme-embed.ts): `packages/renderer-svg/src/readme-embed.ts`

### API and generation

- [Hono API](https://github.com/loganthp/gitcity/blob/main/packages/api-server/src/app.ts): `packages/api-server/src/app.ts`
- [Asset CLI](https://github.com/loganthp/gitcity/blob/main/packages/cli/src/index.ts): `packages/cli/src/index.ts`
- [Scheduled asset action](https://github.com/loganthp/gitcity/blob/main/scripts/action-generate.mjs): `scripts/action-generate.mjs`

### Other components

- **GitHub username**
- **GitHub API**
- **Profile README**
- **Optional city database**

## Connections

- GitHub username → City explorer: opens profile
- City explorer → Web API service: requests city
- City explorer → 3D / 2D scene: shows city
- City explorer → Explorer controls: controls animation
- 3D / 2D scene → Context inspector: selects details
- Web API service → Hono API: calls API
- Hono API → GitHub client: fetches profile
- GitHub client → GitHub API: queries
- GitHub client → Data normalizer: returns raw data
- Data normalizer → Normalized profile data: produces
- Hono API → City generator: generates city (evidence: `packages/api-server/src/app.ts`)
- Hono API → Data normalizer: normalizes profile
- City generator → District assignment: assigns districts (evidence: `packages/city-engine/src/generator.ts`)
- City generator → Spatial placement: places buildings (evidence: `packages/city-engine/src/generator.ts`)
- City generator → Achievement engine: evaluates milestones (evidence: `packages/city-engine/src/generator.ts`)
- Hono API → Achievement engine: evaluates profile (evidence: `packages/api-server/src/app.ts`)
- Hono API → Growth timeline: builds timeline (evidence: `packages/api-server/src/app.ts`)
- City generator → Normalized profile data: consumes data
- City generator → Theme SDK: uses theme
- Theme SDK → Theme schemas: validates themes (evidence: `packages/theme-sdk/src/themes.ts`)
- 3D / 2D scene → 3D renderer: renders city
- 3D renderer → Camera presets: uses presets (evidence: `packages/renderer-3d/src/index.ts`)
- 3D renderer → Lighting: uses lighting (evidence: `packages/renderer-3d/src/index.ts`)
- 3D renderer → Textures: uses textures (evidence: `packages/renderer-3d/src/index.ts`)
- Hono API → Skyline exports: renders skyline (evidence: `packages/api-server/src/app.ts`)
- Hono API → Contribution park: exports park
- Contribution park → GIF encoder: encodes animation (evidence: `packages/renderer-svg/src/gif-encoder.ts`)
- Contribution park → Theme SDK: uses palette
- Hono API → Optional city database: persists optionally
- Asset CLI → City generator: generates city (evidence: `packages/cli/src/index.ts`)
- Asset CLI → Skyline exports: renders assets (evidence: `packages/cli/src/index.ts`)
- Asset CLI → Contribution park: exports park
- Scheduled asset action → Profile README: refreshes assets
- README embed → Profile README: embeds exports
