# govind516/quiz-app architecture

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

- Interactive diagram: https://gitdiagram.com/govind516/quiz-app
- Repository: https://github.com/govind516/quiz-app

## Overview

HexQuiz is an interview-prep quiz platform with solo practice, multiplayer rooms, rankings, profiles, and an administrative console. The main player journey is sign-in or guest entry, choose a practice quiz, play and submit an attempt, then view results and profile progress. The frontend is a Next.js application backed by a Spring Boot API; its API client attaches and refreshes auth tokens, while attempt and result payloads can be cached in browser storage. Live-room transport details and backend internals are not present in the supplied tree, so those connections are documented at product level only.

Main entry points: [`frontend/lib/api.ts`](https://github.com/govind516/quiz-app/blob/master/frontend/lib/api.ts) (API client), [`frontend/app/play/[id]/page.tsx`](https://github.com/govind516/quiz-app/blob/master/frontend/app/play/%5Bid%5D/page.tsx) (Quiz attempt), [`frontend/app/page.tsx`](https://github.com/govind516/quiz-app/blob/master/frontend/app/page.tsx) (Home), [`frontend/app/results/[id]/page.tsx`](https://github.com/govind516/quiz-app/blob/master/frontend/app/results/%5Bid%5D/page.tsx) (Attempt results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_player["Player experience"]
  node_home["Home<br/>[page.tsx]"]
  node_login["Sign in<br/>[page.tsx]"]
  node_practice["Practice catalog<br/>[page.tsx]"]
  node_play["Quiz attempt<br/>[page.tsx]"]
  node_results["Attempt results<br/>[page.tsx]"]
  node_profile["Profile progress<br/>[page.tsx]"]
end

subgraph group_state["Session and API"]
  node_auth["Auth state<br/>[auth-store.ts]"]
  node_api["API client<br/>[api.ts]"]
  node_config["API configuration<br/>[config.ts]"]
  node_attemptcache["Attempt cache<br/>[guest-session.ts]"]
  node_resultcache["Result cache<br/>[result-cache.ts]"]
end

subgraph group_social["Live and rankings"]
  node_live["Live rooms"]
  node_leaderboard["Leaderboard<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin["Admin console"]
end

node_player(("Player"))
node_backend{{"Spring Boot API"}}

node_player -->|"opens"| node_home
node_home -->|"links to"| node_practice
node_home -->|"links to"| node_leaderboard
node_player -->|"signs in"| node_login
node_login -.->|"establishes session"| node_auth
node_practice -.->|"requests quizzes"| node_api
node_play -.->|"submits attempt"| node_api
node_api -->|"sends requests"| node_backend
node_api -->|"uses base URL"| node_config
node_api -->|"reads tokens"| node_auth
node_play -.->|"stores start payload"| node_attemptcache
node_play -->|"shows completed attempt"| node_results
node_results -.->|"caches result"| node_resultcache
node_results -->|"continues to progress"| node_profile
node_profile -->|"loads stats"| node_api
node_leaderboard -->|"loads rankings"| node_api
node_player -->|"joins room"| node_live
node_live -.->|"exchanges room updates"| node_backend
node_admin -->|"loads admin data"| node_api
node_admin -.->|"manages quiz content"| node_backend

click node_home "https://github.com/govind516/quiz-app/blob/master/frontend/app/page.tsx"
click node_login "https://github.com/govind516/quiz-app/blob/master/frontend/app/login/page.tsx"
click node_practice "https://github.com/govind516/quiz-app/blob/master/frontend/app/practice/page.tsx"
click node_play "https://github.com/govind516/quiz-app/blob/master/frontend/app/play/%5Bid%5D/page.tsx"
click node_results "https://github.com/govind516/quiz-app/blob/master/frontend/app/results/%5Bid%5D/page.tsx"
click node_profile "https://github.com/govind516/quiz-app/blob/master/frontend/app/profile/page.tsx"
click node_auth "https://github.com/govind516/quiz-app/blob/master/frontend/lib/auth-store.ts"
click node_api "https://github.com/govind516/quiz-app/blob/master/frontend/lib/api.ts"
click node_config "https://github.com/govind516/quiz-app/blob/master/frontend/lib/config.ts"
click node_attemptcache "https://github.com/govind516/quiz-app/blob/master/frontend/lib/guest-session.ts"
click node_resultcache "https://github.com/govind516/quiz-app/blob/master/frontend/lib/result-cache.ts"
click node_live "https://github.com/govind516/quiz-app/tree/master/frontend/app/live"
click node_leaderboard "https://github.com/govind516/quiz-app/blob/master/frontend/app/leaderboard/page.tsx"
click node_admin "https://github.com/govind516/quiz-app/tree/master/frontend/app/admin"

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_home,node_login,node_practice,node_play,node_results,node_profile toneBlue
class node_auth,node_api,node_config,node_attemptcache,node_resultcache toneAmber
class node_live,node_leaderboard,node_backend toneMint
class node_admin toneRose
class node_player toneIndigo
```

## Components

### Player experience

- [Home](https://github.com/govind516/quiz-app/blob/master/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Sign in](https://github.com/govind516/quiz-app/blob/master/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [Practice catalog](https://github.com/govind516/quiz-app/blob/master/frontend/app/practice/page.tsx): `frontend/app/practice/page.tsx`
- [Quiz attempt](https://github.com/govind516/quiz-app/blob/master/frontend/app/play/%5Bid%5D/page.tsx): `frontend/app/play/[id]/page.tsx`
- [Attempt results](https://github.com/govind516/quiz-app/blob/master/frontend/app/results/%5Bid%5D/page.tsx): `frontend/app/results/[id]/page.tsx`
- [Profile progress](https://github.com/govind516/quiz-app/blob/master/frontend/app/profile/page.tsx): `frontend/app/profile/page.tsx`

### Session and API

- [Auth state](https://github.com/govind516/quiz-app/blob/master/frontend/lib/auth-store.ts): `frontend/lib/auth-store.ts`
- [API client](https://github.com/govind516/quiz-app/blob/master/frontend/lib/api.ts): `frontend/lib/api.ts`
- [API configuration](https://github.com/govind516/quiz-app/blob/master/frontend/lib/config.ts): `frontend/lib/config.ts`
- [Attempt cache](https://github.com/govind516/quiz-app/blob/master/frontend/lib/guest-session.ts): `frontend/lib/guest-session.ts`
- [Result cache](https://github.com/govind516/quiz-app/blob/master/frontend/lib/result-cache.ts): `frontend/lib/result-cache.ts`

### Live and rankings

- [Live rooms](https://github.com/govind516/quiz-app/tree/master/frontend/app/live): `frontend/app/live`
- [Leaderboard](https://github.com/govind516/quiz-app/blob/master/frontend/app/leaderboard/page.tsx): `frontend/app/leaderboard/page.tsx`

### Administration

- [Admin console](https://github.com/govind516/quiz-app/tree/master/frontend/app/admin): `frontend/app/admin`

### Other components

- **Player**
- **Spring Boot API**

## Connections

- Player → Home: opens (evidence: `README.md`)
- Home → Practice catalog: links to (evidence: `frontend/app/page.tsx`)
- Home → Leaderboard: links to (evidence: `frontend/app/page.tsx`)
- Player → Sign in: signs in (evidence: `README.md`)
- Sign in → Auth state: establishes session
- Practice catalog → API client: requests quizzes
- Quiz attempt → API client: submits attempt
- API client → Spring Boot API: sends requests (evidence: `frontend/lib/api.ts`)
- API client → API configuration: uses base URL (evidence: `frontend/lib/api.ts`)
- API client → Auth state: reads tokens (evidence: `frontend/lib/api.ts`)
- Quiz attempt → Attempt cache: stores start payload
- Quiz attempt → Attempt results: shows completed attempt (evidence: `README.md`)
- Attempt results → Result cache: caches result
- Attempt results → Profile progress: continues to progress (evidence: `README.md`)
- Profile progress → API client: loads stats (evidence: `frontend/app/profile/page.tsx`)
- Leaderboard → API client: loads rankings (evidence: `frontend/app/leaderboard/page.tsx`)
- Player → Live rooms: joins room (evidence: `README.md`)
- Live rooms → Spring Boot API: exchanges room updates
- Admin console → API client: loads admin data (evidence: `frontend/app/admin/page.tsx`)
- Admin console → Spring Boot API: manages quiz content (evidence: `README.md`)
