# cyruschu430/hk-city-monitor architecture

> Architecture diagram of the GitHub repository cyruschu430/hk-city-monitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cyruschu430/hk-city-monitor
- Repository: https://github.com/cyruschu430/hk-city-monitor

## Overview

HK City Monitor is a static, browser-based Hong Kong situational-awareness dashboard. A reader opens the map, selects a scenario or panel, and sees sourced observations rendered as map layers and readouts; the app also supports camera imagery, search, bilingual display, and an offline-generated city brief. The main wiring and key fetch/render relationships are visible in excerpts; some README capabilities are documented but their data registries are absent from the supplied tree. The graph omits unverified links and treats the Worker as an optional proxy integration.

Main entry points: [`web/src/main.ts`](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/main.ts) (App bootstrap), [`web/src/ui/panels.ts`](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/panels.ts) (Panel engine), [`web/src/lib/adapters.ts`](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/adapters.ts) (Source adapters), [`web/src/lib/sources.ts`](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/sources.ts) (Source registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Dashboard runtime"]
  node_app["App bootstrap<br/>[main.ts]"]
  node_i18n["Bilingual UI<br/>[i18n.ts]"]
  node_search["⌘K search<br/>[search.ts]"]
end

subgraph group_data["Data and panels"]
  node_panel_engine["Panel engine<br/>[panels.ts]"]
  node_adapters["Source adapters<br/>[adapters.ts]"]
  node_parsers["Payload parsers<br/>[parsers.ts]"]
  node_sources["Source registry<br/>[sources.ts]"]
  node_honesty["Freshness states<br/>[honesty.ts]"]
  node_renderer["Panel renderer<br/>[render.ts]"]
  node_city_brief["City brief"]
end

subgraph group_map["Map experience"]
  node_map_engine["Map layers<br/>[overlays.ts]"]
  node_basemap["Basemap<br/>[basemap.ts]"]
  node_camera_layer["Camera layer<br/>[cameras.ts]"]
  node_symbols["Map symbols<br/>[symbols.ts]"]
  node_layer_controls["Layer controls<br/>[layercontrol.ts]"]
  node_ticker["Live ticker<br/>[ticker.ts]"]
end

subgraph group_services["External services"]
  node_worker["Whitelist proxy<br/>[index.js]"]
  node_open_sources["Public data publishers"]
  node_static_brief["Published brief file"]
end

node_reader(("Dashboard reader"))

node_reader -->|"opens"| node_app
node_app -->|"loads registry"| node_sources
node_app -->|"loads cameras"| node_camera_layer
node_app -->|"applies layers"| node_map_engine
node_app -->|"creates ticker"| node_ticker
node_app -.->|"wires controls"| node_layer_controls
node_app -.->|"mounts panels"| node_panel_engine
node_panel_engine -->|"fetches data"| node_adapters
node_adapters -->|"fetches sources"| node_sources
node_adapters -.->|"parses payloads"| node_parsers
node_panel_engine -.->|"tracks freshness"| node_honesty
node_panel_engine -->|"renders panels"| node_renderer
node_map_engine -->|"adapts layer data"| node_adapters
node_map_engine -->|"fetches layer data"| node_sources
node_camera_layer -->|"registers glyphs"| node_symbols
node_reader -->|"reads brief"| node_city_brief
node_city_brief -->|"assembles feeds"| node_open_sources
node_city_brief -->|"publishes JSON"| node_static_brief
node_panel_engine -->|"shows observations"| node_open_sources
node_sources -.->|"proxies restricted feeds"| node_worker
node_worker -.->|"requests whitelisted data"| node_open_sources

click node_app "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/main.ts"
click node_i18n "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/i18n.ts"
click node_search "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/search.ts"
click node_panel_engine "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/panels.ts"
click node_adapters "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/adapters.ts"
click node_parsers "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/parsers.ts"
click node_sources "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/sources.ts"
click node_honesty "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/honesty.ts"
click node_renderer "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/render.ts"
click node_city_brief "https://github.com/cyruschu430/hk-city-monitor/blob/master/scripts/build_ai_summary.py"
click node_map_engine "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/overlays.ts"
click node_basemap "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/basemap.ts"
click node_camera_layer "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/cameras.ts"
click node_symbols "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/symbols.ts"
click node_layer_controls "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/layercontrol.ts"
click node_ticker "https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/ticker.ts"
click node_worker "https://github.com/cyruschu430/hk-city-monitor/blob/master/worker/src/index.js"

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_i18n,node_search toneBlue
class node_panel_engine,node_adapters,node_parsers,node_sources,node_honesty,node_renderer,node_city_brief toneAmber
class node_map_engine,node_basemap,node_camera_layer,node_symbols,node_layer_controls,node_ticker toneMint
class node_worker,node_open_sources,node_static_brief toneRose
class node_reader toneIndigo
```

## Components

### Dashboard runtime

- [App bootstrap](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/main.ts): `web/src/main.ts`
- [Bilingual UI](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/i18n.ts): `web/src/lib/i18n.ts`
- [⌘K search](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/search.ts): `web/src/lib/search.ts`

### Data and panels

- [Panel engine](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/panels.ts): `web/src/ui/panels.ts`
- [Source adapters](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/adapters.ts): `web/src/lib/adapters.ts`
- [Payload parsers](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/parsers.ts): `web/src/lib/parsers.ts`
- [Source registry](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/sources.ts): `web/src/lib/sources.ts`
- [Freshness states](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/honesty.ts): `web/src/lib/honesty.ts`
- [Panel renderer](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/lib/render.ts): `web/src/lib/render.ts`
- [City brief](https://github.com/cyruschu430/hk-city-monitor/blob/master/scripts/build_ai_summary.py): `scripts/build_ai_summary.py`

### Map experience

- [Map layers](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/overlays.ts): `web/src/map/overlays.ts`
- [Basemap](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/basemap.ts): `web/src/map/basemap.ts`
- [Camera layer](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/cameras.ts): `web/src/map/cameras.ts`
- [Map symbols](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/map/symbols.ts): `web/src/map/symbols.ts`
- [Layer controls](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/layercontrol.ts): `web/src/ui/layercontrol.ts`
- [Live ticker](https://github.com/cyruschu430/hk-city-monitor/blob/master/web/src/ui/ticker.ts): `web/src/ui/ticker.ts`

### External services

- [Whitelist proxy](https://github.com/cyruschu430/hk-city-monitor/blob/master/worker/src/index.js): `worker/src/index.js`
- **Public data publishers**
- **Published brief file**

### Other components

- **Dashboard reader**

## Connections

- Dashboard reader → App bootstrap: opens (evidence: `README.md`)
- App bootstrap → Source registry: loads registry (evidence: `web/src/main.ts`)
- App bootstrap → Camera layer: loads cameras (evidence: `web/src/main.ts`)
- App bootstrap → Map layers: applies layers (evidence: `web/src/main.ts`)
- App bootstrap → Live ticker: creates ticker (evidence: `web/src/main.ts`)
- App bootstrap → Layer controls: wires controls (evidence: `web/src/main.ts`)
- App bootstrap → Panel engine: mounts panels (evidence: `web/src/main.ts`)
- Panel engine → Source adapters: fetches data (evidence: `web/src/ui/panels.ts`)
- Source adapters → Source registry: fetches sources (evidence: `web/src/lib/adapters.ts`)
- Source adapters → Payload parsers: parses payloads (evidence: `web/src/lib/adapters.ts`)
- Panel engine → Freshness states: tracks freshness (evidence: `web/src/ui/panels.ts`)
- Panel engine → Panel renderer: renders panels (evidence: `web/src/ui/panels.ts`)
- Map layers → Source adapters: adapts layer data (evidence: `web/src/map/overlays.ts`)
- Map layers → Source registry: fetches layer data (evidence: `web/src/map/overlays.ts`)
- Camera layer → Map symbols: registers glyphs (evidence: `web/src/map/cameras.ts`)
- Dashboard reader → City brief: reads brief (evidence: `README.md`)
- City brief → Public data publishers: assembles feeds (evidence: `README.md`)
- City brief → Published brief file: publishes JSON (evidence: `README.md`)
- Panel engine → Public data publishers: shows observations (evidence: `README.md`)
- Source registry → Whitelist proxy: proxies restricted feeds (evidence: `README.md`)
- Whitelist proxy → Public data publishers: requests whitelisted data
