Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture

Nine diagrams of the Pacenotes system: two entity–relationship models, UML activity diagrams for the installer and for the server, and SysML block, internal-block and requirement diagrams.

They were drawn by reading the code, not a design document: every box, column and status can be traced to a file named in the code map. Where a rule is documented in a CLAUDE.md, the diagram follows it, because a diagram that quietly disagrees with the rules is worse than no diagram.

DiagramNotationAnswersChapter
ER-1ERWhat the server stores, and how a key binds to a package directoryThe data model
ER-2ERWhat one run leaves inside <game folder>\.pacenotesThe data model
A1UML activityOne run end to end: nine pages, three routesOne installer run
A2UML activityWhat scene 6 does inside the engineOne installer run
S1UML activityHow one download request is answered, and where access is decidedThe server
S2UML activityPublishing: what manifest gen refuses to doThe server
SY-1SysML BDDThe blocks, their parts and their constraintsThe system in SysML
SY-2SysML IBDDeployment: parts, connections, protocols, storesThe system in SysML
SY-3SysML requirementsEach requirement, what satisfies it, what verifies itThe system in SysML

How they are made

Each diagram is a D2 source in docs/diagrams/, rendered to SVG by docs/build.sh every time the site is built, locally and in CI. Each source names its own layout engine in its d2-config vars: dagre for the activity flows, ELK where tables and containers need it. They render light only, because an image in a page follows the system’s colour scheme rather than the book’s theme. The SVGs are never committed: what is published is always drawn from the sources in the same commit. A source that does not parse fails the build rather than publishing a stale picture.

Change a diagram when the structure it shows changes — a new endpoint, module, page or stored field. Nothing regenerates the content by itself.

Notation

ElementMeans
Solid arrowcontrol flow, or an association
Dashed arrowa logical reference with no database constraint, or a compile-time dependency — the label says which
Filled diamondcomposition: the whole owns the part
Diamond shapea decision, with the guards on its outgoing edges
Ovala final answer: an HTTP status, or a refusal that writes nothing
Filled dotwhere an activity starts or ends
Dashed box titled “for each …”an expansion region: the actions inside repeat
Colourwho acts (wizard, worker, engine, ledger, server, store); each diagram’s caption names them

Code map

ConcernFiles
Protocol typesshared/src/
Wizard, pages, routesinstaller/src/wizard/, installer/res/installer.rc
Tree and choice modelsinstaller/src/tree/, installer/src/choices/
Worker thread and its messagesinstaller/src/worker/
Plan, pre-flight, executeinstaller/src/engine/
Restore pointsinstaller/src/restore/, installer/src/ledger/
Cacheinstaller/src/cache/, installer/src/api/
HTTPinstaller/src/http/ (WinHTTP)
Game detection, the running gameinstaller/src/gamedir/, installer/src/game_process.rs
Install schemaschemas/rbr.toml, installer/src/schema.rs, installer/build/schema_table.rs
The game’s own stepinstaller/src/install/
Router and handlersserver/src/routes.rs
Access decisionserver/src/auth/
Catalogue and publishingserver/src/store/
Conflict reportsserver/src/reports/
Credential CLIserver/src/admin.rs
Auth schemaserver/migrations/0001_init.sql, server/src/db.rs
Deploymentdeploy/

What the diagrams deliberately leave out

  • Sequence diagrams. The interesting ordering is inside one thread (the engine) or one request (the access decision); an activity diagram shows both without inventing lifelines.
  • A state machine. The wizard is a property sheet with three routes, not a stateful protocol. The ledger’s installing → installed is the only real state, and it is on ER-2.
  • A class diagram. shared/ is a handful of structs; ER-1 shows them with the keys that matter, and the API reference shows the rest.
  • Topology beyond SY-2. The Quadlet, the container and the Caddy block are one host; a second picture would repeat SY-2 with hostnames.