# jeanpruski/voidmarch architecture

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

- Interactive diagram: https://gitdiagram.com/jeanpruski/voidmarch
- Repository: https://github.com/jeanpruski/voidmarch

## Overview

VOIDMARCH is a persistent multiplayer hex strategy game. A player enters as a guest or account, establishes a realm, then issues map actions for movement, harvesting, construction, combat, diplomacy, trade, and exploration. The web client manages state and presents the map and domain panels; the server executes actions against the shared world, whose state is persisted in PostgreSQL. Configuration and game-rules packages provide shared balance data and mechanics. The README documents broad capabilities; some subsystem links are therefore documented or dashed where implementation excerpts do not show their wiring.

Main entry points: [`apps/server/src/engine.ts`](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/engine.ts) (Action engine), [`apps/web/src/App.tsx`](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/App.tsx) (Game interface), [`apps/web/src/store.ts`](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/store.ts) (Client state), [`apps/server/src/repository.ts`](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/repository.ts) (World persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Player client"]
  node_webapp["Game interface<br/>[App.tsx]"]
  node_map["Hex map<br/>[Map.tsx]"]
  node_panels["Domain panels<br/>[Panels.tsx]"]
  node_clientstate["Client state<br/>[store.ts]"]
end

subgraph group_server["World services"]
  node_auth["Accounts and guests<br/>[auth.ts]"]
  node_engine["Action engine<br/>[engine.ts]"]
  node_missions["Missions and expeditions<br/>[missions.ts]"]
  node_expeditions["Expedition offers<br/>[expeditions.ts]"]
  node_strategy["Realm strategy<br/>[strategy.ts]"]
  node_transport["Trade caravans<br/>[transports.ts]"]
  node_repository["World persistence<br/>[repository.ts]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_domain["Game mechanics"]
  node_rules["Game rules<br/>[index.ts]"]
  node_oceans["Ocean generation<br/>[oceans.ts]"]
  node_seaaccess["Sea access<br/>[sea-access.ts]"]
end

subgraph group_data["Shared data"]
  node_config["Game configuration<br/>[index.ts]"]
  node_campaignunits["Campaign unit data<br/>[campaign-units.ts]"]
  node_shared["World model<br/>[index.ts]"]
  node_protocol["Action protocol<br/>[index.ts]"]
end

node_player(("Player"))

node_player -->|"plays through"| node_webapp
node_webapp -->|"renders"| node_map
node_webapp -->|"renders"| node_panels
node_webapp -.->|"uses state"| node_clientstate
node_clientstate -.->|"sends actions"| node_engine
node_player -->|"creates account"| node_auth
node_auth -->|"uses"| node_repository
node_repository -->|"executes action"| node_engine
node_repository -->|"persists world"| node_postgres
node_engine -->|"uses mechanics"| node_rules
node_engine -->|"dispatches strategy"| node_strategy
node_engine -->|"dispatches missions"| node_missions
node_engine -->|"dispatches trade"| node_transport
node_missions -->|"uses offers"| node_expeditions
node_rules -->|"uses balance data"| node_config
node_oceans -->|"generates terrain"| node_rules
node_seaaccess -->|"checks coastline"| node_oceans
node_config -->|"exports data"| node_campaignunits
node_engine -.->|"mutates world"| node_shared
node_clientstate -->|"uses actions"| node_protocol

click node_webapp "https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/App.tsx"
click node_map "https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/Map.tsx"
click node_panels "https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/Panels.tsx"
click node_clientstate "https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/store.ts"
click node_auth "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/auth.ts"
click node_engine "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/engine.ts"
click node_missions "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/missions.ts"
click node_expeditions "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/expeditions.ts"
click node_strategy "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/strategy.ts"
click node_transport "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/transports.ts"
click node_repository "https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/repository.ts"
click node_rules "https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/index.ts"
click node_oceans "https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/oceans.ts"
click node_seaaccess "https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/sea-access.ts"
click node_config "https://github.com/jeanpruski/voidmarch/blob/master/packages/config/src/index.ts"
click node_campaignunits "https://github.com/jeanpruski/voidmarch/blob/master/packages/config/src/campaign-units.ts"
click node_shared "https://github.com/jeanpruski/voidmarch/blob/master/packages/shared/src/index.ts"
click node_protocol "https://github.com/jeanpruski/voidmarch/blob/master/packages/protocol/src/index.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_webapp,node_map,node_panels,node_clientstate toneBlue
class node_auth,node_engine,node_missions,node_expeditions,node_strategy,node_transport,node_repository,node_postgres toneAmber
class node_rules,node_oceans,node_seaaccess toneMint
class node_config,node_campaignunits,node_shared,node_protocol toneRose
class node_player toneIndigo
```

## Components

### Player client

- [Game interface](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Hex map](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/Map.tsx): `apps/web/src/Map.tsx`
- [Domain panels](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/Panels.tsx): `apps/web/src/Panels.tsx`
- [Client state](https://github.com/jeanpruski/voidmarch/blob/master/apps/web/src/store.ts): `apps/web/src/store.ts`

### World services

- [Accounts and guests](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/auth.ts): `apps/server/src/auth.ts`
- [Action engine](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/engine.ts): `apps/server/src/engine.ts`
- [Missions and expeditions](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/missions.ts): `apps/server/src/missions.ts`
- [Expedition offers](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/expeditions.ts): `apps/server/src/expeditions.ts`
- [Realm strategy](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/strategy.ts): `apps/server/src/strategy.ts`
- [Trade caravans](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/transports.ts): `apps/server/src/transports.ts`
- [World persistence](https://github.com/jeanpruski/voidmarch/blob/master/apps/server/src/repository.ts): `apps/server/src/repository.ts`
- **PostgreSQL**

### Game mechanics

- [Game rules](https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/index.ts): `packages/game-rules/src/index.ts`
- [Ocean generation](https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/oceans.ts): `packages/game-rules/src/oceans.ts`
- [Sea access](https://github.com/jeanpruski/voidmarch/blob/master/packages/game-rules/src/sea-access.ts): `packages/game-rules/src/sea-access.ts`

### Shared data

- [Game configuration](https://github.com/jeanpruski/voidmarch/blob/master/packages/config/src/index.ts): `packages/config/src/index.ts`
- [Campaign unit data](https://github.com/jeanpruski/voidmarch/blob/master/packages/config/src/campaign-units.ts): `packages/config/src/campaign-units.ts`
- [World model](https://github.com/jeanpruski/voidmarch/blob/master/packages/shared/src/index.ts): `packages/shared/src/index.ts`
- [Action protocol](https://github.com/jeanpruski/voidmarch/blob/master/packages/protocol/src/index.ts): `packages/protocol/src/index.ts`

### Other components

- **Player**

## Connections

- Player → Game interface: plays through (evidence: `README.md`)
- Game interface → Hex map: renders (evidence: `apps/web/src/App.tsx`)
- Game interface → Domain panels: renders (evidence: `apps/web/src/App.tsx`)
- Game interface → Client state: uses state (evidence: `apps/web/src/App.tsx`)
- Client state → Action engine: sends actions
- Player → Accounts and guests: creates account (evidence: `README.md`)
- Accounts and guests → World persistence: uses (evidence: `apps/server/src/auth.ts`)
- World persistence → Action engine: executes action (evidence: `apps/server/src/repository.ts`)
- World persistence → PostgreSQL: persists world (evidence: `apps/server/src/repository.ts`)
- Action engine → Game rules: uses mechanics (evidence: `apps/server/src/engine.ts`)
- Action engine → Realm strategy: dispatches strategy (evidence: `apps/server/src/engine.ts`)
- Action engine → Missions and expeditions: dispatches missions (evidence: `apps/server/src/engine.ts`)
- Action engine → Trade caravans: dispatches trade (evidence: `apps/server/src/engine.ts`)
- Missions and expeditions → Expedition offers: uses offers (evidence: `apps/server/src/missions.ts`)
- Game rules → Game configuration: uses balance data (evidence: `packages/game-rules/src/index.ts`)
- Ocean generation → Game rules: generates terrain (evidence: `packages/game-rules/src/oceans.ts`)
- Sea access → Ocean generation: checks coastline (evidence: `packages/game-rules/src/sea-access.ts`)
- Game configuration → Campaign unit data: exports data (evidence: `packages/config/src/index.ts`)
- Action engine → World model: mutates world
- Client state → Action protocol: uses actions (evidence: `apps/web/src/store.ts`)
