# ctrl-alt-transcend/smrow-game architecture

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

- Interactive diagram: https://gitdiagram.com/ctrl-alt-transcend/smrow-game
- Repository: https://github.com/ctrl-alt-transcend/smrow-game

## Overview

Goblin vs Wizards is a browser-based multiplayer Catan-like game with accounts, lobbies, social features, and player statistics. The main workflow is authentication, joining or creating a lobby, then playing through the game UI with backend game state and live updates; results feed statistics. The README specifically highlights creating and joining a lobby. The graph combines sampled call evidence with documented capabilities and tree-supported subsystems; unsampled frontend socket and game-state wiring is left unasserted.

Main entry points: [`app/backend/src/game/game.service.ts`](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.service.ts) (Game orchestration), [`app/backend/src/user/user.service.ts`](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/user/user.service.ts) (User and friendship service), [`app/backend/src/database/database.service.ts`](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/database/database.service.ts) (PostgreSQL database), [`app/backend/src/auth/auth.service.ts`](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/auth/auth.service.ts) (Authentication service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Application routes<br/>[routes.tsx]"]
  node_authui["Authentication UI<br/>[AuthProvider.tsx]"]
  node_homeshell["Home and lobby UI<br/>[GameLaunchMenu.tsx]"]
  node_gameui["Game interface<br/>[GameShell.tsx]"]
  node_statsui["Stats pages<br/>[StatsPage.tsx]"]
  node_http["HTTP API client<br/>[http.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_authapi["Authentication API<br/>[auth.controller.ts]"]
  node_authlogic["Authentication service<br/>[auth.service.ts]"]
  node_profiles["User and friendship service<br/>[user.service.ts]"]
end

subgraph group_play["Game and lobbies"]
  node_gamesapi["Game endpoints<br/>[game.controller.ts]"]
  node_gamelogic["Game orchestration<br/>[game.service.ts]"]
  node_gamestate["Game rules and state"]
  node_gameevents["Live game gateway<br/>[game.gateway.ts]"]
  node_lobbyapi["Lobby listing"]
  node_lobbylogic["Lobby service<br/>[games.service.ts]"]
end

subgraph group_community["Social"]
  node_socialui["Friends UI<br/>[FriendList.tsx]"]
  node_socialapi["Social endpoints<br/>[user.controller.ts]"]
  node_socialevents["Social gateway<br/>[social.gateway.ts]"]
end

subgraph group_records["Statistics and persistence"]
  node_statsapi["Stats endpoints"]
  node_statslogic["Stats service<br/>[stats.service.ts]"]
  node_database[("PostgreSQL database")]
end

node_player(("Player"))

node_player -->|"uses"| node_webapp
node_webapp -->|"renders"| node_authui
node_player -.->|"creates or joins"| node_homeshell
node_player -.->|"plays"| node_gameui
node_player -.->|"views"| node_statsui
node_authui -->|"requests"| node_http
node_http -->|"HTTP calls"| node_authapi
node_player -.->|"authenticates"| node_authapi
node_authapi -->|"delegates"| node_authlogic
node_authlogic -->|"manages users"| node_profiles
node_authlogic -->|"reads and writes"| node_database
node_player -.->|"creates or joins"| node_gamesapi
node_gamesapi -->|"delegates"| node_gamelogic
node_gamesapi -->|"loads profile"| node_profiles
node_gamelogic -->|"manages state"| node_gamestate
node_gamelogic -->|"uses gateway"| node_gameevents
node_gamelogic -->|"uses gateway"| node_socialevents
node_gamelogic -->|"records results"| node_statslogic
node_player -.->|"views lobbies"| node_lobbyapi
node_lobbyapi -->|"delegates"| node_lobbylogic
node_lobbylogic -->|"reads"| node_database
node_player -.->|"manages friends"| node_socialui
node_socialui -.->|"HTTP requests"| node_socialapi
node_socialapi -->|"delegates"| node_profiles
node_profiles -->|"reads and writes"| node_database
node_player -.->|"requests stats"| node_statsapi
node_statsapi -->|"delegates"| node_statslogic
node_statslogic -->|"reads and writes"| node_database

click node_webapp "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/routes/routes.tsx"
click node_authui "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/context/AuthProvider.tsx"
click node_homeshell "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/components/home/GameLaunchMenu.tsx"
click node_gameui "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/game/GameShell.tsx"
click node_statsui "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/pages/StatsPage.tsx"
click node_authapi "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/auth/auth.controller.ts"
click node_authlogic "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/auth/auth.service.ts"
click node_profiles "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/user/user.service.ts"
click node_gamesapi "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.controller.ts"
click node_gamelogic "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.service.ts"
click node_gamestate "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/GameStateContext.ts"
click node_gameevents "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.gateway.ts"
click node_lobbyapi "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/games/games.controller.ts"
click node_lobbylogic "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/games/games.service.ts"
click node_socialui "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/components/social/FriendList.tsx"
click node_socialapi "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/user/user.controller.ts"
click node_socialevents "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/social/social.gateway.ts"
click node_statsapi "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/stats/stats.controller.ts"
click node_statslogic "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/stats/stats.service.ts"
click node_database "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/database/database.service.ts"
click node_http "https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/services/http.tsx"

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_authui,node_homeshell,node_gameui,node_statsui,node_http toneBlue
class node_authapi,node_authlogic,node_profiles toneAmber
class node_gamesapi,node_gamelogic,node_gamestate,node_gameevents,node_lobbyapi,node_lobbylogic toneMint
class node_socialui,node_socialapi,node_socialevents toneRose
class node_statsapi,node_statslogic,node_database,node_player toneIndigo
```

## Components

### Web client

- [Application routes](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/routes/routes.tsx): `app/frontend/src/routes/routes.tsx`
- [Authentication UI](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/context/AuthProvider.tsx): `app/frontend/src/context/AuthProvider.tsx`
- [Home and lobby UI](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/components/home/GameLaunchMenu.tsx): `app/frontend/src/components/home/GameLaunchMenu.tsx`
- [Game interface](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/game/GameShell.tsx): `app/frontend/src/game/GameShell.tsx`
- [Stats pages](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/pages/StatsPage.tsx): `app/frontend/src/pages/StatsPage.tsx`
- [HTTP API client](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/services/http.tsx): `app/frontend/src/services/http.tsx`

### Identity and profiles

- [Authentication API](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/auth/auth.controller.ts): `app/backend/src/auth/auth.controller.ts`
- [Authentication service](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/auth/auth.service.ts): `app/backend/src/auth/auth.service.ts`
- [User and friendship service](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/user/user.service.ts): `app/backend/src/user/user.service.ts`

### Game and lobbies

- [Game endpoints](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.controller.ts): `app/backend/src/game/game.controller.ts`
- [Game orchestration](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.service.ts): `app/backend/src/game/game.service.ts`
- [Game rules and state](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/GameStateContext.ts): `app/backend/src/game/GameStateContext.ts`
- [Live game gateway](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/game/game.gateway.ts): `app/backend/src/game/game.gateway.ts`
- [Lobby listing](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/games/games.controller.ts): `app/backend/src/games/games.controller.ts`
- [Lobby service](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/games/games.service.ts): `app/backend/src/games/games.service.ts`

### Social

- [Friends UI](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/frontend/src/components/social/FriendList.tsx): `app/frontend/src/components/social/FriendList.tsx`
- [Social endpoints](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/user/user.controller.ts): `app/backend/src/user/user.controller.ts`
- [Social gateway](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/social/social.gateway.ts): `app/backend/src/social/social.gateway.ts`

### Statistics and persistence

- [Stats endpoints](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/stats/stats.controller.ts): `app/backend/src/stats/stats.controller.ts`
- [Stats service](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/stats/stats.service.ts): `app/backend/src/stats/stats.service.ts`
- [PostgreSQL database](https://github.com/ctrl-alt-transcend/smrow-game/blob/develop/app/backend/src/database/database.service.ts): `app/backend/src/database/database.service.ts`

### Other components

- **Player**

## Connections

- Player → Application routes: uses (evidence: `app/frontend/src/routes/routes.tsx`)
- Application routes → Authentication UI: renders (evidence: `app/frontend/src/context/AuthProvider.tsx`)
- Player → Home and lobby UI: creates or joins
- Player → Game interface: plays
- Player → Stats pages: views
- Authentication UI → HTTP API client: requests (evidence: `app/frontend/src/context/AuthProvider.tsx`)
- HTTP API client → Authentication API: HTTP calls
- Player → Authentication API: authenticates
- Authentication API → Authentication service: delegates (evidence: `app/backend/src/auth/auth.controller.ts`)
- Authentication service → User and friendship service: manages users (evidence: `app/backend/src/auth/auth.service.ts`)
- Authentication service → PostgreSQL database: reads and writes (evidence: `app/backend/src/auth/auth.service.ts`)
- Player → Game endpoints: creates or joins (evidence: `app/backend/src/game/game.controller.ts`)
- Game endpoints → Game orchestration: delegates (evidence: `app/backend/src/game/game.controller.ts`)
- Game endpoints → User and friendship service: loads profile (evidence: `app/backend/src/game/game.controller.ts`)
- Game orchestration → Game rules and state: manages state (evidence: `app/backend/src/game/game.service.ts`)
- Game orchestration → Live game gateway: uses gateway (evidence: `app/backend/src/game/game.service.ts`)
- Game orchestration → Social gateway: uses gateway (evidence: `app/backend/src/game/game.service.ts`)
- Game orchestration → Stats service: records results (evidence: `app/backend/src/game/game.service.ts`)
- Player → Lobby listing: views lobbies
- Lobby listing → Lobby service: delegates (evidence: `app/backend/src/games/games.controller.ts`)
- Lobby service → PostgreSQL database: reads (evidence: `app/backend/src/games/games.service.ts`)
- Player → Friends UI: manages friends
- Friends UI → Social endpoints: HTTP requests
- Social endpoints → User and friendship service: delegates (evidence: `app/backend/src/user/user.controller.ts`)
- User and friendship service → PostgreSQL database: reads and writes (evidence: `app/backend/src/user/user.service.ts`)
- Player → Stats endpoints: requests stats (evidence: `app/backend/src/stats/stats.controller.ts`)
- Stats endpoints → Stats service: delegates (evidence: `app/backend/src/stats/stats.controller.ts`)
- Stats service → PostgreSQL database: reads and writes (evidence: `app/backend/src/stats/stats.service.ts`)
