# tqaiken/modo-platform architecture

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

- Interactive diagram: https://gitdiagram.com/tqaiken/modo-platform
- Repository: https://github.com/tqaiken/modo-platform

## Overview

TestForge is a role-based platform for authoring, reviewing, publishing, and exporting test-question variants. Developers create variants and bilingual questions; verifiers review submissions; curators publish approved material to the bank and request ZIP exports. The React application routes users by role and calls a FastAPI API backed by relational models and optional Cloudflare R2 media storage. The README documents capabilities not fully visible in sampled excerpts; those subsystems are included, while their internal call relationships are omitted where source evidence is unavailable.

Main entry points: [`frontend/src/App.tsx`](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/App.tsx) (Role-based pages), [`backend/app/main.py`](https://github.com/tqaiken/modo-platform/blob/main/backend/app/main.py) (FastAPI router), [`frontend/src/services/api.ts`](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/services/api.ts) (API client), [`backend/app/core/database.py`](https://github.com/tqaiken/modo-platform/blob/main/backend/app/core/database.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Role-based pages<br/>[App.tsx]"]
  node_authctx["Session context<br/>[AuthContext.tsx]"]
  node_editor["Question editor"]
  node_markdown["Markdown editor<br/>[MarkdownEditor.tsx]"]
  node_developer["Developer workspace<br/>[DeveloperPage.tsx]"]
  node_verifier["Verification workspace<br/>[VerifierPage.tsx]"]
  node_curator["Curator workspace<br/>[CuratorPage.tsx]"]
  node_variantdetail["Variant details"]
  node_admin["Administration<br/>[SuperAdminPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API workflows"]
  node_api_app["FastAPI router<br/>[main.py]"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_variant_api["Variant workflow<br/>[variants.py]"]
  node_question_api["Question workflow<br/>[questions.py]"]
  node_objective_api["Learning objectives"]
  node_media_api["Media endpoints<br/>[media.py]"]
  node_export_api["Export endpoint<br/>[export.py]"]
  node_subject_api["Subject endpoints<br/>[subjects.py]"]
end

subgraph group_domain["Question domain"]
  node_variant[("Variant records<br/>[variant.py]")]
  node_question[("Question records<br/>[question.py]")]
  node_schemas["Question schemas<br/>[question.py]"]
  node_users[("User records<br/>[user.py]")]
end

subgraph group_platform["Platform services"]
  node_database[("Database sessions<br/>[database.py]")]
  node_security["JWT and roles<br/>[security.py]"]
  node_r2["R2 media storage<br/>[r2.py]"]
  node_pdf["PDF export<br/>[export_pdf.py]"]
  node_xlsx["XLSX export<br/>[export_xlsx.py]"]
end

node_user(("Platform user"))
node_r2service[("Cloudflare R2")]
node_clientbrowser(("Browser"))

node_user -->|"uses"| node_web
node_web -->|"checks session"| node_authctx
node_web -->|"routes to"| node_editor
node_web -->|"routes to"| node_developer
node_web -->|"routes to"| node_verifier
node_web -->|"routes to"| node_curator
node_web -->|"routes to"| node_variantdetail
node_web -->|"routes to"| node_admin
node_authctx -->|"requests identity"| node_api_client
node_editor -->|"renders"| node_markdown
node_editor -->|"sends edits"| node_api_client
node_developer -->|"requests variants"| node_api_client
node_verifier -->|"requests reviews"| node_api_client
node_curator -->|"requests exports"| node_api_client
node_variantdetail -->|"loads variant"| node_api_client
node_admin -->|"manages users"| node_api_client
node_api_client -->|"HTTP requests"| node_clientbrowser
node_clientbrowser -.->|"calls API"| node_api_app
node_api_app -->|"registers router"| node_auth_api
node_api_app -->|"registers router"| node_variant_api
node_api_app -->|"registers router"| node_question_api
node_api_app -->|"registers router"| node_objective_api
node_api_app -->|"registers router"| node_media_api
node_api_app -->|"registers router"| node_export_api
node_api_app -->|"registers router"| node_subject_api
node_auth_api -->|"authenticates users"| node_security
node_auth_api -->|"queries users"| node_database
node_variant_api -->|"reads and writes"| node_variant
node_variant_api -->|"manages questions"| node_question
node_question_api -->|"reads and writes"| node_question
node_question_api -->|"validates payloads"| node_schemas
node_variant_api -->|"validates payloads"| node_schemas
node_variant_api -.->|"checks roles"| node_security
node_objective_api -.->|"uses sessions"| node_database
node_media_api -->|"stores media"| node_r2
node_export_api -->|"generates PDF"| node_pdf
node_export_api -->|"generates XLSX"| node_xlsx
node_export_api -->|"collects media"| node_r2
node_r2 -.->|"stores files"| node_r2service
node_question -->|"persists"| node_database
node_variant -->|"persists"| node_database
node_users -->|"persists"| node_database
node_security -->|"loads user"| node_users
node_security -->|"gets session"| node_database

click node_web "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/App.tsx"
click node_authctx "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_editor "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/QuestionEditorPage.tsx"
click node_markdown "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/components/editor/MarkdownEditor.tsx"
click node_developer "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/DeveloperPage.tsx"
click node_verifier "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/VerifierPage.tsx"
click node_curator "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/CuratorPage.tsx"
click node_variantdetail "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/VariantDetailPage.tsx"
click node_admin "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/SuperAdminPage.tsx"
click node_api_client "https://github.com/tqaiken/modo-platform/blob/main/frontend/src/services/api.ts"
click node_api_app "https://github.com/tqaiken/modo-platform/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/auth.py"
click node_variant_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/variants.py"
click node_question_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/questions.py"
click node_objective_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/learning_objectives.py"
click node_media_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/media.py"
click node_export_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/export.py"
click node_subject_api "https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/subjects.py"
click node_variant "https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/variant.py"
click node_question "https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/question.py"
click node_schemas "https://github.com/tqaiken/modo-platform/blob/main/backend/app/schemas/question.py"
click node_users "https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/user.py"
click node_database "https://github.com/tqaiken/modo-platform/blob/main/backend/app/core/database.py"
click node_security "https://github.com/tqaiken/modo-platform/blob/main/backend/app/core/security.py"
click node_r2 "https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/r2.py"
click node_pdf "https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/export_pdf.py"
click node_xlsx "https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/export_xlsx.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_web,node_authctx,node_editor,node_markdown,node_developer,node_verifier,node_curator,node_variantdetail,node_admin,node_api_client,node_user,node_clientbrowser toneBlue
class node_api_app,node_auth_api,node_variant_api,node_question_api,node_objective_api,node_media_api,node_export_api,node_subject_api,node_r2service toneAmber
class node_variant,node_question,node_schemas,node_users toneMint
class node_database,node_security,node_r2,node_pdf,node_xlsx toneRose
```

## Components

### Web client

- [Role-based pages](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session context](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [Question editor](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/QuestionEditorPage.tsx): `frontend/src/pages/QuestionEditorPage.tsx`
- [Markdown editor](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/components/editor/MarkdownEditor.tsx): `frontend/src/components/editor/MarkdownEditor.tsx`
- [Developer workspace](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/DeveloperPage.tsx): `frontend/src/pages/DeveloperPage.tsx`
- [Verification workspace](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/VerifierPage.tsx): `frontend/src/pages/VerifierPage.tsx`
- [Curator workspace](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/CuratorPage.tsx): `frontend/src/pages/CuratorPage.tsx`
- [Variant details](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/VariantDetailPage.tsx): `frontend/src/pages/VariantDetailPage.tsx`
- [Administration](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/pages/SuperAdminPage.tsx): `frontend/src/pages/SuperAdminPage.tsx`
- [API client](https://github.com/tqaiken/modo-platform/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API workflows

- [FastAPI router](https://github.com/tqaiken/modo-platform/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Variant workflow](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/variants.py): `backend/app/api/v1/variants.py`
- [Question workflow](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/questions.py): `backend/app/api/v1/questions.py`
- [Learning objectives](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/learning_objectives.py): `backend/app/api/v1/learning_objectives.py`
- [Media endpoints](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/media.py): `backend/app/api/v1/media.py`
- [Export endpoint](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/export.py): `backend/app/api/v1/export.py`
- [Subject endpoints](https://github.com/tqaiken/modo-platform/blob/main/backend/app/api/v1/subjects.py): `backend/app/api/v1/subjects.py`

### Question domain

- [Variant records](https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/variant.py): `backend/app/models/variant.py`
- [Question records](https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/question.py): `backend/app/models/question.py`
- [Question schemas](https://github.com/tqaiken/modo-platform/blob/main/backend/app/schemas/question.py): `backend/app/schemas/question.py`
- [User records](https://github.com/tqaiken/modo-platform/blob/main/backend/app/models/user.py): `backend/app/models/user.py`

### Platform services

- [Database sessions](https://github.com/tqaiken/modo-platform/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [JWT and roles](https://github.com/tqaiken/modo-platform/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [R2 media storage](https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/r2.py): `backend/app/services/r2.py`
- [PDF export](https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/export_pdf.py): `backend/app/services/export_pdf.py`
- [XLSX export](https://github.com/tqaiken/modo-platform/blob/main/backend/app/services/export_xlsx.py): `backend/app/services/export_xlsx.py`

### Other components

- **Platform user**
- **Cloudflare R2**
- **Browser**

## Connections

- Platform user → Role-based pages: uses (evidence: `README.md`)
- Role-based pages → Session context: checks session (evidence: `frontend/src/App.tsx`)
- Role-based pages → Question editor: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Developer workspace: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Verification workspace: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Curator workspace: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Variant details: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Administration: routes to (evidence: `frontend/src/App.tsx`)
- Session context → API client: requests identity (evidence: `frontend/src/contexts/AuthContext.tsx`)
- Question editor → Markdown editor: renders (evidence: `frontend/src/pages/QuestionEditorPage.tsx`)
- Question editor → API client: sends edits (evidence: `frontend/src/pages/QuestionEditorPage.tsx`)
- Developer workspace → API client: requests variants (evidence: `frontend/src/pages/DeveloperPage.tsx`)
- Verification workspace → API client: requests reviews (evidence: `frontend/src/pages/VerifierPage.tsx`)
- Curator workspace → API client: requests exports (evidence: `frontend/src/pages/CuratorPage.tsx`)
- Variant details → API client: loads variant (evidence: `frontend/src/pages/VariantDetailPage.tsx`)
- Administration → API client: manages users (evidence: `frontend/src/pages/SuperAdminPage.tsx`)
- API client → Browser: HTTP requests (evidence: `frontend/src/services/api.ts`)
- Browser → FastAPI router: calls API
- FastAPI router → Authentication: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Variant workflow: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Question workflow: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Learning objectives: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Media endpoints: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Export endpoint: registers router (evidence: `backend/app/main.py`)
- FastAPI router → Subject endpoints: registers router (evidence: `backend/app/main.py`)
- Authentication → JWT and roles: authenticates users (evidence: `backend/app/api/v1/auth.py`)
- Authentication → Database sessions: queries users (evidence: `backend/app/api/v1/auth.py`)
- Variant workflow → Variant records: reads and writes (evidence: `backend/app/api/v1/variants.py`)
- Variant workflow → Question records: manages questions (evidence: `backend/app/api/v1/variants.py`)
- Question workflow → Question records: reads and writes (evidence: `backend/app/api/v1/questions.py`)
- Question workflow → Question schemas: validates payloads (evidence: `backend/app/api/v1/questions.py`)
- Variant workflow → Question schemas: validates payloads (evidence: `backend/app/api/v1/variants.py`)
- Variant workflow → JWT and roles: checks roles (evidence: `backend/app/api/v1/variants.py`)
- Learning objectives → Database sessions: uses sessions (evidence: `backend/app/api/v1/learning_objectives.py`)
- Media endpoints → R2 media storage: stores media (evidence: `backend/app/api/v1/media.py`)
- Export endpoint → PDF export: generates PDF (evidence: `backend/app/api/v1/export.py`)
- Export endpoint → XLSX export: generates XLSX (evidence: `backend/app/api/v1/export.py`)
- Export endpoint → R2 media storage: collects media (evidence: `backend/app/api/v1/export.py`)
- R2 media storage → Cloudflare R2: stores files
- Question records → Database sessions: persists (evidence: `backend/app/models/question.py`)
- Variant records → Database sessions: persists (evidence: `backend/app/models/variant.py`)
- User records → Database sessions: persists (evidence: `backend/app/models/user.py`)
- JWT and roles → User records: loads user (evidence: `backend/app/core/security.py`)
- JWT and roles → Database sessions: gets session (evidence: `backend/app/core/security.py`)
