---
config:
layout: elk
theme: base
themeVariables:
background: "#ffffff"
primaryColor: "#ffffff"
primaryBorderColor: "#1f2937"
primaryTextColor: "#0b1220"
lineColor: "#1f2937"
textColor: "#0b1220"
edgeLabelBackground: "#ffffff"
fontSize: "20px"
clusterBkg: "#fafafa"
clusterBorder: "#9ca3af"
flowchart:
htmlLabels: true
curve: basis
nodeSpacing: 60
rankSpacing: 90
---
flowchart LR
%% =========================================================
%% Left bookend — browser-side Application
%% =========================================================
subgraph LBE["Application"]
direction TB
UI["UI
containers · components
forms · dialogs"]
Hooks["hooks/
useWebClient · useAutoLogin
useSettings · useKnownHosts"]
Store[("@app/store
server · rooms · game
actions · common")]
DTOs["dexie DTOs
Card · Host · Set
Setting · Token"]
IDB[("IndexedDB")]
end
%% =========================================================
%% Racetrack — three lanes: outbound / transport / inbound
%% =========================================================
subgraph RACE[" "]
direction TB
subgraph TOP["Outbound lane"]
direction LR
Req["src/api/request/
Authentication · Session · Rooms
Game · Admin · Moderator"]
Cmds["commands/
session · room · game
admin · moderator"]
end
subgraph MID["Transport"]
direction LR
Provider["WebClientProvider"]
WC[["WebClient
singleton · request · response"]]
Svc["services/
ProtobufService · WebSocketService
KeepAliveService · command-options"]
end
subgraph BOT["Inbound lane"]
direction LR
Evts["events/
session · room · game"]
Res["src/api/response/
Session · Room · Game
Admin · Moderator"]
end
end
%% =========================================================
%% Right bookend — Servatrice
%% =========================================================
Srv[("Servatrice")]
%% =========================================================
%% Protocol satellite — cross-cutting types
%% =========================================================
subgraph PROTO["Protocol (cross-cutting)"]
direction LR
Types["src/types/
Data · Enriched · App"]
Gen["src/generated/proto/
@bufbuild/protobuf"]
end
%% =========================================================
%% UI-side wiring
%% =========================================================
UI --> Hooks
Hooks -- "useWebClient()" --> Provider
Provider --> WC
UI -- "selectors (read)" --> Store
Hooks --> DTOs
DTOs <--> IDB
%% =========================================================
%% Outbound — request goes up through the top lane to Srv
%% =========================================================
WC --> Req
Req --> Cmds
Cmds --> Svc
Svc -- "frames" --> Srv
%% =========================================================
%% Inbound — Srv comes back through services, splits to
%% cmdId response (direct) and event-registry dispatch
%% =========================================================
Srv -- "frames" --> Svc
Svc --> Evts
Svc -- "response by cmdId" --> Res
Evts --> Res
Res -- "dispatch" --> Store
%% =========================================================
%% Protocol edges — dashed, cross-cutting
%% =========================================================
Req -.-> Types
Res -.-> Types
Cmds -.-> Types
Evts -.-> Types
Types --> Gen
%% =========================================================
%% Palette — four roles
%% =========================================================
classDef app fill:#dbeafe,stroke:#1f2937,stroke-width:1.5px,color:#0b1220
classDef transport fill:#ede9fe,stroke:#1f2937,stroke-width:1.5px,color:#0b1220
classDef store fill:#fde68a,stroke:#1f2937,stroke-width:1.5px,color:#0b1220
classDef external fill:#e5e7eb,stroke:#1f2937,stroke-width:1.5px,color:#0b1220
class UI,Hooks,DTOs,Provider,WC app
class Req,Cmds,Svc,Evts,Res transport
class Store,Types,Gen store
class Srv,IDB external