# idris-p/rush-hour architecture

> Architecture diagram of the GitHub repository idris-p/rush-hour, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/idris-p/rush-hour
- Repository: https://github.com/idris-p/rush-hour

## Overview

Rush Hour is a browser-based London Underground speedrunning game. Players start a seeded or random five-round run (or tutorial), navigate from a generated start to a destination using map direction stubs and line changes, and finish with round results measuring time, moves, and changes. The graph captures the documented gameplay and map/search capabilities plus the sampled state, network, and SVG-rendering layers. Several UI and input details are only documented or visible through partial excerpts, so uncertain wiring is omitted.

Main entry points: [`src/main.ts`](https://github.com/idris-p/rush-hour/blob/main/src/main.ts) (Application entry), [`src/rendering/mapRenderer.ts`](https://github.com/idris-p/rush-hour/blob/main/src/rendering/mapRenderer.ts) (Map renderer), [`src/game/runSession.ts`](https://github.com/idris-p/rush-hour/blob/main/src/game/runSession.ts) (Run session), [`src/game/AppController.ts`](https://github.com/idris-p/rush-hour/blob/main/src/game/AppController.ts) (Phase controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Run gameplay"]
  node_controller["Phase controller<br/>[AppController.ts]"]
  node_runs["Run session<br/>[runSession.ts]"]
  node_seeds["Seed and rounds<br/>[seed.ts]"]
  node_game_state["Round state<br/>[GameState.ts]"]
  node_movement["Movement rules<br/>[movement.ts]"]
  node_line_selection["Line selection<br/>[lineSelection.ts]"]
  node_journey["Journey summary<br/>[journey.ts]"]
  node_tutorial["Tutorial rules<br/>[tutorial.ts]"]
end

subgraph group_map["Map experience"]
  node_search["Station search<br/>[stationSearch.ts]"]
  node_input["Gameplay input<br/>[stubSelection.ts]"]
  node_panzoom["Map pan and zoom"]
  node_pinch["Pinch gesture<br/>[pinchZoom.ts]"]
end

subgraph group_domain["Network and rules"]
  node_network["Network assembly<br/>[network.ts]"]
  node_validation["Network validation<br/>[validation.ts]"]
  node_network_data["Network data<br/>[types.ts]"]
end

subgraph group_presentation["UI and rendering"]
  node_entry["Application entry<br/>[main.ts]"]
  node_hud["HUD and results<br/>[hud.ts]"]
  node_renderer["Map renderer<br/>[mapRenderer.ts]"]
  node_corridors["Corridor layout<br/>[corridorLayout.ts]"]
  node_line_render["Line rendering<br/>[lineRenderer.ts]"]
  node_station_render["Station rendering<br/>[stationRenderer.ts]"]
end

node_player(("Player"))
node_external_analytics["Analytics service"]
node_external_speed["Speed insights"]

node_player -->|"starts and plays"| node_entry
node_entry -->|"changes phase"| node_controller
node_entry -->|"starts run"| node_runs
node_controller -->|"advances rounds"| node_runs
node_runs -->|"generates rounds"| node_seeds
node_controller -->|"creates round"| node_game_state
node_entry -->|"attempts move"| node_movement
node_entry -->|"attempts tutorial move"| node_tutorial
node_entry -->|"selects line"| node_line_selection
node_entry -->|"renders gameplay"| node_renderer
node_entry -->|"updates interface"| node_hud
node_hud -->|"summarizes journey"| node_journey
node_hud -->|"previews lines"| node_line_selection
node_player -->|"searches stations"| node_search
node_search -->|"selects station"| node_entry
node_player -->|"chooses direction"| node_input
node_input -->|"dispatches move"| node_entry
node_player -->|"pans or zooms"| node_panzoom
node_panzoom -->|"changes view"| node_renderer
node_panzoom -->|"reads gesture"| node_pinch
node_renderer -->|"reads station and direction"| node_movement
node_renderer -->|"gets map geometry"| node_corridors
node_renderer -->|"renders routes"| node_line_render
node_renderer -->|"renders stations"| node_station_render
node_network -->|"assembles"| node_network_data
node_entry -->|"loads network"| node_network
node_entry -->|"validates network"| node_validation
node_runs -->|"uses stations"| node_network
node_external_analytics -.->|"reports usage"| node_entry
node_external_speed -.->|"reports performance"| node_entry

click node_entry "https://github.com/idris-p/rush-hour/blob/main/src/main.ts"
click node_controller "https://github.com/idris-p/rush-hour/blob/main/src/game/AppController.ts"
click node_runs "https://github.com/idris-p/rush-hour/blob/main/src/game/runSession.ts"
click node_seeds "https://github.com/idris-p/rush-hour/blob/main/src/game/seed.ts"
click node_game_state "https://github.com/idris-p/rush-hour/blob/main/src/game/GameState.ts"
click node_movement "https://github.com/idris-p/rush-hour/blob/main/src/game/movement.ts"
click node_line_selection "https://github.com/idris-p/rush-hour/blob/main/src/game/lineSelection.ts"
click node_journey "https://github.com/idris-p/rush-hour/blob/main/src/game/journey.ts"
click node_tutorial "https://github.com/idris-p/rush-hour/blob/main/src/game/tutorial.ts"
click node_hud "https://github.com/idris-p/rush-hour/blob/main/src/ui/hud.ts"
click node_search "https://github.com/idris-p/rush-hour/blob/main/src/ui/stationSearch.ts"
click node_input "https://github.com/idris-p/rush-hour/blob/main/src/input/stubSelection.ts"
click node_panzoom "https://github.com/idris-p/rush-hour/blob/main/src/input/mapPanZoomController.ts"
click node_pinch "https://github.com/idris-p/rush-hour/blob/main/src/input/pinchZoom.ts"
click node_network "https://github.com/idris-p/rush-hour/blob/main/src/data/network.ts"
click node_validation "https://github.com/idris-p/rush-hour/blob/main/src/data/validation.ts"
click node_network_data "https://github.com/idris-p/rush-hour/blob/main/src/data/types.ts"
click node_renderer "https://github.com/idris-p/rush-hour/blob/main/src/rendering/mapRenderer.ts"
click node_corridors "https://github.com/idris-p/rush-hour/blob/main/src/rendering/corridorLayout.ts"
click node_line_render "https://github.com/idris-p/rush-hour/blob/main/src/rendering/lineRenderer.ts"
click node_station_render "https://github.com/idris-p/rush-hour/blob/main/src/rendering/stationRenderer.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_controller,node_runs,node_seeds,node_game_state,node_movement,node_line_selection,node_journey,node_tutorial toneBlue
class node_search,node_input,node_panzoom,node_pinch toneAmber
class node_network,node_validation,node_network_data toneMint
class node_entry,node_hud,node_renderer,node_corridors,node_line_render,node_station_render toneRose
class node_player,node_external_analytics,node_external_speed toneIndigo
```

## Components

### Run gameplay

- [Phase controller](https://github.com/idris-p/rush-hour/blob/main/src/game/AppController.ts): `src/game/AppController.ts`
- [Run session](https://github.com/idris-p/rush-hour/blob/main/src/game/runSession.ts): `src/game/runSession.ts`
- [Seed and rounds](https://github.com/idris-p/rush-hour/blob/main/src/game/seed.ts): `src/game/seed.ts`
- [Round state](https://github.com/idris-p/rush-hour/blob/main/src/game/GameState.ts): `src/game/GameState.ts`
- [Movement rules](https://github.com/idris-p/rush-hour/blob/main/src/game/movement.ts): `src/game/movement.ts`
- [Line selection](https://github.com/idris-p/rush-hour/blob/main/src/game/lineSelection.ts): `src/game/lineSelection.ts`
- [Journey summary](https://github.com/idris-p/rush-hour/blob/main/src/game/journey.ts): `src/game/journey.ts`
- [Tutorial rules](https://github.com/idris-p/rush-hour/blob/main/src/game/tutorial.ts): `src/game/tutorial.ts`

### Map experience

- [Station search](https://github.com/idris-p/rush-hour/blob/main/src/ui/stationSearch.ts): `src/ui/stationSearch.ts`
- [Gameplay input](https://github.com/idris-p/rush-hour/blob/main/src/input/stubSelection.ts): `src/input/stubSelection.ts`
- [Map pan and zoom](https://github.com/idris-p/rush-hour/blob/main/src/input/mapPanZoomController.ts): `src/input/mapPanZoomController.ts`
- [Pinch gesture](https://github.com/idris-p/rush-hour/blob/main/src/input/pinchZoom.ts): `src/input/pinchZoom.ts`

### Network and rules

- [Network assembly](https://github.com/idris-p/rush-hour/blob/main/src/data/network.ts): `src/data/network.ts`
- [Network validation](https://github.com/idris-p/rush-hour/blob/main/src/data/validation.ts): `src/data/validation.ts`
- [Network data](https://github.com/idris-p/rush-hour/blob/main/src/data/types.ts): `src/data/types.ts`

### UI and rendering

- [Application entry](https://github.com/idris-p/rush-hour/blob/main/src/main.ts): `src/main.ts`
- [HUD and results](https://github.com/idris-p/rush-hour/blob/main/src/ui/hud.ts): `src/ui/hud.ts`
- [Map renderer](https://github.com/idris-p/rush-hour/blob/main/src/rendering/mapRenderer.ts): `src/rendering/mapRenderer.ts`
- [Corridor layout](https://github.com/idris-p/rush-hour/blob/main/src/rendering/corridorLayout.ts): `src/rendering/corridorLayout.ts`
- [Line rendering](https://github.com/idris-p/rush-hour/blob/main/src/rendering/lineRenderer.ts): `src/rendering/lineRenderer.ts`
- [Station rendering](https://github.com/idris-p/rush-hour/blob/main/src/rendering/stationRenderer.ts): `src/rendering/stationRenderer.ts`

### Other components

- **Player**
- **Analytics service**
- **Speed insights**

## Connections

- Player → Application entry: starts and plays
- Application entry → Phase controller: changes phase
- Application entry → Run session: starts run
- Phase controller → Run session: advances rounds
- Run session → Seed and rounds: generates rounds
- Phase controller → Round state: creates round
- Application entry → Movement rules: attempts move
- Application entry → Tutorial rules: attempts tutorial move
- Application entry → Line selection: selects line
- Application entry → Map renderer: renders gameplay
- Application entry → HUD and results: updates interface
- HUD and results → Journey summary: summarizes journey
- HUD and results → Line selection: previews lines
- Player → Station search: searches stations
- Station search → Application entry: selects station
- Player → Gameplay input: chooses direction
- Gameplay input → Application entry: dispatches move
- Player → Map pan and zoom: pans or zooms
- Map pan and zoom → Map renderer: changes view
- Map pan and zoom → Pinch gesture: reads gesture
- Map renderer → Movement rules: reads station and direction
- Map renderer → Corridor layout: gets map geometry
- Map renderer → Line rendering: renders routes
- Map renderer → Station rendering: renders stations
- Network assembly → Network data: assembles
- Application entry → Network assembly: loads network
- Application entry → Network validation: validates network
- Run session → Network assembly: uses stations
- Analytics service → Application entry: reports usage
- Speed insights → Application entry: reports performance
