# milind2k4/autoqp architecture

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

- Interactive diagram: https://gitdiagram.com/milind2k4/autoqp
- Repository: https://github.com/milind2k4/autoqp

## Overview

AutoQP is a centralized, AI-assisted exam question bank and LaTeX-to-PDF platform. Its principal workflow takes source material through question extraction or generation, human staging review, subject-scoped bank search, blueprint-based paper assembly, and compilation to PDF and raw LaTeX. The graph also includes authentication, shared question contracts, and the web/API boundary. The README documents the intended route-to-module split and isolated compiler; sampled route and compiler excerpts are empty, so detailed calls and storage interactions cannot be verified.

Main entry points: [`apps/web/app/page.tsx`](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/page.tsx) (Web application), [`apps/web/modules/intake/staging-review.ts`](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/staging-review.ts) (Staging review), [`apps/web/app/api/auth/route.ts`](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/auth/route.ts) (Auth API), [`apps/web/modules/compile/compile-paper.ts`](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/compile/compile-paper.ts) (Paper compilation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and API"]
  node_webapp["Web application<br/>[page.tsx]"]
  node_authapi["Auth API<br/>[route.ts]"]
  node_session["Session handling<br/>[session.ts]"]
  node_subjectaccess["Subject access<br/>[subject-access.ts]"]
  node_stagingapi["Staging API<br/>[route.ts]"]
  node_questionsapi["Questions API<br/>[route.ts]"]
  node_papersapi["Papers API<br/>[route.ts]"]
  node_compileapi["Compile API<br/>[route.ts]"]
end

subgraph group_intake["Question Intake"]
  node_intakeextract["Input extraction"]
  node_intakegenerate["Question generation"]
  node_staging["Staging review<br/>[staging-review.ts]"]
end

subgraph group_bank["Bank and Assembly"]
  node_search["Question search"]
  node_questioncard["Question card<br/>[QuestionCard.tsx]"]
  node_blueprint["Blueprint generation"]
  node_assembly["Paper assembly<br/>[assemble-paper.ts]"]
end

subgraph group_compile["Paper Compilation"]
  node_compilemodule["Paper compilation<br/>[compile-paper.ts]"]
  node_preview["Paper preview<br/>[PaperPreview.tsx]"]
  node_worker["Tectonic worker<br/>[compile.ts]"]
  node_template["LaTeX template<br/>[standard.tex.hbs]"]
end

subgraph group_shared["Shared Contracts"]
  node_questioncontract["Question schema<br/>[question.schema.ts]"]
end

node_user(("Exam staff"))

node_user -->|"uses"| node_webapp
node_webapp -.->|"requests auth"| node_authapi
node_authapi -->|"delegates auth"| node_session
node_webapp -.->|"submits intake"| node_stagingapi
node_stagingapi -->|"delegates review"| node_staging
node_webapp -.->|"requests questions"| node_questionsapi
node_questionsapi -->|"delegates search"| node_search
node_webapp -.->|"requests papers"| node_papersapi
node_papersapi -->|"delegates assembly"| node_assembly
node_webapp -.->|"requests compile"| node_compileapi
node_compileapi -->|"delegates compile"| node_compilemodule
node_intakeextract -.->|"stages questions"| node_staging
node_intakegenerate -.->|"stages questions"| node_staging
node_staging -.->|"uses contract"| node_questioncontract
node_search -.->|"feeds display"| node_questioncard
node_assembly -.->|"uses blueprint"| node_blueprint
node_compilemodule -->|"dispatches compile"| node_worker
node_worker -.->|"renders template"| node_template
node_compilemodule -.->|"provides preview"| node_preview
node_authapi -.->|"checks access"| node_subjectaccess

click node_webapp "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/page.tsx"
click node_authapi "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/auth/route.ts"
click node_session "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/auth/session.ts"
click node_subjectaccess "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/auth/subject-access.ts"
click node_stagingapi "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/staging/route.ts"
click node_questionsapi "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/questions/route.ts"
click node_papersapi "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/papers/route.ts"
click node_compileapi "https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/compile/route.ts"
click node_intakeextract "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/extract-from-input.ts"
click node_intakegenerate "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/generate-questions.ts"
click node_staging "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/staging-review.ts"
click node_search "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/search-questions.ts"
click node_questioncard "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/components/QuestionCard.tsx"
click node_blueprint "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/blueprint-generator.ts"
click node_assembly "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/assemble-paper.ts"
click node_compilemodule "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/compile/compile-paper.ts"
click node_preview "https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/compile/components/PaperPreview.tsx"
click node_worker "https://github.com/milind2k4/autoqp/blob/main/apps/compile-worker/src/compile.ts"
click node_template "https://github.com/milind2k4/autoqp/blob/main/apps/compile-worker/templates/standard.tex.hbs"
click node_questioncontract "https://github.com/milind2k4/autoqp/blob/main/packages/schema/src/question.schema.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_webapp,node_authapi,node_session,node_subjectaccess,node_stagingapi,node_questionsapi,node_papersapi,node_compileapi toneBlue
class node_intakeextract,node_intakegenerate,node_staging toneAmber
class node_search,node_questioncard,node_blueprint,node_assembly toneMint
class node_compilemodule,node_preview,node_worker,node_template toneRose
class node_questioncontract,node_user toneIndigo
```

## Components

### Web and API

- [Web application](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/page.tsx): `apps/web/app/page.tsx`
- [Auth API](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/auth/route.ts): `apps/web/app/api/auth/route.ts`
- [Session handling](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/auth/session.ts): `apps/web/modules/auth/session.ts`
- [Subject access](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/auth/subject-access.ts): `apps/web/modules/auth/subject-access.ts`
- [Staging API](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/staging/route.ts): `apps/web/app/api/staging/route.ts`
- [Questions API](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/questions/route.ts): `apps/web/app/api/questions/route.ts`
- [Papers API](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/papers/route.ts): `apps/web/app/api/papers/route.ts`
- [Compile API](https://github.com/milind2k4/autoqp/blob/main/apps/web/app/api/compile/route.ts): `apps/web/app/api/compile/route.ts`

### Question Intake

- [Input extraction](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/extract-from-input.ts): `apps/web/modules/intake/extract-from-input.ts`
- [Question generation](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/generate-questions.ts): `apps/web/modules/intake/generate-questions.ts`
- [Staging review](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/intake/staging-review.ts): `apps/web/modules/intake/staging-review.ts`

### Bank and Assembly

- [Question search](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/search-questions.ts): `apps/web/modules/bank/search-questions.ts`
- [Question card](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/components/QuestionCard.tsx): `apps/web/modules/bank/components/QuestionCard.tsx`
- [Blueprint generation](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/blueprint-generator.ts): `apps/web/modules/bank/blueprint-generator.ts`
- [Paper assembly](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/bank/assemble-paper.ts): `apps/web/modules/bank/assemble-paper.ts`

### Paper Compilation

- [Paper compilation](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/compile/compile-paper.ts): `apps/web/modules/compile/compile-paper.ts`
- [Paper preview](https://github.com/milind2k4/autoqp/blob/main/apps/web/modules/compile/components/PaperPreview.tsx): `apps/web/modules/compile/components/PaperPreview.tsx`
- [Tectonic worker](https://github.com/milind2k4/autoqp/blob/main/apps/compile-worker/src/compile.ts): `apps/compile-worker/src/compile.ts`
- [LaTeX template](https://github.com/milind2k4/autoqp/blob/main/apps/compile-worker/templates/standard.tex.hbs): `apps/compile-worker/templates/standard.tex.hbs`

### Shared Contracts

- [Question schema](https://github.com/milind2k4/autoqp/blob/main/packages/schema/src/question.schema.ts): `packages/schema/src/question.schema.ts`

### Other components

- **Exam staff**

## Connections

- Exam staff → Web application: uses (evidence: `README.md`)
- Web application → Auth API: requests auth
- Auth API → Session handling: delegates auth (evidence: `README.md`)
- Web application → Staging API: submits intake
- Staging API → Staging review: delegates review (evidence: `README.md`)
- Web application → Questions API: requests questions
- Questions API → Question search: delegates search (evidence: `README.md`)
- Web application → Papers API: requests papers
- Papers API → Paper assembly: delegates assembly (evidence: `README.md`)
- Web application → Compile API: requests compile
- Compile API → Paper compilation: delegates compile (evidence: `README.md`)
- Input extraction → Staging review: stages questions
- Question generation → Staging review: stages questions
- Staging review → Question schema: uses contract
- Question search → Question card: feeds display
- Paper assembly → Blueprint generation: uses blueprint
- Paper compilation → Tectonic worker: dispatches compile (evidence: `README.md`)
- Tectonic worker → LaTeX template: renders template
- Paper compilation → Paper preview: provides preview
- Auth API → Subject access: checks access
