The Last Train Home
High-contrast wayfinding
The operational feed has its own account. Passenger regions maintain local projections and broadcasters. Reconnection includes authentication and a snapshot, not just a new socket.
Authored brief · fictional system
Design a fictional multi-region passenger-information service with an authorized cross-account feed, ordered ingestion, version-aware primary projection, asynchronous regional replica, independent regional broadcasters/WebSocket APIs, station identity and explicit snapshot recovery. Never imply that an existing WebSocket moves between regions or that this controls trains.
Design a fictional multi-region passenger-information service with an authorized cross-account feed, ordered ingestion, version-aware primary projection, asynchronous regional replica, independent regional broadcasters/WebSocket APIs, station identity and explicit snapshot recovery. Never imply that an existing WebSocket moves between regions or that this controls trains.
2 · Diagram
What must a station do after losing its region and every open connection?
Whole diagram fitted. For larger labels, turn off “Fit whole diagram” and pan, or open the full-size SVG.
Mermaid source
Download .mmdSemantic content and gallery-only boundary/flow annotations stay in this file. The drawing treatment is applied after layout.
architecture-beta
%% Fictional passenger information, never train control. Regions serve local projections of an authoritative timetable feed.
%% @boundary operations account
%% @boundary sourceRegion region
%% @boundary public account
%% @boundary primary region
%% @boundary secondary region
group operations(cloud)[Account: Rail operations]
group sourceRegion(cloud)[Region: Feed authority] in operations
group public(cloud)[Account: Passenger service]
group primary(cloud)[Region: Primary service] in public
group secondary(cloud)[Region: Regional replica] in public
service source(aws:eventbridge)[Authorized departure feed] in sourceRegion
service bus(aws:eventbridge)[Passenger event ingress] in primary
service stream(aws:kinesis)[Ordered departure stream] in primary
service reducer(aws:lambda)[Versioned state reducer] in primary
service state(aws:dynamodb)[Current departures] in primary
service broadcast(aws:lambda)[Primary broadcaster] in primary
service socket(aws:api-gateway)[Primary WebSocket API] in primary
service snapshot(aws:api-gateway)[Snapshot HTTP API] in primary
service replica(aws:dynamodb)[Regional departure replica] in secondary
service broadcastB(aws:lambda)[Regional broadcaster] in secondary
service socketB(aws:api-gateway)[Regional WebSocket API] in secondary
service auth(aws:cognito)[Station identity] in primary
service boards(lucide:monitor)[Authenticated displays]
%% @edge source bus event | Cross-account bus policy and forwarding role allow only the operational event source.
source:R --> L:bus
%% @edge bus stream event | Partition by train or station according to ordering requirements; fan-in is not a global event order.
bus:B --> T:stream
%% @edge stream reducer event | Consumer deduplicates and rejects stale authoritative versions.
stream:R --> L:reducer
%% @edge reducer state request | Primary region is the only projection writer; records include source version and update time.
reducer:R --> L:state
%% @edge state broadcast event | DynamoDB Streams invokes the broadcaster; retries may deliver duplicate changes.
state:R --> L:broadcast
%% @edge broadcast socket request | Calls management API for registered connection IDs; regional connection store is omitted.
broadcast:R --> L:socket
%% @edge socket boards event | Pushes updates over an authenticated connection; disconnected displays can miss deltas.
socket:B --> L:boards
%% @edge state replica replication | Asynchronous global-table replication; the regional replica is not the timetable authority.
state:B --> L:replica
%% @edge replica broadcastB event | Regional stream drives local notifications after replicated writes arrive.
replica:R --> L:broadcastB
%% @edge broadcastB socketB request | Uses the local connection registry and local API management endpoint.
broadcastB:R --> L:socketB
%% @edge socketB boards recovery | After regional outage the client explicitly reconnects, reauthenticates and fetches a snapshot; existing sockets do not move.
socketB:R --> B:boards
%% @edge auth boards identity | Station identity tokens must be validated at connection and snapshot endpoints.
auth:R --> T:boards
%% @edge boards snapshot recovery | Client fetches full current state and a version watermark on connect/reconnect.
boards:B --> T:snapshot
%% @edge snapshot state request | Snapshot backend reads current state; an API integration Lambda and secondary snapshot endpoint are omitted.
snapshot:R --> T:state
Reproduce this collection from the Beautiflow repository:
bun scripts/build-boring-diagrams.tsMeasured evidence
Full evidence JSON- Native geometry
- 0 findings across 8 measured checks
- Styled render integrity
- 0 element, plain-label, ID or reference findings
- Authored annotations
- 5 boundaries · 14 relationship meanings
- AWS configuration
- Not validated
These checks do not establish visual quality, every decorative mark, browser glyph ink, edge-label boxes or deployed AWS correctness. Architecture has guarded transforms, not automatic polish.
Source SHA-256
6b68974ffb83ef6c7cf481f77b099cc300a417a3e91058db40b37488fbf65d90Read all 14 relationships
Line patterns distinguish requests, credentials, events, replication, configuration/control and recovery. Hover a styled connector for its meaning. Native layout preserves routes but does not include these gallery annotations.
| From | To | Kind | Meaning |
|---|---|---|---|
| Authorized departure feed | Passenger event ingress | event | Cross-account bus policy and forwarding role allow only the operational event source. |
| Passenger event ingress | Ordered departure stream | event | Partition by train or station according to ordering requirements; fan-in is not a global event order. |
| Ordered departure stream | Versioned state reducer | event | Consumer deduplicates and rejects stale authoritative versions. |
| Versioned state reducer | Current departures | request | Primary region is the only projection writer; records include source version and update time. |
| Current departures | Primary broadcaster | event | DynamoDB Streams invokes the broadcaster; retries may deliver duplicate changes. |
| Primary broadcaster | Primary WebSocket API | request | Calls management API for registered connection IDs; regional connection store is omitted. |
| Primary WebSocket API | Authenticated displays | event | Pushes updates over an authenticated connection; disconnected displays can miss deltas. |
| Current departures | Regional departure replica | replication | Asynchronous global-table replication; the regional replica is not the timetable authority. |
| Regional departure replica | Regional broadcaster | event | Regional stream drives local notifications after replicated writes arrive. |
| Regional broadcaster | Regional WebSocket API | request | Uses the local connection registry and local API management endpoint. |
| Regional WebSocket API | Authenticated displays | recovery | After regional outage the client explicitly reconnects, reauthenticates and fetches a snapshot; existing sockets do not move. |
| Station identity | Authenticated displays | identity | Station identity tokens must be validated at connection and snapshot endpoints. |
| Authenticated displays | Snapshot HTTP API | recovery | Client fetches full current state and a version watermark on connect/reconnect. |
| Snapshot HTTP API | Current departures | request | Snapshot backend reads current state; an API integration Lambda and secondary snapshot endpoint are omitted. |
Architecture assumptions & omissions
- The operational event version is authoritative. The primary reducer rejects stale versions and duplicate events. A replicated passenger projection is not the source timetable and must not become a competing authoritative writer.
- DynamoDB replication is asynchronous. Regional broadcasters consume their local streams and use local connection registries. The assumed compatible global-table/stream configuration and regional resource policies require deployment validation.
- Stations reauthenticate, fetch current state plus a version watermark, then reconcile deltas after reconnect. A WebSocket CONNECT authorizer and snapshot backend enforce identity; neither is fully expanded.
- The secondary snapshot endpoint, regional connection registries, routing/health checks and source-feed disaster recovery are omitted. The shown primary snapshot path alone is not a complete regional failover implementation. Passenger information only: no signalling or train control.