# jean1dev/w2pp-openwyd architecture

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

- Interactive diagram: https://gitdiagram.com/jean1dev/w2pp-openwyd
- Repository: https://github.com/jean1dev/w2pp-openwyd

## Overview

w2pp-OpenWYD is a Go rewrite of the WYD game server, compatible with the unmodified 7662 client. The main flow is client traffic into tmServer, where protocol handling and game logic operate on an in-memory world; persistence and billing are separate gRPC services. A web API serves account and platform features, including moderator tools for game content. The graph emphasizes documented service boundaries and sampled wiring; many individual gameplay handlers and web capabilities are represented by their subsystem directories because their implementations were not excerpted.

Main entry points: [`tmserver/cmd/tmserver/main.go`](https://github.com/jean1dev/w2pp-openwyd/blob/main/tmserver/cmd/tmserver/main.go) (tmServer entry), [`webserver/cmd/webserver/main.go`](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/cmd/webserver/main.go) (webServer entry), [`internal/store/store_live.go`](https://github.com/jean1dev/w2pp-openwyd/blob/main/internal/store/store_live.go) (PostgreSQL store), [`dbserver/cmd/dbserver/main.go`](https://github.com/jean1dev/w2pp-openwyd/blob/main/dbserver/cmd/dbserver/main.go) (dbServer entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_tm_entry["tmServer entry<br/>[main.go]"]
  node_protocol["Legacy protocol"]
  node_handlers["Gameplay handlers"]
  node_world["World state"]
  node_game_content["Game content"]
  node_combat["Combat and progression"]
end

subgraph group_persistence["Persistence and billing"]
  node_dbclient["DB client adapter<br/>[client.go]"]
  node_db_entry["dbServer entry<br/>[main.go]"]
  node_db_grpc["Persistence API<br/>[server.go]"]
  node_store[("PostgreSQL store<br/>[store_live.go]")]
  node_bin_entry["binServer entry<br/>[main.go]"]
  node_billing["Billing policy<br/>[billing.go]"]
  node_bin_grpc["Billing API<br/>[server.go]"]
end

subgraph group_web["Web platform"]
  node_web_entry["webServer entry<br/>[main.go]"]
  node_web_grpc["Web gRPC API<br/>[server.go]"]
  node_accounts["Account service<br/>[service.go]"]
  node_admin["Content administration<br/>[service.go]"]
  node_mob_admin["Mob template admin<br/>[service.go]"]
  node_web_capabilities["Web services"]
end

subgraph group_shared["Shared domain"]
  node_domain["Shared domain<br/>[domain.go]"]
end

node_game_client(("WYD client"))
node_web_platform(("Web platform BFF"))

node_game_client -->|"connects"| node_tm_entry
node_tm_entry -->|"uses protocol"| node_protocol
node_tm_entry -->|"starts world"| node_world
node_tm_entry -->|"wires handlers"| node_handlers
node_tm_entry -->|"loads content"| node_game_content
node_tm_entry -->|"configures adapter"| node_dbclient
node_handlers -.->|"updates state"| node_world
node_handlers -.->|"uses rules"| node_combat
node_world -->|"persists through"| node_dbclient
node_db_entry -->|"registers API"| node_db_grpc
node_db_grpc -->|"reads and writes"| node_store
node_db_entry -->|"opens store"| node_store
node_db_entry -->|"serves gRPC"| node_dbclient
node_db_entry -->|"uses PostgreSQL"| node_store
node_tm_entry -.->|"checks billing"| node_bin_grpc
node_bin_entry -->|"registers API"| node_bin_grpc
node_bin_grpc -->|"checks policy"| node_billing
node_web_platform -->|"calls gRPC"| node_web_entry
node_web_entry -->|"registers services"| node_web_grpc
node_web_grpc -->|"delegates account"| node_accounts
node_web_entry -->|"wires admin"| node_admin
node_web_entry -->|"wires templates"| node_mob_admin
node_web_entry -->|"registers services"| node_web_capabilities
node_admin -->|"stores definitions"| node_store
node_accounts -->|"uses account data"| node_store

click node_tm_entry "https://github.com/jean1dev/w2pp-openwyd/blob/main/tmserver/cmd/tmserver/main.go"
click node_protocol "https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/protocol"
click node_handlers "https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/handler"
click node_world "https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/world"
click node_game_content "https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/content"
click node_combat "https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/combat"
click node_dbclient "https://github.com/jean1dev/w2pp-openwyd/blob/main/tmserver/internal/dbclient/client.go"
click node_db_entry "https://github.com/jean1dev/w2pp-openwyd/blob/main/dbserver/cmd/dbserver/main.go"
click node_db_grpc "https://github.com/jean1dev/w2pp-openwyd/blob/main/dbserver/internal/grpcsrv/server.go"
click node_store "https://github.com/jean1dev/w2pp-openwyd/blob/main/internal/store/store_live.go"
click node_bin_entry "https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/cmd/binserver/main.go"
click node_billing "https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/internal/billing/billing.go"
click node_bin_grpc "https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/internal/grpcsrv/server.go"
click node_web_entry "https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/cmd/webserver/main.go"
click node_web_grpc "https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/grpcsrv/server.go"
click node_accounts "https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/account/service.go"
click node_admin "https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/npcadmin/service.go"
click node_mob_admin "https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/mobtemplateadmin/service.go"
click node_web_capabilities "https://github.com/jean1dev/w2pp-openwyd/tree/main/webserver/internal"
click node_domain "https://github.com/jean1dev/w2pp-openwyd/blob/main/internal/domain/domain.go"

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_tm_entry,node_protocol,node_handlers,node_world,node_game_content,node_combat,node_game_client toneBlue
class node_dbclient,node_db_entry,node_db_grpc,node_store,node_bin_entry,node_billing,node_bin_grpc toneAmber
class node_web_entry,node_web_grpc,node_accounts,node_admin,node_mob_admin,node_web_capabilities toneMint
class node_domain toneRose
class node_web_platform toneIndigo
```

## Components

### Game runtime

- [tmServer entry](https://github.com/jean1dev/w2pp-openwyd/blob/main/tmserver/cmd/tmserver/main.go): `tmserver/cmd/tmserver/main.go`
- [Legacy protocol](https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/protocol): `tmserver/internal/protocol`
- [Gameplay handlers](https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/handler): `tmserver/internal/handler`
- [World state](https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/world): `tmserver/internal/world`
- [Game content](https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/content): `tmserver/internal/content`
- [Combat and progression](https://github.com/jean1dev/w2pp-openwyd/tree/main/tmserver/internal/combat): `tmserver/internal/combat`

### Persistence and billing

- [DB client adapter](https://github.com/jean1dev/w2pp-openwyd/blob/main/tmserver/internal/dbclient/client.go): `tmserver/internal/dbclient/client.go`
- [dbServer entry](https://github.com/jean1dev/w2pp-openwyd/blob/main/dbserver/cmd/dbserver/main.go): `dbserver/cmd/dbserver/main.go`
- [Persistence API](https://github.com/jean1dev/w2pp-openwyd/blob/main/dbserver/internal/grpcsrv/server.go): `dbserver/internal/grpcsrv/server.go`
- [PostgreSQL store](https://github.com/jean1dev/w2pp-openwyd/blob/main/internal/store/store_live.go): `internal/store/store_live.go`
- [binServer entry](https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/cmd/binserver/main.go): `binserver/cmd/binserver/main.go`
- [Billing policy](https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/internal/billing/billing.go): `binserver/internal/billing/billing.go`
- [Billing API](https://github.com/jean1dev/w2pp-openwyd/blob/main/binserver/internal/grpcsrv/server.go): `binserver/internal/grpcsrv/server.go`

### Web platform

- [webServer entry](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/cmd/webserver/main.go): `webserver/cmd/webserver/main.go`
- [Web gRPC API](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/grpcsrv/server.go): `webserver/internal/grpcsrv/server.go`
- [Account service](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/account/service.go): `webserver/internal/account/service.go`
- [Content administration](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/npcadmin/service.go): `webserver/internal/npcadmin/service.go`
- [Mob template admin](https://github.com/jean1dev/w2pp-openwyd/blob/main/webserver/internal/mobtemplateadmin/service.go): `webserver/internal/mobtemplateadmin/service.go`
- [Web services](https://github.com/jean1dev/w2pp-openwyd/tree/main/webserver/internal): `webserver/internal`

### Shared domain

- [Shared domain](https://github.com/jean1dev/w2pp-openwyd/blob/main/internal/domain/domain.go): `internal/domain/domain.go`

### Other components

- **WYD client**
- **Web platform BFF**

## Connections

- WYD client → tmServer entry: connects
- tmServer entry → Legacy protocol: uses protocol (evidence: `tmserver/cmd/tmserver/main.go`)
- tmServer entry → World state: starts world (evidence: `tmserver/cmd/tmserver/main.go`)
- tmServer entry → Gameplay handlers: wires handlers (evidence: `tmserver/cmd/tmserver/main.go`)
- tmServer entry → Game content: loads content (evidence: `tmserver/cmd/tmserver/main.go`)
- tmServer entry → DB client adapter: configures adapter (evidence: `tmserver/cmd/tmserver/main.go`)
- Gameplay handlers → World state: updates state
- Gameplay handlers → Combat and progression: uses rules
- World state → DB client adapter: persists through (evidence: `tmserver/internal/dbclient/client.go`)
- dbServer entry → Persistence API: registers API (evidence: `dbserver/cmd/dbserver/main.go`)
- Persistence API → PostgreSQL store: reads and writes (evidence: `dbserver/internal/grpcsrv/server.go`)
- dbServer entry → PostgreSQL store: opens store (evidence: `dbserver/cmd/dbserver/main.go`)
- dbServer entry → DB client adapter: serves gRPC (evidence: `dbserver/cmd/dbserver/main.go`)
- dbServer entry → PostgreSQL store: uses PostgreSQL
- tmServer entry → Billing API: checks billing
- binServer entry → Billing API: registers API (evidence: `binserver/cmd/binserver/main.go`)
- Billing API → Billing policy: checks policy (evidence: `binserver/internal/grpcsrv/server.go`)
- Web platform BFF → webServer entry: calls gRPC
- webServer entry → Web gRPC API: registers services (evidence: `webserver/cmd/webserver/main.go`)
- Web gRPC API → Account service: delegates account (evidence: `webserver/internal/grpcsrv/server.go`)
- webServer entry → Content administration: wires admin (evidence: `webserver/cmd/webserver/main.go`)
- webServer entry → Mob template admin: wires templates (evidence: `webserver/cmd/webserver/main.go`)
- webServer entry → Web services: registers services (evidence: `webserver/cmd/webserver/main.go`)
- Content administration → PostgreSQL store: stores definitions (evidence: `webserver/internal/npcadmin/service.go`)
- Account service → PostgreSQL store: uses account data (evidence: `webserver/internal/account/service.go`)
