# glctelc-stack/telc-model-test architecture

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

- Interactive diagram: https://gitdiagram.com/glctelc-stack/telc-model-test
- Repository: https://github.com/glctelc-stack/telc-model-test

## Overview

TELC Digital Examination Portal supports staff exam authoring and digitization, student online/offline exam delivery, and administrator oversight. The main student workflow runs from authentication and test-code access through timed exam taking, submission, server-side evaluation, and reviewed results. Official Safe Exam Browser packages and offline synchronization form a distinct delivery path; staff scanning, exam management, analytics, and administration are additional capabilities. Edges are limited to relationships documented in the README or visible in cited excerpts/index; unsampled router and page behavior is not inferred.

Main entry points: [`backend/main.py`](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/main.py) (FastAPI application), [`backend/database.py`](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/database.py) (Relational database), [`frontend/src/App.tsx`](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/App.tsx) (Role-based portal), [`frontend/src/services/api.ts`](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend experience"]
  node_spa["Role-based portal<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_student_pages["Student exam pages"]
  node_official_runtime["Official exam runtime"]
  node_offline_storage[("Offline session storage<br/>[offlineStorage.ts]")]
  node_offline_crypto["Offline cryptography<br/>[offlineCrypto.ts]"]
end

subgraph group_delivery["Exam delivery"]
  node_level_configs["CEFR level configuration"]
  node_exam_routes["Exam authoring and access<br/>[exams.py]"]
  node_student_routes["Student sessions<br/>[student.py]"]
  node_seb_routes["SEB packages and results<br/>[seb.py]"]
  node_audio_routes["Audio delivery<br/>[audio.py]"]
end

subgraph group_operations["Staff and administration"]
  node_scan_ui["Paper scanner interface"]
  node_scanner_progress["Scanner progress display"]
  node_scanner_routes["Scanner API<br/>[scanner.py]"]
  node_exam_manager["Exam management"]
  node_admin_pages["Administration pages"]
  node_analytics_page["Analytics dashboard"]
  node_admin_routes["Admin and analytics APIs<br/>[admin.py]"]
  node_analytics_routes["Analytics API<br/>[analytics.py]"]
  node_review_routes["Staff result review<br/>[reviews.py]"]
end

subgraph group_evaluation["Evaluation and scanning"]
  node_scanner_service["AI paper extraction<br/>[ai_scanner.py]"]
  node_evaluation_pipeline["Official evaluation pipeline"]
  node_ai_grader["AI writing grader<br/>[ai_grader.py]"]
  node_gemini["Gemini integration<br/>[gemini_client.py]"]
end

subgraph group_platform["Backend platform"]
  node_auth["Authentication and access<br/>[auth_utils.py]"]
  node_database[("Relational database<br/>[database.py]")]
  node_models["Exam and session models<br/>[models.py]"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_object_storage["Audio object storage<br/>[audio_storage.py]"]
end

node_student(("Student"))
node_staff(("Staff / examiner"))
node_admin(("Administrator"))
node_storage_provider[("S3 / R2 or local storage")]

node_student -->|"uses"| node_spa
node_staff -->|"uses"| node_spa
node_admin -->|"uses"| node_spa
node_spa -->|"routes to"| node_student_pages
node_spa -->|"routes to"| node_scan_ui
node_spa -->|"routes to"| node_admin_pages
node_spa -->|"routes to"| node_analytics_page
node_student_pages -.->|"requests"| node_api_client
node_student_pages -->|"uses"| node_official_runtime
node_official_runtime -->|"persists session"| node_offline_storage
node_offline_storage -->|"decrypts data"| node_offline_crypto
node_scan_ui -->|"starts scans"| node_api_client
node_scan_ui -->|"renders"| node_scanner_progress
node_exam_manager -->|"requests"| node_api_client
node_admin_pages -->|"requests"| node_api_client
node_analytics_page -.->|"requests"| node_api_client
node_api_client -.->|"HTTP requests"| node_api_app
node_api_app -->|"mounts auth routes"| node_auth
node_api_app -->|"mounts exam routes"| node_exam_routes
node_api_app -->|"mounts student routes"| node_student_routes
node_api_app -->|"mounts SEB routes"| node_seb_routes
node_api_app -->|"mounts scanner routes"| node_scanner_routes
node_api_app -->|"mounts audio routes"| node_audio_routes
node_api_app -->|"mounts analytics routes"| node_analytics_routes
node_api_app -->|"mounts admin routes"| node_admin_routes
node_api_app -->|"mounts review routes"| node_review_routes
node_auth -->|"queries users"| node_database
node_student_routes -->|"uses grader"| node_evaluation_pipeline
node_seb_routes -->|"uses pipeline"| node_evaluation_pipeline
node_evaluation_pipeline -->|"grades writing"| node_ai_grader
node_ai_grader -->|"calls"| node_gemini
node_scanner_routes -->|"invokes extraction"| node_scanner_service
node_scanner_routes -->|"uses client"| node_gemini
node_scanner_service -.->|"uses model"| node_gemini
node_student_routes -->|"loads level rules"| node_level_configs
node_evaluation_pipeline -->|"loads level rules"| node_level_configs
node_level_configs -.->|"defines domain inputs"| node_models
node_exam_routes -.->|"persists exams"| node_database
node_student_routes -.->|"persists sessions"| node_database
node_seb_routes -->|"reads and writes"| node_database
node_evaluation_pipeline -->|"reads and writes"| node_database
node_admin_routes -.->|"manages records"| node_database
node_analytics_routes -.->|"queries metrics"| node_database
node_review_routes -->|"reads and writes"| node_database
node_database -->|"provides ORM base"| node_models
node_audio_routes -.->|"stores audio"| node_object_storage
node_object_storage -.->|"uses provider"| node_storage_provider

click node_spa "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/api.ts"
click node_student_pages "https://github.com/glctelc-stack/telc-model-test/tree/main/frontend/src/pages/student"
click node_official_runtime "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/officialExamRuntime.ts"
click node_offline_storage "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/offlineStorage.ts"
click node_offline_crypto "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/offlineCrypto.ts"
click node_level_configs "https://github.com/glctelc-stack/telc-model-test/tree/main/backend/levels"
click node_auth "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/auth_utils.py"
click node_exam_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/exams.py"
click node_student_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/student.py"
click node_seb_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/seb.py"
click node_audio_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/audio.py"
click node_scan_ui "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/pages/staff/PaperScannerPage.tsx"
click node_scanner_progress "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/components/ScannerProgressIndicator.tsx"
click node_scanner_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/scanner.py"
click node_scanner_service "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/ai_scanner.py"
click node_exam_manager "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/components/staff/OfficialExamManager.tsx"
click node_admin_pages "https://github.com/glctelc-stack/telc-model-test/tree/main/frontend/src/pages/admin"
click node_analytics_page "https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/pages/staff/AnalyticsDashboard.tsx"
click node_admin_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/admin.py"
click node_analytics_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/analytics.py"
click node_review_routes "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/reviews.py"
click node_evaluation_pipeline "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/evaluation_pipeline.py"
click node_ai_grader "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/ai_grader.py"
click node_gemini "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/gemini_client.py"
click node_database "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/database.py"
click node_models "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/models.py"
click node_api_app "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/main.py"
click node_object_storage "https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/audio_storage.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_spa,node_api_client,node_student_pages,node_official_runtime,node_offline_storage,node_offline_crypto toneBlue
class node_level_configs,node_exam_routes,node_student_routes,node_seb_routes,node_audio_routes,node_storage_provider toneAmber
class node_scan_ui,node_scanner_progress,node_scanner_routes,node_exam_manager,node_admin_pages,node_analytics_page,node_admin_routes,node_analytics_routes,node_review_routes toneMint
class node_scanner_service,node_evaluation_pipeline,node_ai_grader,node_gemini toneRose
class node_auth,node_database,node_models,node_api_app,node_object_storage,node_student,node_staff,node_admin toneIndigo
```

## Components

### Frontend experience

- [Role-based portal](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Student exam pages](https://github.com/glctelc-stack/telc-model-test/tree/main/frontend/src/pages/student): `frontend/src/pages/student`
- [Official exam runtime](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/officialExamRuntime.ts): `frontend/src/services/officialExamRuntime.ts`
- [Offline session storage](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/offlineStorage.ts): `frontend/src/services/offlineStorage.ts`
- [Offline cryptography](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/services/offlineCrypto.ts): `frontend/src/services/offlineCrypto.ts`

### Exam delivery

- [CEFR level configuration](https://github.com/glctelc-stack/telc-model-test/tree/main/backend/levels): `backend/levels`
- [Exam authoring and access](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/exams.py): `backend/routers/exams.py`
- [Student sessions](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/student.py): `backend/routers/student.py`
- [SEB packages and results](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/seb.py): `backend/routers/seb.py`
- [Audio delivery](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/audio.py): `backend/routers/audio.py`

### Staff and administration

- [Paper scanner interface](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/pages/staff/PaperScannerPage.tsx): `frontend/src/pages/staff/PaperScannerPage.tsx`
- [Scanner progress display](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/components/ScannerProgressIndicator.tsx): `frontend/src/components/ScannerProgressIndicator.tsx`
- [Scanner API](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/scanner.py): `backend/routers/scanner.py`
- [Exam management](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/components/staff/OfficialExamManager.tsx): `frontend/src/components/staff/OfficialExamManager.tsx`
- [Administration pages](https://github.com/glctelc-stack/telc-model-test/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Analytics dashboard](https://github.com/glctelc-stack/telc-model-test/blob/main/frontend/src/pages/staff/AnalyticsDashboard.tsx): `frontend/src/pages/staff/AnalyticsDashboard.tsx`
- [Admin and analytics APIs](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/admin.py): `backend/routers/admin.py`
- [Analytics API](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/analytics.py): `backend/routers/analytics.py`
- [Staff result review](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/routers/reviews.py): `backend/routers/reviews.py`

### Evaluation and scanning

- [AI paper extraction](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/ai_scanner.py): `backend/services/ai_scanner.py`
- [Official evaluation pipeline](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/evaluation_pipeline.py): `backend/services/evaluation_pipeline.py`
- [AI writing grader](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/ai_grader.py): `backend/services/ai_grader.py`
- [Gemini integration](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/gemini_client.py): `backend/services/gemini_client.py`

### Backend platform

- [Authentication and access](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/auth_utils.py): `backend/auth_utils.py`
- [Relational database](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/database.py): `backend/database.py`
- [Exam and session models](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/models.py): `backend/models.py`
- [FastAPI application](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/main.py): `backend/main.py`
- [Audio object storage](https://github.com/glctelc-stack/telc-model-test/blob/main/backend/services/audio_storage.py): `backend/services/audio_storage.py`

### Other components

- **Student**
- **Staff / examiner**
- **Administrator**
- **S3 / R2 or local storage**

## Connections

- Student → Role-based portal: uses
- Staff / examiner → Role-based portal: uses
- Administrator → Role-based portal: uses
- Role-based portal → Student exam pages: routes to (evidence: `frontend/src/App.tsx`)
- Role-based portal → Paper scanner interface: routes to (evidence: `frontend/src/App.tsx`)
- Role-based portal → Administration pages: routes to (evidence: `frontend/src/App.tsx`)
- Role-based portal → Analytics dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Student exam pages → API client: requests
- Student exam pages → Official exam runtime: uses (evidence: `frontend/src/pages/student/OfficialExamTakingPage.tsx`)
- Official exam runtime → Offline session storage: persists session (evidence: `frontend/src/pages/student/OfficialExamTakingPage.tsx`)
- Offline session storage → Offline cryptography: decrypts data (evidence: `frontend/src/services/offlineStorage.ts`)
- Paper scanner interface → API client: starts scans (evidence: `frontend/src/pages/staff/PaperScannerPage.tsx`)
- Paper scanner interface → Scanner progress display: renders (evidence: `frontend/src/pages/staff/PaperScannerPage.tsx`)
- Exam management → API client: requests (evidence: `frontend/src/components/staff/OfficialExamManager.tsx`)
- Administration pages → API client: requests (evidence: `frontend/src/pages/admin/ClassesGroupsPage.tsx`)
- Analytics dashboard → API client: requests
- API client → FastAPI application: HTTP requests
- FastAPI application → Authentication and access: mounts auth routes (evidence: `backend/main.py`)
- FastAPI application → Exam authoring and access: mounts exam routes (evidence: `backend/main.py`)
- FastAPI application → Student sessions: mounts student routes (evidence: `backend/main.py`)
- FastAPI application → SEB packages and results: mounts SEB routes (evidence: `backend/main.py`)
- FastAPI application → Scanner API: mounts scanner routes (evidence: `backend/main.py`)
- FastAPI application → Audio delivery: mounts audio routes (evidence: `backend/main.py`)
- FastAPI application → Analytics API: mounts analytics routes (evidence: `backend/main.py`)
- FastAPI application → Admin and analytics APIs: mounts admin routes (evidence: `backend/main.py`)
- FastAPI application → Staff result review: mounts review routes (evidence: `backend/main.py`)
- Authentication and access → Relational database: queries users (evidence: `backend/auth_utils.py`)
- Student sessions → Official evaluation pipeline: uses grader (evidence: `backend/routers/student.py`)
- SEB packages and results → Official evaluation pipeline: uses pipeline (evidence: `backend/routers/seb.py`)
- Official evaluation pipeline → AI writing grader: grades writing (evidence: `backend/services/evaluation_pipeline.py`)
- AI writing grader → Gemini integration: calls (evidence: `backend/services/ai_grader.py`)
- Scanner API → AI paper extraction: invokes extraction (evidence: `backend/routers/scanner.py`)
- Scanner API → Gemini integration: uses client (evidence: `backend/routers/scanner.py`)
- AI paper extraction → Gemini integration: uses model
- Student sessions → CEFR level configuration: loads level rules (evidence: `backend/routers/student.py`)
- Official evaluation pipeline → CEFR level configuration: loads level rules (evidence: `backend/services/evaluation_pipeline.py`)
- CEFR level configuration → Exam and session models: defines domain inputs · Inferred; not shown in the code that was read.
- Exam authoring and access → Relational database: persists exams
- Student sessions → Relational database: persists sessions (evidence: `backend/routers/student.py`)
- SEB packages and results → Relational database: reads and writes (evidence: `backend/routers/seb.py`)
- Official evaluation pipeline → Relational database: reads and writes (evidence: `backend/services/evaluation_pipeline.py`)
- Admin and analytics APIs → Relational database: manages records
- Analytics API → Relational database: queries metrics
- Staff result review → Relational database: reads and writes (evidence: `backend/routers/reviews.py`)
- Relational database → Exam and session models: provides ORM base (evidence: `backend/models.py`)
- Audio delivery → Audio object storage: stores audio
- Audio object storage → S3 / R2 or local storage: uses provider
