# quitlightfe/kahoot architecture

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

- Interactive diagram: https://gitdiagram.com/quitlightfe/kahoot
- Repository: https://github.com/quitlightfe/kahoot

## Overview

This is a React/TypeScript frontend for role-based, live quizzes. Users register or sign in; students join a quiz, answer timed questions, and review results, while teachers create quizzes, host games, and inspect results. The app routes through role-protected pages, which call a shared Axios client for backend data. The README describes only a Vite template, so product capabilities are inferred from the source index and sampled pages; unsampled page behavior and backend internals are not expanded.

Main entry points: [`src/services/api.ts`](https://github.com/quitlightfe/kahoot/blob/main/src/services/api.ts) (HTTP client), [`src/components/ProtectedRoute.tsx`](https://github.com/quitlightfe/kahoot/blob/main/src/components/ProtectedRoute.tsx) (Role guard), [`src/App.tsx`](https://github.com/quitlightfe/kahoot/blob/main/src/App.tsx) (Route app), [`src/types/quiz.ts`](https://github.com/quitlightfe/kahoot/blob/main/src/types/quiz.ts) (Quiz models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App and access"]
  node_app["Route app<br/>[App.tsx]"]
  node_guard["Role guard<br/>[ProtectedRoute.tsx]"]
  node_login["Sign in<br/>[Login.tsx]"]
  node_register["Registration<br/>[Register.tsx]"]
end

subgraph group_student["Student experience"]
  node_student_dash["Student dashboard"]
  node_student_join["Join quiz"]
  node_student_lobby["Student lobby<br/>[StudentLobby.tsx]"]
  node_student_game["Answer questions<br/>[StudentGame.tsx]"]
  node_student_results["Student results<br/>[StudentResults.tsx]"]
  node_student_result_detail["Result detail<br/>[StudentResult.tsx]"]
end

subgraph group_teacher["Teacher experience"]
  node_teacher_dash["Quiz management"]
  node_teacher_lobby["Teacher lobby<br/>[TeacherLobby.tsx]"]
  node_teacher_game["Host live game<br/>[TeacherGame.tsx]"]
  node_teacher_results["Teacher results<br/>[TeacherResult.tsx]"]
end

subgraph group_shared["Shared client and models"]
  node_api["HTTP client<br/>[api.ts]"]
  node_auth_types["Auth models<br/>[auth.ts]"]
  node_quiz_types["Quiz models<br/>[quiz.ts]"]
end

node_student_actor(("Student"))
node_teacher_actor(("Teacher"))
node_backend[("Quiz backend")]

node_student_actor -->|"opens app"| node_app
node_teacher_actor -->|"opens app"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"protects routes"| node_guard
node_guard -->|"routes students"| node_student_dash
node_guard -->|"routes students"| node_student_join
node_guard -->|"routes students"| node_student_lobby
node_guard -->|"routes students"| node_student_game
node_guard -->|"routes students"| node_student_results
node_guard -->|"routes teachers"| node_teacher_dash
node_guard -->|"routes teachers"| node_teacher_lobby
node_guard -->|"routes teachers"| node_teacher_game
node_guard -->|"routes teachers"| node_teacher_results
node_student_dash -->|"navigates to"| node_student_join
node_login -->|"requests auth"| node_api
node_register -->|"requests registration"| node_api
node_student_dash -->|"loads history"| node_api
node_student_join -->|"joins quiz"| node_api
node_student_lobby -->|"loads lobby"| node_api
node_student_game -->|"loads and submits"| node_api
node_student_results -->|"loads results"| node_api
node_student_result_detail -->|"loads result data"| node_api
node_teacher_dash -->|"manages quizzes"| node_api
node_teacher_lobby -->|"loads lobby"| node_api
node_teacher_game -->|"updates game"| node_api
node_teacher_results -->|"loads results"| node_api
node_api -.->|"sends HTTP requests"| node_backend
node_login -->|"uses models"| node_auth_types
node_register -->|"uses models"| node_auth_types
node_guard -->|"checks role"| node_auth_types
node_student_game -->|"uses models"| node_quiz_types
node_student_results -->|"uses models"| node_quiz_types
node_teacher_dash -->|"uses models"| node_quiz_types
node_teacher_game -->|"uses models"| node_quiz_types
node_teacher_results -->|"uses models"| node_quiz_types

click node_app "https://github.com/quitlightfe/kahoot/blob/main/src/App.tsx"
click node_guard "https://github.com/quitlightfe/kahoot/blob/main/src/components/ProtectedRoute.tsx"
click node_login "https://github.com/quitlightfe/kahoot/blob/main/src/pages/Login.tsx"
click node_register "https://github.com/quitlightfe/kahoot/blob/main/src/pages/Register.tsx"
click node_student_dash "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentDashboard.tsx"
click node_student_join "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentJoinQuiz.tsx"
click node_student_lobby "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentLobby.tsx"
click node_student_game "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentGame.tsx"
click node_student_results "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentResults.tsx"
click node_student_result_detail "https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentResult.tsx"
click node_teacher_dash "https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherDashboard.tsx"
click node_teacher_lobby "https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherLobby.tsx"
click node_teacher_game "https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherGame.tsx"
click node_teacher_results "https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherResult.tsx"
click node_api "https://github.com/quitlightfe/kahoot/blob/main/src/services/api.ts"
click node_auth_types "https://github.com/quitlightfe/kahoot/blob/main/src/types/auth.ts"
click node_quiz_types "https://github.com/quitlightfe/kahoot/blob/main/src/types/quiz.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_guard,node_login,node_register toneBlue
class node_student_dash,node_student_join,node_student_lobby,node_student_game,node_student_results,node_student_result_detail,node_backend toneAmber
class node_teacher_dash,node_teacher_lobby,node_teacher_game,node_teacher_results toneMint
class node_api,node_auth_types,node_quiz_types toneRose
class node_student_actor,node_teacher_actor toneIndigo
```

## Components

### App and access

- [Route app](https://github.com/quitlightfe/kahoot/blob/main/src/App.tsx): `src/App.tsx`
- [Role guard](https://github.com/quitlightfe/kahoot/blob/main/src/components/ProtectedRoute.tsx): `src/components/ProtectedRoute.tsx`
- [Sign in](https://github.com/quitlightfe/kahoot/blob/main/src/pages/Login.tsx): `src/pages/Login.tsx`
- [Registration](https://github.com/quitlightfe/kahoot/blob/main/src/pages/Register.tsx): `src/pages/Register.tsx`

### Student experience

- [Student dashboard](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentDashboard.tsx): `src/pages/StudentDashboard.tsx`
- [Join quiz](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentJoinQuiz.tsx): `src/pages/StudentJoinQuiz.tsx`
- [Student lobby](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentLobby.tsx): `src/pages/StudentLobby.tsx`
- [Answer questions](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentGame.tsx): `src/pages/StudentGame.tsx`
- [Student results](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentResults.tsx): `src/pages/StudentResults.tsx`
- [Result detail](https://github.com/quitlightfe/kahoot/blob/main/src/pages/StudentResult.tsx): `src/pages/StudentResult.tsx`

### Teacher experience

- [Quiz management](https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherDashboard.tsx): `src/pages/TeacherDashboard.tsx`
- [Teacher lobby](https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherLobby.tsx): `src/pages/TeacherLobby.tsx`
- [Host live game](https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherGame.tsx): `src/pages/TeacherGame.tsx`
- [Teacher results](https://github.com/quitlightfe/kahoot/blob/main/src/pages/TeacherResult.tsx): `src/pages/TeacherResult.tsx`

### Shared client and models

- [HTTP client](https://github.com/quitlightfe/kahoot/blob/main/src/services/api.ts): `src/services/api.ts`
- [Auth models](https://github.com/quitlightfe/kahoot/blob/main/src/types/auth.ts): `src/types/auth.ts`
- [Quiz models](https://github.com/quitlightfe/kahoot/blob/main/src/types/quiz.ts): `src/types/quiz.ts`

### Other components

- **Student**
- **Teacher**
- **Quiz backend**

## Connections

- Student → Route app: opens app (evidence: `src/App.tsx`)
- Teacher → Route app: opens app (evidence: `src/App.tsx`)
- Route app → Sign in: routes to (evidence: `src/App.tsx`)
- Route app → Registration: routes to (evidence: `src/App.tsx`)
- Route app → Role guard: protects routes (evidence: `src/App.tsx`)
- Role guard → Student dashboard: routes students (evidence: `src/App.tsx`)
- Role guard → Join quiz: routes students (evidence: `src/App.tsx`)
- Role guard → Student lobby: routes students (evidence: `src/App.tsx`)
- Role guard → Answer questions: routes students (evidence: `src/App.tsx`)
- Role guard → Student results: routes students (evidence: `src/App.tsx`)
- Role guard → Quiz management: routes teachers (evidence: `src/App.tsx`)
- Role guard → Teacher lobby: routes teachers (evidence: `src/App.tsx`)
- Role guard → Host live game: routes teachers (evidence: `src/App.tsx`)
- Role guard → Teacher results: routes teachers (evidence: `src/App.tsx`)
- Student dashboard → Join quiz: navigates to (evidence: `src/pages/StudentDashboard.tsx`)
- Sign in → HTTP client: requests auth (evidence: `src/pages/Login.tsx`)
- Registration → HTTP client: requests registration (evidence: `src/pages/Register.tsx`)
- Student dashboard → HTTP client: loads history (evidence: `src/pages/StudentDashboard.tsx`)
- Join quiz → HTTP client: joins quiz (evidence: `src/pages/StudentJoinQuiz.tsx`)
- Student lobby → HTTP client: loads lobby (evidence: `src/pages/StudentLobby.tsx`)
- Answer questions → HTTP client: loads and submits (evidence: `src/pages/StudentGame.tsx`)
- Student results → HTTP client: loads results (evidence: `src/pages/StudentResults.tsx`)
- Result detail → HTTP client: loads result data (evidence: `src/pages/StudentResult.tsx`)
- Quiz management → HTTP client: manages quizzes (evidence: `src/pages/TeacherDashboard.tsx`)
- Teacher lobby → HTTP client: loads lobby (evidence: `src/pages/TeacherLobby.tsx`)
- Host live game → HTTP client: updates game (evidence: `src/pages/TeacherGame.tsx`)
- Teacher results → HTTP client: loads results (evidence: `src/pages/TeacherResult.tsx`)
- HTTP client → Quiz backend: sends HTTP requests (evidence: `src/services/api.ts`)
- Sign in → Auth models: uses models (evidence: `src/pages/Login.tsx`)
- Registration → Auth models: uses models (evidence: `src/pages/Register.tsx`)
- Role guard → Auth models: checks role (evidence: `src/components/ProtectedRoute.tsx`)
- Answer questions → Quiz models: uses models (evidence: `src/pages/StudentGame.tsx`)
- Student results → Quiz models: uses models (evidence: `src/pages/StudentResults.tsx`)
- Quiz management → Quiz models: uses models (evidence: `src/pages/TeacherDashboard.tsx`)
- Host live game → Quiz models: uses models (evidence: `src/pages/TeacherGame.tsx`)
- Teacher results → Quiz models: uses models (evidence: `src/pages/TeacherResult.tsx`)
