# siddharth-bhairy/quizarena_v2 architecture

> Architecture diagram of the GitHub repository siddharth-bhairy/quizarena_v2, 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/siddharth-bhairy/quizarena_v2
- Repository: https://github.com/siddharth-bhairy/quizarena_v2

## Overview

QuizArena is a browser-based quiz and multiplayer game with a FastAPI backend. Players sign up or log in, enter the Arena, play a classic quiz, a timed solo mode, or a live room duel, and submit scores for leaderboard ranking. Profiles and following support player discovery. The graph separates client flows, API domains, and persistence. Relationships are based on shown imports, API calls, backend registrations, or README statements; some backend route internals are represented at their exact module paths but were not excerpted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/App.jsx) (Routes and Arena), [`frontend/src/api.js`](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/api.js) (API client), [`backend/main.py`](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/main.py) (FastAPI application), [`backend/models.py`](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/models.py) (Data models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Routes and Arena<br/>[App.jsx]"]
  node_auth_client["Session client<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_classic["Classic quiz<br/>[ClassicQuiz.jsx]"]
  node_flash["Flash Anzan<br/>[FlashAnzan.jsx]"]
  node_flags["Flag Guess<br/>[FlagGuess.jsx]"]
  node_duel["Duel room<br/>[DuelRoom.jsx]"]
  node_leader_ui["Leaderboard view<br/>[Leaderboard.jsx]"]
  node_social_ui["Player profiles<br/>[Profile.jsx]"]
  node_shared_ui["Shared components"]
end

subgraph group_game["Game services"]
  node_server["FastAPI application<br/>[main.py]"]
  node_auth_logic["Token and password auth<br/>[auth.py]"]
  node_auth_api["Auth endpoints<br/>[auth_router.py]"]
  node_game_api["Quiz and score API<br/>[game.py]"]
  node_multi_api["Live room API<br/>[multiplayer.py]"]
  node_seed["Question seeding<br/>[seed_data.py]"]
end

subgraph group_community["Player community"]
  node_leader_api["Leaderboard API<br/>[leaderboard.py]"]
  node_social_api["Social API<br/>[social.py]"]
end

subgraph group_storage["Persistence"]
  node_models["Data models<br/>[models.py]"]
  node_database[("Relational database<br/>[database.py]")]
  node_schemas["API schemas<br/>[schemas.py]"]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"checks session"| node_auth_client
node_app -->|"routes to"| node_classic
node_app -->|"routes to"| node_flash
node_app -->|"routes to"| node_flags
node_app -->|"routes to"| node_duel
node_app -->|"routes to"| node_leader_ui
node_app -->|"routes to"| node_social_ui
node_auth_client -->|"validates session"| node_api_client
node_auth_client -->|"checks identity"| node_auth_api
node_classic -->|"starts and submits"| node_api_client
node_flash -->|"submits score"| node_api_client
node_flags -->|"submits score"| node_api_client
node_duel -->|"builds socket URL"| node_api_client
node_leader_ui -->|"requests ranks"| node_api_client
node_social_ui -->|"requests profile"| node_api_client
node_classic -->|"uses controls"| node_shared_ui
node_duel -->|"uses controls"| node_shared_ui
node_leader_ui -->|"uses follow control"| node_shared_ui
node_server -->|"registers routes"| node_auth_api
node_server -->|"registers routes"| node_game_api
node_server -->|"registers routes"| node_leader_api
node_server -->|"registers routes"| node_multi_api
node_server -->|"registers routes"| node_social_api
node_server -->|"seeds on startup"| node_seed
node_auth_api -->|"uses auth helpers"| node_auth_logic
node_auth_api -->|"gets database session"| node_database
node_game_api -->|"gets database session"| node_database
node_multi_api -->|"gets database session"| node_database
node_leader_api -->|"gets database session"| node_database
node_social_api -->|"gets database session"| node_database
node_auth_api -->|"queries users"| node_models
node_game_api -->|"uses game records"| node_models
node_multi_api -->|"uses game records"| node_models
node_leader_api -->|"queries scores"| node_models
node_social_api -->|"queries follows"| node_models
node_seed -->|"loads questions"| node_database
node_seed -->|"creates questions"| node_models
node_models -->|"uses ORM base"| node_database
node_auth_api -->|"validates responses"| node_schemas
node_game_api -->|"validates game data"| node_schemas
node_social_api -->|"validates social data"| node_schemas
node_api_client -->|"sends HTTP requests"| node_server
node_duel -->|"opens room socket"| node_multi_api

click node_app "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/App.jsx"
click node_auth_client "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/auth/AuthContext.jsx"
click node_api_client "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/api.js"
click node_classic "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/ClassicQuiz.jsx"
click node_flash "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/FlashAnzan.jsx"
click node_flags "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/FlagGuess.jsx"
click node_duel "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/DuelRoom.jsx"
click node_leader_ui "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/Leaderboard.jsx"
click node_social_ui "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/Profile.jsx"
click node_shared_ui "https://github.com/siddharth-bhairy/quizarena_v2/tree/main/frontend/src/components"
click node_server "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/main.py"
click node_auth_logic "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/auth.py"
click node_auth_api "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/auth_router.py"
click node_game_api "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/game.py"
click node_multi_api "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/multiplayer.py"
click node_leader_api "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/leaderboard.py"
click node_social_api "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/social.py"
click node_seed "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/seed_data.py"
click node_models "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/models.py"
click node_database "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/database.py"
click node_schemas "https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/schemas.py"

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_auth_client,node_api_client,node_classic,node_flash,node_flags,node_duel,node_leader_ui,node_social_ui,node_shared_ui toneBlue
class node_server,node_auth_logic,node_auth_api,node_game_api,node_multi_api,node_seed toneAmber
class node_leader_api,node_social_api toneMint
class node_models,node_database,node_schemas toneRose
class node_player toneIndigo
```

## Components

### Web client

- [Routes and Arena](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session client](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/auth/AuthContext.jsx): `frontend/src/auth/AuthContext.jsx`
- [API client](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Classic quiz](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/ClassicQuiz.jsx): `frontend/src/pages/ClassicQuiz.jsx`
- [Flash Anzan](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/FlashAnzan.jsx): `frontend/src/pages/FlashAnzan.jsx`
- [Flag Guess](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/FlagGuess.jsx): `frontend/src/pages/FlagGuess.jsx`
- [Duel room](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/DuelRoom.jsx): `frontend/src/pages/DuelRoom.jsx`
- [Leaderboard view](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/Leaderboard.jsx): `frontend/src/pages/Leaderboard.jsx`
- [Player profiles](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Shared components](https://github.com/siddharth-bhairy/quizarena_v2/tree/main/frontend/src/components): `frontend/src/components`

### Game services

- [FastAPI application](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/main.py): `backend/main.py`
- [Token and password auth](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/auth.py): `backend/auth.py`
- [Auth endpoints](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/auth_router.py): `backend/routers/auth_router.py`
- [Quiz and score API](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/game.py): `backend/routers/game.py`
- [Live room API](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/multiplayer.py): `backend/routers/multiplayer.py`
- [Question seeding](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/seed_data.py): `backend/seed_data.py`

### Player community

- [Leaderboard API](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/leaderboard.py): `backend/routers/leaderboard.py`
- [Social API](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/routers/social.py): `backend/routers/social.py`

### Persistence

- [Data models](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/models.py): `backend/models.py`
- [Relational database](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/database.py): `backend/database.py`
- [API schemas](https://github.com/siddharth-bhairy/quizarena_v2/blob/main/backend/schemas.py): `backend/schemas.py`

### Other components

- **Player**

## Connections

- Player → Routes and Arena: uses (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Session client: checks session (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Classic quiz: routes to (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Flash Anzan: routes to (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Flag Guess: routes to (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Duel room: routes to (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Leaderboard view: routes to (evidence: `frontend/src/App.jsx`)
- Routes and Arena → Player profiles: routes to (evidence: `frontend/src/App.jsx`)
- Session client → API client: validates session (evidence: `frontend/src/auth/AuthContext.jsx`)
- Session client → Auth endpoints: checks identity
- Classic quiz → API client: starts and submits (evidence: `frontend/src/api.js`)
- Flash Anzan → API client: submits score (evidence: `frontend/src/api.js`)
- Flag Guess → API client: submits score (evidence: `frontend/src/api.js`)
- Duel room → API client: builds socket URL (evidence: `frontend/src/pages/DuelRoom.jsx`)
- Leaderboard view → API client: requests ranks (evidence: `frontend/src/api.js`)
- Player profiles → API client: requests profile (evidence: `frontend/src/api.js`)
- Classic quiz → Shared components: uses controls (evidence: `frontend/src/pages/ClassicQuiz.jsx`)
- Duel room → Shared components: uses controls (evidence: `frontend/src/pages/DuelRoom.jsx`)
- Leaderboard view → Shared components: uses follow control (evidence: `frontend/src/pages/Leaderboard.jsx`)
- FastAPI application → Auth endpoints: registers routes (evidence: `backend/main.py`)
- FastAPI application → Quiz and score API: registers routes (evidence: `backend/main.py`)
- FastAPI application → Leaderboard API: registers routes (evidence: `backend/main.py`)
- FastAPI application → Live room API: registers routes (evidence: `backend/main.py`)
- FastAPI application → Social API: registers routes (evidence: `backend/main.py`)
- FastAPI application → Question seeding: seeds on startup (evidence: `backend/main.py`)
- Auth endpoints → Token and password auth: uses auth helpers (evidence: `backend/routers/auth_router.py`)
- Auth endpoints → Relational database: gets database session (evidence: `backend/routers/auth_router.py`)
- Quiz and score API → Relational database: gets database session (evidence: `backend/routers/game.py`)
- Live room API → Relational database: gets database session (evidence: `backend/routers/multiplayer.py`)
- Leaderboard API → Relational database: gets database session (evidence: `backend/routers/leaderboard.py`)
- Social API → Relational database: gets database session (evidence: `backend/routers/social.py`)
- Auth endpoints → Data models: queries users (evidence: `backend/routers/auth_router.py`)
- Quiz and score API → Data models: uses game records (evidence: `backend/routers/game.py`)
- Live room API → Data models: uses game records (evidence: `backend/routers/multiplayer.py`)
- Leaderboard API → Data models: queries scores (evidence: `backend/routers/leaderboard.py`)
- Social API → Data models: queries follows (evidence: `backend/routers/social.py`)
- Question seeding → Relational database: loads questions (evidence: `backend/seed_data.py`)
- Question seeding → Data models: creates questions (evidence: `backend/seed_data.py`)
- Data models → Relational database: uses ORM base (evidence: `backend/models.py`)
- Auth endpoints → API schemas: validates responses (evidence: `backend/routers/auth_router.py`)
- Quiz and score API → API schemas: validates game data (evidence: `backend/routers/game.py`)
- Social API → API schemas: validates social data (evidence: `backend/routers/social.py`)
- API client → FastAPI application: sends HTTP requests (evidence: `frontend/src/api.js`)
- Duel room → Live room API: opens room socket (evidence: `frontend/src/pages/DuelRoom.jsx`)
