# someshk1703/zombiehunt architecture

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

- Interactive diagram: https://gitdiagram.com/someshk1703/zombiehunt
- Repository: https://github.com/someshk1703/zombiehunt

## Overview

Zombie Hunt is a real-time multiplayer card game: players establish an identity, create or join a room, wait for a match, play simultaneous card duels through successive game phases, and view the outcome. React routes and screens provide the player workflow; Supabase supplies authentication, persistence, realtime updates, and server-side game operations. The README documents the major gameplay rules and backend capabilities. Some page and edge-function internals were not sampled, so their detailed call relationships are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/someshk1703/zombiehunt/blob/master/src/App.tsx) (App Router), [`src/pages/Game.tsx`](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Game.tsx) (Game Route), [`src/pages/WaitingRoom.tsx`](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/WaitingRoom.tsx) (Waiting Room), [`src/context/GameContext.tsx`](https://github.com/someshk1703/zombiehunt/blob/master/src/context/GameContext.tsx) (Game Session Context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Rooms"]
  node_app["App Router<br/>[App.tsx]"]
  node_home["Home<br/>[Home.tsx]"]
  node_create["Create Room<br/>[CreateRoom.tsx]"]
  node_quickplay["Quick Play<br/>[QuickPlay.tsx]"]
  node_join["Join Room<br/>[JoinRoomModal.tsx]"]
end

subgraph group_lobby["Lobby and Matchmaking"]
  node_waiting["Waiting Room<br/>[WaitingRoom.tsx]"]
  node_lobbychat["Lobby Chat<br/>[LobbyChat.tsx]"]
end

subgraph group_play["Game Session"]
  node_gamepage["Game Route<br/>[Game.tsx]"]
  node_round["Duel Round"]
  node_handreview["Hand Review"]
  node_discussion["Discussion"]
  node_reveal["Round Reveal<br/>[RevealScreen.tsx]"]
  node_results["Results<br/>[Results.tsx]"]
end

subgraph group_backend["Backend Game Services"]
  node_matchmaking["Matchmaking<br/>[index.ts]"]
  node_startgame["Start Game<br/>[index.ts]"]
  node_deal["Card Dealing<br/>[dealCards.ts]"]
  node_resolve["Round Resolution<br/>[index.ts]"]
  node_wincheck["Win Check<br/>[index.ts]"]
  node_ghost["Ghost Data<br/>[index.ts]"]
end

subgraph group_shared["Client State and Services"]
  node_gamecontext["Game Session Context<br/>[GameContext.tsx]"]
  node_store["Game Store<br/>[gameStore.ts]"]
  node_auth["Anonymous Auth<br/>[auth.ts]"]
  node_supabase["Supabase Client<br/>[supabase.ts]"]
end

node_player(("Player"))
node_database[("Supabase Database")]
node_realtime["Supabase Realtime"]

node_player -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_create
node_app -->|"routes to"| node_quickplay
node_app -->|"routes to"| node_waiting
node_app -->|"routes to"| node_gamepage
node_app -->|"routes to"| node_results
node_home -->|"opens"| node_join
node_waiting -->|"renders"| node_join
node_waiting -->|"renders"| node_lobbychat
node_quickplay -.->|"finds match"| node_matchmaking
node_waiting -.->|"starts game"| node_startgame
node_startgame -->|"deals cards"| node_deal
node_gamepage -->|"provides session"| node_gamecontext
node_gamepage -->|"renders phase"| node_handreview
node_gamepage -->|"renders phase"| node_round
node_gamepage -->|"renders phase"| node_discussion
node_gamepage -->|"renders phase"| node_reveal
node_round -.->|"submits duel"| node_resolve
node_resolve -.->|"checks outcome"| node_wincheck
node_gamecontext -->|"syncs session"| node_store
node_gamecontext -->|"reads updates"| node_supabase
node_auth -->|"authenticates"| node_supabase
node_app -->|"loads identity"| node_auth
node_supabase -.->|"queries"| node_database
node_supabase -->|"subscribes"| node_realtime
node_realtime -->|"delivers changes"| node_gamecontext
node_gamepage -.->|"requests ghost data"| node_ghost
node_results -.->|"loads results"| node_database

click node_app "https://github.com/someshk1703/zombiehunt/blob/master/src/App.tsx"
click node_home "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Home.tsx"
click node_create "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/CreateRoom.tsx"
click node_quickplay "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/QuickPlay.tsx"
click node_join "https://github.com/someshk1703/zombiehunt/blob/master/src/components/JoinRoomModal.tsx"
click node_waiting "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/WaitingRoom.tsx"
click node_lobbychat "https://github.com/someshk1703/zombiehunt/blob/master/src/components/LobbyChat.tsx"
click node_matchmaking "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/matchmaking/index.ts"
click node_gamepage "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Game.tsx"
click node_gamecontext "https://github.com/someshk1703/zombiehunt/blob/master/src/context/GameContext.tsx"
click node_round "https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/GameRoundScreen.tsx"
click node_handreview "https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/HandReviewScreen.tsx"
click node_discussion "https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/DiscussionRoundScreen.tsx"
click node_reveal "https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/RevealScreen.tsx"
click node_results "https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Results.tsx"
click node_startgame "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/start-game/index.ts"
click node_deal "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/_shared/dealCards.ts"
click node_resolve "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/resolve-round/index.ts"
click node_wincheck "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/check-win/index.ts"
click node_ghost "https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/ghost-data/index.ts"
click node_store "https://github.com/someshk1703/zombiehunt/blob/master/src/store/gameStore.ts"
click node_auth "https://github.com/someshk1703/zombiehunt/blob/master/src/lib/auth.ts"
click node_supabase "https://github.com/someshk1703/zombiehunt/blob/master/src/lib/supabase.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_app,node_home,node_create,node_quickplay,node_join toneBlue
class node_waiting,node_lobbychat,node_database toneAmber
class node_gamepage,node_round,node_handreview,node_discussion,node_reveal,node_results toneMint
class node_matchmaking,node_startgame,node_deal,node_resolve,node_wincheck,node_ghost toneRose
class node_gamecontext,node_store,node_auth,node_supabase,node_player,node_realtime toneIndigo
```

## Components

### Entry and Rooms

- [App Router](https://github.com/someshk1703/zombiehunt/blob/master/src/App.tsx): `src/App.tsx`
- [Home](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Create Room](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/CreateRoom.tsx): `src/pages/CreateRoom.tsx`
- [Quick Play](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/QuickPlay.tsx): `src/pages/QuickPlay.tsx`
- [Join Room](https://github.com/someshk1703/zombiehunt/blob/master/src/components/JoinRoomModal.tsx): `src/components/JoinRoomModal.tsx`

### Lobby and Matchmaking

- [Waiting Room](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/WaitingRoom.tsx): `src/pages/WaitingRoom.tsx`
- [Lobby Chat](https://github.com/someshk1703/zombiehunt/blob/master/src/components/LobbyChat.tsx): `src/components/LobbyChat.tsx`

### Game Session

- [Game Route](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Game.tsx): `src/pages/Game.tsx`
- [Duel Round](https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/GameRoundScreen.tsx): `src/components/game/GameRoundScreen.tsx`
- [Hand Review](https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/HandReviewScreen.tsx): `src/components/game/HandReviewScreen.tsx`
- [Discussion](https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/DiscussionRoundScreen.tsx): `src/components/game/DiscussionRoundScreen.tsx`
- [Round Reveal](https://github.com/someshk1703/zombiehunt/blob/master/src/components/game/RevealScreen.tsx): `src/components/game/RevealScreen.tsx`
- [Results](https://github.com/someshk1703/zombiehunt/blob/master/src/pages/Results.tsx): `src/pages/Results.tsx`

### Backend Game Services

- [Matchmaking](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/matchmaking/index.ts): `supabase/functions/matchmaking/index.ts`
- [Start Game](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/start-game/index.ts): `supabase/functions/start-game/index.ts`
- [Card Dealing](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/_shared/dealCards.ts): `supabase/functions/_shared/dealCards.ts`
- [Round Resolution](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/resolve-round/index.ts): `supabase/functions/resolve-round/index.ts`
- [Win Check](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/check-win/index.ts): `supabase/functions/check-win/index.ts`
- [Ghost Data](https://github.com/someshk1703/zombiehunt/blob/master/supabase/functions/ghost-data/index.ts): `supabase/functions/ghost-data/index.ts`

### Client State and Services

- [Game Session Context](https://github.com/someshk1703/zombiehunt/blob/master/src/context/GameContext.tsx): `src/context/GameContext.tsx`
- [Game Store](https://github.com/someshk1703/zombiehunt/blob/master/src/store/gameStore.ts): `src/store/gameStore.ts`
- [Anonymous Auth](https://github.com/someshk1703/zombiehunt/blob/master/src/lib/auth.ts): `src/lib/auth.ts`
- [Supabase Client](https://github.com/someshk1703/zombiehunt/blob/master/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Player**
- **Supabase Database**
- **Supabase Realtime**

## Connections

- Player → App Router: opens (evidence: `src/App.tsx`)
- App Router → Home: routes to (evidence: `src/App.tsx`)
- App Router → Create Room: routes to (evidence: `src/App.tsx`)
- App Router → Quick Play: routes to (evidence: `src/App.tsx`)
- App Router → Waiting Room: routes to (evidence: `src/App.tsx`)
- App Router → Game Route: routes to (evidence: `src/App.tsx`)
- App Router → Results: routes to (evidence: `src/App.tsx`)
- Home → Join Room: opens (evidence: `src/pages/Home.tsx`)
- Waiting Room → Join Room: renders (evidence: `src/pages/WaitingRoom.tsx`)
- Waiting Room → Lobby Chat: renders (evidence: `src/pages/WaitingRoom.tsx`)
- Quick Play → Matchmaking: finds match
- Waiting Room → Start Game: starts game
- Start Game → Card Dealing: deals cards (evidence: `supabase/functions/start-game/index.ts`)
- Game Route → Game Session Context: provides session (evidence: `src/pages/Game.tsx`)
- Game Route → Hand Review: renders phase (evidence: `src/pages/Game.tsx`)
- Game Route → Duel Round: renders phase (evidence: `src/pages/Game.tsx`)
- Game Route → Discussion: renders phase (evidence: `src/pages/Game.tsx`)
- Game Route → Round Reveal: renders phase (evidence: `src/pages/Game.tsx`)
- Duel Round → Round Resolution: submits duel
- Round Resolution → Win Check: checks outcome
- Game Session Context → Game Store: syncs session (evidence: `src/context/GameContext.tsx`)
- Game Session Context → Supabase Client: reads updates (evidence: `src/context/GameContext.tsx`)
- Anonymous Auth → Supabase Client: authenticates (evidence: `src/lib/auth.ts`)
- App Router → Anonymous Auth: loads identity (evidence: `src/App.tsx`)
- Supabase Client → Supabase Database: queries
- Supabase Client → Supabase Realtime: subscribes
- Supabase Realtime → Game Session Context: delivers changes (evidence: `src/context/GameContext.tsx`)
- Game Route → Ghost Data: requests ghost data
- Results → Supabase Database: loads results
