# ysoseri1224/uoa-compsci-732-proj-archive architecture

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

- Interactive diagram: https://gitdiagram.com/ysoseri1224/uoa-compsci-732-proj-archive
- Repository: https://github.com/ysoseri1224/uoa-compsci-732-proj-archive

## Overview

Wild Hand: SkillFlop is a browser card game combining Texas Hold’em-style hands with skill-driven PvE battles and rogue progression. The main player workflow is to authenticate, enter a battle, select skills, play cards through socket-driven rounds, and progress through upgrades; profile, leaderboard, and match/replay support are additional product branches. The graph follows documented capabilities and the shown frontend/socket/backend call relationships. Several route, persistence, and UI implementations were not sampled, so uncertain links are omitted or shown as unverified.

Main entry points: [`CardGame/frontend/src/hooks/useGameLogic.js`](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/hooks/useGameLogic.js) (Battle hook), [`CardGame/backend/src/pve/actions.ts`](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/actions.ts) (Battle actions), [`CardGame/frontend/src/router/index.jsx`](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/router/index.jsx) (App routing), [`CardGame/frontend/src/pages/GamePage.jsx`](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/GamePage.jsx) (Game page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser application"]
  node_router["App routing<br/>[index.jsx]"]
  node_authui["Auth state<br/>[authStore.js]"]
  node_authapi["Auth API client<br/>[authApi.js]"]
  node_gamepage["Game page<br/>[GamePage.jsx]"]
  node_gamelogic["Battle hook<br/>[useGameLogic.js]"]
  node_socketadapter["Socket adapter"]
  node_battlestore["Battle state<br/>[pveSocketStore.js]"]
  node_battleui["Battle display<br/>[Battlefield.jsx]"]
  node_rogueui["Rogue mode<br/>[RogueGamePage.jsx]"]
  node_accountpages["Player pages<br/>[ProfilePage.jsx]"]
  node_leaderboard["Leaderboard"]
  node_replay["Match replay<br/>[ReplayPage.jsx]"]
end

subgraph group_backend["Game services"]
  node_socket["Socket entry<br/>[socket.ts]"]
  node_sockethandlers["PvE event handlers<br/>[pveHandlers.ts]"]
  node_routes["HTTP routes<br/>[index.js]"]
end

subgraph group_gameplay["Battle domain"]
  node_runtime["Room runtime<br/>[runtime.ts]"]
  node_roundmachine["Round machine<br/>[roundMachine.ts]"]
  node_actions["Battle actions<br/>[actions.ts]"]
  node_cards["Cards and deck<br/>[deck.ts]"]
  node_hands["Hand scoring<br/>[hand.ts]"]
  node_skills["Skills and buffs<br/>[skills.ts]"]
  node_savepoints["Run savepoints<br/>[savepoint.ts]"]
end

subgraph group_data["Persistence"]
  node_models[("Account and match models")]
  node_mongodb[("MongoDB")]
  node_redis[("Redis<br/>[redis.js]")]
end

node_player(("Player"))

node_player -->|"uses"| node_router
node_router -->|"checks auth"| node_authui
node_authui -->|"refreshes token"| node_authapi
node_router -->|"routes to"| node_gamepage
node_gamepage -.->|"uses"| node_gamelogic
node_gamelogic -->|"adapts state"| node_socketadapter
node_gamelogic -->|"updates state"| node_battlestore
node_gamepage -.->|"renders"| node_battleui
node_player -.->|"chooses upgrades"| node_rogueui
node_player -.->|"views profile"| node_accountpages
node_player -.->|"views rankings"| node_leaderboard
node_player -.->|"views match"| node_replay
node_gamelogic -.->|"emits events"| node_socket
node_socket -.->|"dispatches events"| node_sockethandlers
node_sockethandlers -->|"sends room events"| node_runtime
node_runtime -->|"advances rounds"| node_roundmachine
node_runtime -->|"applies actions"| node_actions
node_actions -->|"draws and shuffles"| node_cards
node_actions -->|"calculates damage"| node_hands
node_actions -->|"applies skills"| node_skills
node_sockethandlers -->|"restores runs"| node_savepoints
node_routes -.->|"serves account and match data"| node_models
node_models -.->|"persists records"| node_mongodb
node_routes -.->|"uses cache"| node_redis

click node_router "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/router/index.jsx"
click node_authui "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/store/authStore.js"
click node_authapi "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/api/authApi.js"
click node_gamepage "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/GamePage.jsx"
click node_gamelogic "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/hooks/useGameLogic.js"
click node_socketadapter "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/socket/pveSocketAdapter.js"
click node_battlestore "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/store/pveSocketStore.js"
click node_battleui "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/components/game/Battlefield.jsx"
click node_rogueui "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/RogueGamePage.jsx"
click node_accountpages "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/ProfilePage.jsx"
click node_leaderboard "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/LeaderboardPage.jsx"
click node_replay "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/ReplayPage.jsx"
click node_socket "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/socket.ts"
click node_sockethandlers "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/utils/pveHandlers.ts"
click node_runtime "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/runtime.ts"
click node_roundmachine "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/roundMachine.ts"
click node_actions "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/actions.ts"
click node_cards "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/deck.ts"
click node_hands "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/hand.ts"
click node_skills "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/skills.ts"
click node_savepoints "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/savepoint.ts"
click node_routes "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/routes/index.js"
click node_models "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/tree/main/CardGame/backend/src/models"
click node_redis "https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/redis.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_router,node_authui,node_authapi,node_gamepage,node_gamelogic,node_socketadapter,node_battlestore,node_battleui,node_rogueui,node_accountpages,node_leaderboard,node_replay toneBlue
class node_socket,node_sockethandlers,node_routes toneAmber
class node_runtime,node_roundmachine,node_actions,node_cards,node_hands,node_skills,node_savepoints toneMint
class node_models,node_mongodb,node_redis toneRose
class node_player toneIndigo
```

## Components

### Browser application

- [App routing](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/router/index.jsx): `CardGame/frontend/src/router/index.jsx`
- [Auth state](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/store/authStore.js): `CardGame/frontend/src/store/authStore.js`
- [Auth API client](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/api/authApi.js): `CardGame/frontend/src/api/authApi.js`
- [Game page](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/GamePage.jsx): `CardGame/frontend/src/pages/GamePage.jsx`
- [Battle hook](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/hooks/useGameLogic.js): `CardGame/frontend/src/hooks/useGameLogic.js`
- [Socket adapter](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/socket/pveSocketAdapter.js): `CardGame/frontend/src/socket/pveSocketAdapter.js`
- [Battle state](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/store/pveSocketStore.js): `CardGame/frontend/src/store/pveSocketStore.js`
- [Battle display](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/components/game/Battlefield.jsx): `CardGame/frontend/src/components/game/Battlefield.jsx`
- [Rogue mode](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/RogueGamePage.jsx): `CardGame/frontend/src/pages/RogueGamePage.jsx`
- [Player pages](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/ProfilePage.jsx): `CardGame/frontend/src/pages/ProfilePage.jsx`
- [Leaderboard](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/LeaderboardPage.jsx): `CardGame/frontend/src/pages/LeaderboardPage.jsx`
- [Match replay](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/frontend/src/pages/ReplayPage.jsx): `CardGame/frontend/src/pages/ReplayPage.jsx`

### Game services

- [Socket entry](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/socket.ts): `CardGame/backend/src/socket.ts`
- [PvE event handlers](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/utils/pveHandlers.ts): `CardGame/backend/src/utils/pveHandlers.ts`
- [HTTP routes](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/routes/index.js): `CardGame/backend/src/routes/index.js`

### Battle domain

- [Room runtime](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/runtime.ts): `CardGame/backend/src/pve/runtime.ts`
- [Round machine](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/roundMachine.ts): `CardGame/backend/src/pve/roundMachine.ts`
- [Battle actions](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/pve/actions.ts): `CardGame/backend/src/pve/actions.ts`
- [Cards and deck](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/deck.ts): `CardGame/backend/src/lib/deck.ts`
- [Hand scoring](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/hand.ts): `CardGame/backend/src/lib/hand.ts`
- [Skills and buffs](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/skills.ts): `CardGame/backend/src/lib/skills.ts`
- [Run savepoints](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/lib/savepoint.ts): `CardGame/backend/src/lib/savepoint.ts`

### Persistence

- [Account and match models](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/tree/main/CardGame/backend/src/models): `CardGame/backend/src/models`
- **MongoDB**
- [Redis](https://github.com/ysoseri1224/uoa-compsci-732-proj-archive/blob/main/CardGame/backend/src/redis.js): `CardGame/backend/src/redis.js`

### Other components

- **Player**

## Connections

- Player → App routing: uses (evidence: `CardGame/frontend/src/router/index.jsx`)
- App routing → Auth state: checks auth (evidence: `CardGame/frontend/src/router/index.jsx`)
- Auth state → Auth API client: refreshes token (evidence: `CardGame/frontend/src/store/authStore.js`)
- App routing → Game page: routes to (evidence: `CardGame/frontend/src/router/index.jsx`)
- Game page → Battle hook: uses
- Battle hook → Socket adapter: adapts state (evidence: `CardGame/frontend/src/hooks/useGameLogic.js`)
- Battle hook → Battle state: updates state (evidence: `CardGame/frontend/src/hooks/useGameLogic.js`)
- Game page → Battle display: renders
- Player → Rogue mode: chooses upgrades
- Player → Player pages: views profile
- Player → Leaderboard: views rankings
- Player → Match replay: views match
- Battle hook → Socket entry: emits events
- Socket entry → PvE event handlers: dispatches events
- PvE event handlers → Room runtime: sends room events (evidence: `CardGame/backend/src/utils/pveHandlers.ts`)
- Room runtime → Round machine: advances rounds (evidence: `CardGame/backend/src/pve/runtime.ts`)
- Room runtime → Battle actions: applies actions (evidence: `CardGame/backend/src/pve/runtime.ts`)
- Battle actions → Cards and deck: draws and shuffles (evidence: `CardGame/backend/src/pve/actions.ts`)
- Battle actions → Hand scoring: calculates damage (evidence: `CardGame/backend/src/pve/actions.ts`)
- Battle actions → Skills and buffs: applies skills (evidence: `CardGame/backend/src/pve/actions.ts`)
- PvE event handlers → Run savepoints: restores runs (evidence: `CardGame/backend/src/utils/pveHandlers.ts`)
- HTTP routes → Account and match models: serves account and match data
- Account and match models → MongoDB: persists records
- HTTP routes → Redis: uses cache
