# sandromaglione/inkline-town architecture

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

- Interactive diagram: https://gitdiagram.com/sandromaglione/inkline-town
- Repository: https://github.com/sandromaglione/inkline-town

## Overview

Inkline Town is a browser-based, term-by-term town-building simulation. The player creates a charter, lays out and manages a town, and receives a term verdict and chronicle. The browser app composes the DOM UI, simulation, and 3D renderer; scheduled systems advance the town, while edits from the player are applied during simulation steps. The README documents production, logistics, services, hazards, upgrades, trade, and rank progression. Some subsystem links are based on documented capabilities rather than sampled implementation; those are cited to the README.

Main entry points: [`src/app/browser.ts`](https://github.com/sandromaglione/inkline-town/blob/main/src/app/browser.ts) (Browser App), [`src/game/schedule.ts`](https://github.com/sandromaglione/inkline-town/blob/main/src/game/schedule.ts) (Step Scheduler), [`src/ui/dom/index.ts`](https://github.com/sandromaglione/inkline-town/blob/main/src/ui/dom/index.ts) (DOM UI), [`src/render/pixi3d/scene.ts`](https://github.com/sandromaglione/inkline-town/blob/main/src/render/pixi3d/scene.ts) (3D Scene)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Player Experience"]
  node_browser["Browser App<br/>[browser.ts]"]
  node_ui["DOM UI<br/>[index.ts]"]
  node_verdict["Term Verdict"]
end

subgraph group_simulation["Town Simulation"]
  node_edits["Player Edits<br/>[edits.ts]"]
  node_schedule["Step Scheduler<br/>[schedule.ts]"]
  node_term["Term and Goals"]
  node_work["Production"]
  node_logistics["Goods Logistics"]
  node_town["Households and Town"]
  node_hazards["Risks and Decay"]
  node_walkers["Walkers and Services"]
end

subgraph group_world["World and Content"]
  node_content["Game Content<br/>[kind.ts]"]
  node_schema["Town State<br/>[schema.ts]"]
  node_worldmap["Land and Grid<br/>[grid.ts]"]
end

subgraph group_presentation["View and Rendering"]
  node_contracts["View Contracts<br/>[contracts.ts]"]
  node_views["View Systems<br/>[preview.ts]"]
  node_scene["3D Scene<br/>[scene.ts]"]
  node_art["Ink Artwork<br/>[art.ts]"]
end

subgraph group_platform["Persistence and Sharing"]
  node_save["Local Saves<br/>[save.ts]"]
  node_share["Share Client<br/>[client.ts]"]
  node_shareformat["Share Format<br/>[format.ts]"]
end

node_player(("Mayor"))

node_player -->|"plays in"| node_browser
node_browser -->|"composes"| node_ui
node_browser -->|"runs"| node_schedule
node_browser -->|"connects renderer"| node_scene
node_browser -->|"uses persistence"| node_save
node_browser -->|"uses sharing"| node_share
node_ui -->|"sends edits"| node_edits
node_ui -->|"reads view state"| node_contracts
node_schedule -->|"dispatches"| node_term
node_schedule -->|"dispatches"| node_work
node_schedule -->|"dispatches"| node_logistics
node_schedule -->|"dispatches"| node_town
node_schedule -->|"dispatches"| node_hazards
node_schedule -->|"dispatches"| node_walkers
node_edits -->|"changes state"| node_schema
node_content -->|"defines components for"| node_schema
node_worldmap -->|"provides grid functions"| node_schema
node_browser -->|"loads content"| node_content
node_browser -->|"loads edit logic"| node_edits
node_views -->|"produces view data"| node_contracts
node_scene -->|"renders scene view"| node_contracts
node_scene -->|"uses artwork"| node_art
node_save -.->|"restores town"| node_browser
node_share -->|"formats share data"| node_shareformat
node_term -.->|"judges term"| node_verdict
node_work -.->|"makes goods for"| node_logistics
node_walkers -.->|"serves households"| node_town
node_hazards -.->|"can end term"| node_verdict
node_ui -->|"shows controls"| node_player

click node_browser "https://github.com/sandromaglione/inkline-town/blob/main/src/app/browser.ts"
click node_ui "https://github.com/sandromaglione/inkline-town/blob/main/src/ui/dom/index.ts"
click node_contracts "https://github.com/sandromaglione/inkline-town/blob/main/src/view/contracts.ts"
click node_edits "https://github.com/sandromaglione/inkline-town/blob/main/src/game/edits.ts"
click node_schedule "https://github.com/sandromaglione/inkline-town/blob/main/src/game/schedule.ts"
click node_term "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/term"
click node_work "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/work"
click node_logistics "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/logistics"
click node_town "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/town"
click node_hazards "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/hazards"
click node_walkers "https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/walkers"
click node_content "https://github.com/sandromaglione/inkline-town/blob/main/src/game/content/kinds/kind.ts"
click node_schema "https://github.com/sandromaglione/inkline-town/blob/main/src/game/schema.ts"
click node_worldmap "https://github.com/sandromaglione/inkline-town/blob/main/src/game/world/grid.ts"
click node_views "https://github.com/sandromaglione/inkline-town/blob/main/src/view/preview.ts"
click node_scene "https://github.com/sandromaglione/inkline-town/blob/main/src/render/pixi3d/scene.ts"
click node_art "https://github.com/sandromaglione/inkline-town/blob/main/src/render/art.ts"
click node_save "https://github.com/sandromaglione/inkline-town/blob/main/src/platform/save.ts"
click node_share "https://github.com/sandromaglione/inkline-town/blob/main/src/platform/share/client.ts"
click node_shareformat "https://github.com/sandromaglione/inkline-town/blob/main/src/platform/share/format.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_browser,node_ui,node_verdict toneBlue
class node_edits,node_schedule,node_term,node_work,node_logistics,node_town,node_hazards,node_walkers toneAmber
class node_content,node_schema,node_worldmap toneMint
class node_contracts,node_views,node_scene,node_art toneRose
class node_save,node_share,node_shareformat,node_player toneIndigo
```

## Components

### Player Experience

- [Browser App](https://github.com/sandromaglione/inkline-town/blob/main/src/app/browser.ts): `src/app/browser.ts`
- [DOM UI](https://github.com/sandromaglione/inkline-town/blob/main/src/ui/dom/index.ts): `src/ui/dom/index.ts`
- **Term Verdict**

### Town Simulation

- [Player Edits](https://github.com/sandromaglione/inkline-town/blob/main/src/game/edits.ts): `src/game/edits.ts`
- [Step Scheduler](https://github.com/sandromaglione/inkline-town/blob/main/src/game/schedule.ts): `src/game/schedule.ts`
- [Term and Goals](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/term): `src/game/systems/term`
- [Production](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/work): `src/game/systems/work`
- [Goods Logistics](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/logistics): `src/game/systems/logistics`
- [Households and Town](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/town): `src/game/systems/town`
- [Risks and Decay](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/hazards): `src/game/systems/hazards`
- [Walkers and Services](https://github.com/sandromaglione/inkline-town/tree/main/src/game/systems/walkers): `src/game/systems/walkers`

### World and Content

- [Game Content](https://github.com/sandromaglione/inkline-town/blob/main/src/game/content/kinds/kind.ts): `src/game/content/kinds/kind.ts`
- [Town State](https://github.com/sandromaglione/inkline-town/blob/main/src/game/schema.ts): `src/game/schema.ts`
- [Land and Grid](https://github.com/sandromaglione/inkline-town/blob/main/src/game/world/grid.ts): `src/game/world/grid.ts`

### View and Rendering

- [View Contracts](https://github.com/sandromaglione/inkline-town/blob/main/src/view/contracts.ts): `src/view/contracts.ts`
- [View Systems](https://github.com/sandromaglione/inkline-town/blob/main/src/view/preview.ts): `src/view/preview.ts`
- [3D Scene](https://github.com/sandromaglione/inkline-town/blob/main/src/render/pixi3d/scene.ts): `src/render/pixi3d/scene.ts`
- [Ink Artwork](https://github.com/sandromaglione/inkline-town/blob/main/src/render/art.ts): `src/render/art.ts`

### Persistence and Sharing

- [Local Saves](https://github.com/sandromaglione/inkline-town/blob/main/src/platform/save.ts): `src/platform/save.ts`
- [Share Client](https://github.com/sandromaglione/inkline-town/blob/main/src/platform/share/client.ts): `src/platform/share/client.ts`
- [Share Format](https://github.com/sandromaglione/inkline-town/blob/main/src/platform/share/format.ts): `src/platform/share/format.ts`

### Other components

- **Mayor**

## Connections

- Mayor → Browser App: plays in (evidence: `README.md`)
- Browser App → DOM UI: composes (evidence: `src/app/browser.ts`)
- Browser App → Step Scheduler: runs (evidence: `src/app/browser.ts`)
- Browser App → 3D Scene: connects renderer (evidence: `src/app/browser.ts`)
- Browser App → Local Saves: uses persistence (evidence: `src/app/browser.ts`)
- Browser App → Share Client: uses sharing (evidence: `src/app/browser.ts`)
- DOM UI → Player Edits: sends edits (evidence: `src/ui/dom/index.ts`)
- DOM UI → View Contracts: reads view state (evidence: `src/ui/dom/index.ts`)
- Step Scheduler → Term and Goals: dispatches (evidence: `src/game/schedule.ts`)
- Step Scheduler → Production: dispatches (evidence: `src/game/schedule.ts`)
- Step Scheduler → Goods Logistics: dispatches (evidence: `src/game/schedule.ts`)
- Step Scheduler → Households and Town: dispatches (evidence: `src/game/schedule.ts`)
- Step Scheduler → Risks and Decay: dispatches (evidence: `src/game/schedule.ts`)
- Step Scheduler → Walkers and Services: dispatches (evidence: `src/game/schedule.ts`)
- Player Edits → Town State: changes state (evidence: `src/game/edits.ts`)
- Game Content → Town State: defines components for (evidence: `src/game/schema.ts`)
- Land and Grid → Town State: provides grid functions (evidence: `src/game/world/grid.ts`)
- Browser App → Game Content: loads content (evidence: `src/app/browser.ts`)
- Browser App → Player Edits: loads edit logic (evidence: `src/app/browser.ts`)
- View Systems → View Contracts: produces view data (evidence: `src/view/contracts.ts`)
- 3D Scene → View Contracts: renders scene view (evidence: `src/render/pixi3d/scene.ts`)
- 3D Scene → Ink Artwork: uses artwork (evidence: `src/render/pixi3d/scene.ts`)
- Local Saves → Browser App: restores town (evidence: `src/app/browser.ts`)
- Share Client → Share Format: formats share data (evidence: `src/platform/share/client.ts`)
- Term and Goals → Term Verdict: judges term (evidence: `README.md`)
- Production → Goods Logistics: makes goods for (evidence: `README.md`)
- Walkers and Services → Households and Town: serves households (evidence: `README.md`)
- Risks and Decay → Term Verdict: can end term (evidence: `README.md`)
- DOM UI → Mayor: shows controls (evidence: `src/ui/dom/index.ts`)
