# wb873/se-poker-project architecture

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

- Interactive diagram: https://gitdiagram.com/wb873/se-poker-project
- Repository: https://github.com/wb873/se-poker-project

## Overview

SE-Poker-Project is a web app for Caribbean Stud Poker, with both standalone games and multiplayer lobbies. Players enter through the client, sign in or play as guests, then browse or create a lobby and play at a table; the server handles game state and real-time table events. Separate capabilities cover accounts, friends and chat, balances, leaderboards, contact, ads, and administration. The source index supports key module references, but several client pages and server controllers were not excerpted, so some feature-level wiring is omitted.

Main entry points: [`server.js`](https://github.com/wb873/se-poker-project/blob/main/server.js) (HTTP and sockets), [`controller/LeaderboardController.js`](https://github.com/wb873/se-poker-project/blob/main/controller/LeaderboardController.js) (Leaderboard services), [`client/src/App.jsx`](https://github.com/wb873/se-poker-project/blob/main/client/src/App.jsx) (App and routes), [`routes/game_routes.js`](https://github.com/wb873/se-poker-project/blob/main/routes/game_routes.js) (Game endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App and routes<br/>[App.jsx]"]
  node_session["Session state<br/>[session.jsx]"]
  node_game_ui["Table interface"]
  node_client_api["API configuration<br/>[api_config.js]"]
end

subgraph group_runtime["Game runtime"]
  node_server["HTTP and sockets<br/>[server.js]"]
  node_game_routes["Game endpoints<br/>[game_routes.js]"]
  node_game["Solo game rules<br/>[game.js]"]
  node_lobby_routes["Lobby endpoints<br/>[lobby_routes.js]"]
  node_lobby_controller["Lobby management<br/>[LobbyController.js]"]
  node_table_controller["Live table coordination<br/>[TableController.js]"]
  node_table_game["Multiplayer table engine<br/>[tableGame.js]"]
  node_bot["Bot strategy<br/>[botStrategy.js]"]
  node_lobby_store[("Lobby records<br/>[LobbyDao.js]")]
end

subgraph group_accounts["Accounts and social"]
  node_user_routes["Account endpoints<br/>[user_routes.js]"]
  node_user_controller["Account management<br/>[UserController.js]"]
  node_auth["Session authentication<br/>[AuthSession.js]"]
  node_user_store[("Player accounts<br/>[UserDao.js]")]
  node_social["Friends and messaging"]
  node_contact["Contact requests"]
  node_ads["Ad rewards<br/>[AdController.js]"]
end

subgraph group_rankings["Rankings and admin"]
  node_leaderboard["Leaderboard services"]
  node_leaderboard_store[("Leaderboard data<br/>[LeaderboardDao.js]")]
  node_stats[("Player statistics<br/>[PlayerStatsDao.js]")]
  node_admin["Admin capabilities<br/>[AdminController.js]"]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"reads"| node_session
node_app -.->|"routes to"| node_game_ui
node_session -->|"uses"| node_client_api
node_client_api -.->|"targets"| node_server
node_server -->|"mounts"| node_game_routes
node_server -->|"mounts"| node_lobby_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"registers sockets"| node_table_controller
node_game_routes -->|"calls"| node_game
node_game_routes -->|"records hand"| node_leaderboard
node_lobby_routes -->|"dispatches"| node_lobby_controller
node_lobby_controller -->|"reads and writes"| node_lobby_store
node_table_controller -->|"coordinates"| node_table_game
node_table_controller -->|"reads and writes"| node_lobby_store
node_table_game -->|"uses rules"| node_game
node_table_game -->|"uses strategy"| node_bot
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"guards routes"| node_auth
node_user_controller -->|"reads and writes"| node_user_store
node_auth -->|"looks up user"| node_user_store
node_leaderboard -->|"records and reads"| node_leaderboard_store
node_leaderboard -->|"records hands"| node_stats
node_leaderboard -->|"via player stats"| node_user_store
node_server -->|"registers handlers"| node_social
node_server -->|"mounts routes"| node_contact
node_server -->|"mounts routes"| node_admin
node_server -->|"mounts routes"| node_ads

click node_app "https://github.com/wb873/se-poker-project/blob/main/client/src/App.jsx"
click node_session "https://github.com/wb873/se-poker-project/blob/main/client/src/session.jsx"
click node_game_ui "https://github.com/wb873/se-poker-project/blob/main/client/src/components/game_table_view.jsx"
click node_client_api "https://github.com/wb873/se-poker-project/blob/main/client/src/api_config.js"
click node_server "https://github.com/wb873/se-poker-project/blob/main/server.js"
click node_game_routes "https://github.com/wb873/se-poker-project/blob/main/routes/game_routes.js"
click node_game "https://github.com/wb873/se-poker-project/blob/main/game.js"
click node_lobby_routes "https://github.com/wb873/se-poker-project/blob/main/routes/lobby_routes.js"
click node_lobby_controller "https://github.com/wb873/se-poker-project/blob/main/controller/LobbyController.js"
click node_table_controller "https://github.com/wb873/se-poker-project/blob/main/controller/TableController.js"
click node_table_game "https://github.com/wb873/se-poker-project/blob/main/tableGame.js"
click node_bot "https://github.com/wb873/se-poker-project/blob/main/botStrategy.js"
click node_lobby_store "https://github.com/wb873/se-poker-project/blob/main/model/LobbyDao.js"
click node_user_routes "https://github.com/wb873/se-poker-project/blob/main/routes/user_routes.js"
click node_user_controller "https://github.com/wb873/se-poker-project/blob/main/controller/UserController.js"
click node_auth "https://github.com/wb873/se-poker-project/blob/main/util/AuthSession.js"
click node_user_store "https://github.com/wb873/se-poker-project/blob/main/model/UserDao.js"
click node_social "https://github.com/wb873/se-poker-project/tree/main/controller"
click node_contact "https://github.com/wb873/se-poker-project/blob/main/controller/ContactController.js"
click node_leaderboard "https://github.com/wb873/se-poker-project/blob/main/controller/LeaderboardController.js"
click node_leaderboard_store "https://github.com/wb873/se-poker-project/blob/main/model/LeaderboardDao.js"
click node_stats "https://github.com/wb873/se-poker-project/blob/main/model/PlayerStatsDao.js"
click node_admin "https://github.com/wb873/se-poker-project/blob/main/controller/AdminController.js"
click node_ads "https://github.com/wb873/se-poker-project/blob/main/controller/AdController.js"

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_app,node_session,node_game_ui,node_client_api toneBlue
class node_server,node_game_routes,node_game,node_lobby_routes,node_lobby_controller,node_table_controller,node_table_game,node_bot,node_lobby_store toneAmber
class node_user_routes,node_user_controller,node_auth,node_user_store,node_social,node_contact,node_ads toneMint
class node_leaderboard,node_leaderboard_store,node_stats,node_admin toneRose
class node_player toneIndigo
```

## Components

### Web client

- [App and routes](https://github.com/wb873/se-poker-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session state](https://github.com/wb873/se-poker-project/blob/main/client/src/session.jsx): `client/src/session.jsx`
- [Table interface](https://github.com/wb873/se-poker-project/blob/main/client/src/components/game_table_view.jsx): `client/src/components/game_table_view.jsx`
- [API configuration](https://github.com/wb873/se-poker-project/blob/main/client/src/api_config.js): `client/src/api_config.js`

### Game runtime

- [HTTP and sockets](https://github.com/wb873/se-poker-project/blob/main/server.js): `server.js`
- [Game endpoints](https://github.com/wb873/se-poker-project/blob/main/routes/game_routes.js): `routes/game_routes.js`
- [Solo game rules](https://github.com/wb873/se-poker-project/blob/main/game.js): `game.js`
- [Lobby endpoints](https://github.com/wb873/se-poker-project/blob/main/routes/lobby_routes.js): `routes/lobby_routes.js`
- [Lobby management](https://github.com/wb873/se-poker-project/blob/main/controller/LobbyController.js): `controller/LobbyController.js`
- [Live table coordination](https://github.com/wb873/se-poker-project/blob/main/controller/TableController.js): `controller/TableController.js`
- [Multiplayer table engine](https://github.com/wb873/se-poker-project/blob/main/tableGame.js): `tableGame.js`
- [Bot strategy](https://github.com/wb873/se-poker-project/blob/main/botStrategy.js): `botStrategy.js`
- [Lobby records](https://github.com/wb873/se-poker-project/blob/main/model/LobbyDao.js): `model/LobbyDao.js`

### Accounts and social

- [Account endpoints](https://github.com/wb873/se-poker-project/blob/main/routes/user_routes.js): `routes/user_routes.js`
- [Account management](https://github.com/wb873/se-poker-project/blob/main/controller/UserController.js): `controller/UserController.js`
- [Session authentication](https://github.com/wb873/se-poker-project/blob/main/util/AuthSession.js): `util/AuthSession.js`
- [Player accounts](https://github.com/wb873/se-poker-project/blob/main/model/UserDao.js): `model/UserDao.js`
- [Friends and messaging](https://github.com/wb873/se-poker-project/tree/main/controller): `controller`
- [Contact requests](https://github.com/wb873/se-poker-project/blob/main/controller/ContactController.js): `controller/ContactController.js`
- [Ad rewards](https://github.com/wb873/se-poker-project/blob/main/controller/AdController.js): `controller/AdController.js`

### Rankings and admin

- [Leaderboard services](https://github.com/wb873/se-poker-project/blob/main/controller/LeaderboardController.js): `controller/LeaderboardController.js`
- [Leaderboard data](https://github.com/wb873/se-poker-project/blob/main/model/LeaderboardDao.js): `model/LeaderboardDao.js`
- [Player statistics](https://github.com/wb873/se-poker-project/blob/main/model/PlayerStatsDao.js): `model/PlayerStatsDao.js`
- [Admin capabilities](https://github.com/wb873/se-poker-project/blob/main/controller/AdminController.js): `controller/AdminController.js`

### Other components

- **Player**

## Connections

- Player → App and routes: uses (evidence: `client/src/App.jsx`)
- App and routes → Session state: reads (evidence: `client/src/App.jsx`)
- App and routes → Table interface: routes to
- Session state → API configuration: uses (evidence: `client/src/session.jsx`)
- API configuration → HTTP and sockets: targets
- HTTP and sockets → Game endpoints: mounts (evidence: `server.js`)
- HTTP and sockets → Lobby endpoints: mounts (evidence: `server.js`)
- HTTP and sockets → Account endpoints: mounts (evidence: `server.js`)
- HTTP and sockets → Live table coordination: registers sockets (evidence: `server.js`)
- Game endpoints → Solo game rules: calls (evidence: `routes/game_routes.js`)
- Game endpoints → Leaderboard services: records hand (evidence: `routes/game_routes.js`)
- Lobby endpoints → Lobby management: dispatches (evidence: `routes/lobby_routes.js`)
- Lobby management → Lobby records: reads and writes (evidence: `controller/LobbyController.js`)
- Live table coordination → Multiplayer table engine: coordinates (evidence: `controller/TableController.js`)
- Live table coordination → Lobby records: reads and writes (evidence: `controller/TableController.js`)
- Multiplayer table engine → Solo game rules: uses rules (evidence: `tableGame.js`)
- Multiplayer table engine → Bot strategy: uses strategy (evidence: `tableGame.js`)
- Account endpoints → Account management: dispatches (evidence: `routes/user_routes.js`)
- Account endpoints → Session authentication: guards routes (evidence: `routes/user_routes.js`)
- Account management → Player accounts: reads and writes (evidence: `controller/UserController.js`)
- Session authentication → Player accounts: looks up user (evidence: `util/AuthSession.js`)
- Leaderboard services → Leaderboard data: records and reads (evidence: `controller/LeaderboardController.js`)
- Leaderboard services → Player statistics: records hands (evidence: `controller/LeaderboardController.js`)
- Leaderboard services → Player accounts: via player stats
- HTTP and sockets → Friends and messaging: registers handlers (evidence: `server.js`)
- HTTP and sockets → Contact requests: mounts routes (evidence: `server.js`)
- HTTP and sockets → Admin capabilities: mounts routes (evidence: `server.js`)
- HTTP and sockets → Ad rewards: mounts routes (evidence: `server.js`)
