# quiznett/quiznet_server architecture

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

- Interactive diagram: https://gitdiagram.com/quiznett/quiznet_server
- Repository: https://github.com/quiznett/quiznet_server

## Overview

QuizNet is a Django REST backend for user access and quiz creation, participation, scoring, and result retrieval. The primary workflow routes an API request to account or quiz views, validates/transforms data through serializers, and reads or writes persistent records. OTP email verification and token-cookie handling are visible in the account views; quiz attempts include start, answer saving, status, submission, grading, and response retrieval. The README also describes Channels-based live quizzes and chat, but no consumer or routing implementation appears in the supplied tree, so those links are not mapped as verified runtime components.

Main entry points: [`quiznet/account/views.py`](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/views.py) (Account endpoints), [`quiznet/quiznet/urls.py`](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiznet/urls.py) (Project routes), [`quiznet/quiz/views.py`](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/views.py) (Quiz and attempts), [`quiznet/quiz/models.py`](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/models.py) (Quiz records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API routing"]
  node_root_routes["Project routes<br/>[urls.py]"]
  node_account_routes["Account routes<br/>[urls.py]"]
  node_quiz_routes["Quiz routes<br/>[urls.py]"]
end

subgraph group_accounts["Accounts and access"]
  node_account_views["Account endpoints<br/>[views.py]"]
  node_account_serializers["Account validation<br/>[serializers.py]"]
  node_refresh_middleware["Token refresh<br/>[middleware.py]"]
end

subgraph group_quizzes["Quiz lifecycle"]
  node_quiz_views["Quiz and attempts<br/>[views.py]"]
  node_quiz_serializers["Quiz serialization<br/>[serializers.py]"]
  node_live_features["Live quiz and chat"]
end

subgraph group_persistence["Persistent data"]
  node_quiz_store[("Quiz records<br/>[models.py]")]
  node_otp_store[("OTP records<br/>[models.py]")]
end

node_client(("API client"))
node_email_delivery["Email delivery"]
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_root_routes
node_root_routes -->|"includes routes"| node_account_routes
node_root_routes -->|"includes routes"| node_quiz_routes
node_account_routes -->|"routes to"| node_account_views
node_quiz_routes -->|"routes to"| node_quiz_views
node_account_views -->|"validates with"| node_account_serializers
node_account_views -->|"reads and writes"| node_otp_store
node_account_views -->|"sends OTP"| node_email_delivery
node_account_views -.->|"sets token cookies"| node_refresh_middleware
node_quiz_views -->|"serializes data"| node_quiz_serializers
node_quiz_views -->|"reads and writes"| node_quiz_store
node_quiz_serializers -->|"maps records"| node_quiz_store
node_otp_store -.->|"persists in"| node_postgres
node_quiz_store -.->|"persists in"| node_postgres

click node_root_routes "https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiznet/urls.py"
click node_account_routes "https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/urls.py"
click node_quiz_routes "https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/urls.py"
click node_account_views "https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/views.py"
click node_account_serializers "https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/serializers.py"
click node_refresh_middleware "https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/middleware.py"
click node_quiz_views "https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/views.py"
click node_quiz_serializers "https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/serializers.py"
click node_quiz_store "https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/models.py"
click node_otp_store "https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/models.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_root_routes,node_account_routes,node_quiz_routes,node_client toneBlue
class node_account_views,node_account_serializers,node_refresh_middleware,node_postgres toneAmber
class node_quiz_views,node_quiz_serializers,node_live_features toneMint
class node_quiz_store,node_otp_store toneRose
class node_email_delivery toneIndigo
```

## Components

### API routing

- [Project routes](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiznet/urls.py): `quiznet/quiznet/urls.py`
- [Account routes](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/urls.py): `quiznet/account/urls.py`
- [Quiz routes](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/urls.py): `quiznet/quiz/urls.py`

### Accounts and access

- [Account endpoints](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/views.py): `quiznet/account/views.py`
- [Account validation](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/serializers.py): `quiznet/account/serializers.py`
- [Token refresh](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/middleware.py): `quiznet/account/middleware.py`

### Quiz lifecycle

- [Quiz and attempts](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/views.py): `quiznet/quiz/views.py`
- [Quiz serialization](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/serializers.py): `quiznet/quiz/serializers.py`
- **Live quiz and chat**

### Persistent data

- [Quiz records](https://github.com/quiznett/quiznet_server/blob/main/quiznet/quiz/models.py): `quiznet/quiz/models.py`
- [OTP records](https://github.com/quiznett/quiznet_server/blob/main/quiznet/account/models.py): `quiznet/account/models.py`

### Other components

- **API client**
- **Email delivery**
- **PostgreSQL**

## Connections

- API client → Project routes: sends requests (evidence: `quiznet/quiznet/urls.py`)
- Project routes → Account routes: includes routes (evidence: `quiznet/quiznet/urls.py`)
- Project routes → Quiz routes: includes routes (evidence: `quiznet/quiznet/urls.py`)
- Account routes → Account endpoints: routes to (evidence: `quiznet/account/urls.py`)
- Quiz routes → Quiz and attempts: routes to (evidence: `quiznet/quiz/urls.py`)
- Account endpoints → Account validation: validates with (evidence: `quiznet/account/views.py`)
- Account endpoints → OTP records: reads and writes (evidence: `quiznet/account/views.py`)
- Account endpoints → Email delivery: sends OTP (evidence: `quiznet/account/views.py`)
- Account endpoints → Token refresh: sets token cookies
- Quiz and attempts → Quiz serialization: serializes data (evidence: `quiznet/quiz/views.py`)
- Quiz and attempts → Quiz records: reads and writes (evidence: `quiznet/quiz/views.py`)
- Quiz serialization → Quiz records: maps records (evidence: `quiznet/quiz/serializers.py`)
- OTP records → PostgreSQL: persists in
- Quiz records → PostgreSQL: persists in
