# coe26-qp/question-paper-automation architecture

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

- Interactive diagram: https://gitdiagram.com/coe26-qp/question-paper-automation
- Repository: https://github.com/coe26-qp/question-paper-automation

## Overview

This is a question-paper automation system with separate exam-cell and external-faculty interfaces, an Express/MongoDB backend, and a Python service. The main workflow is exam-cell staff uploading and assigning a question bank, faculty reviewing or adding questions, and generating, previewing, and exporting patterned papers. The graph preserves those distinct stages and the question-bank, external-question, and paper state layers. Some routes and integrations are unsampled; their connections are omitted where the available excerpts and index do not establish them.

Main entry points: [`frontend/external-frontend/src/App.jsx`](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/App.jsx) (Faculty routes), [`backend/src/controllers/questionBankController.js`](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/questionBankController.js) (Bank management), [`backend/src/controllers/externalQuestionBankController.js`](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/externalQuestionBankController.js) (External bank handling), [`frontend/exam-cell-frontend/src/App.jsx`](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/App.jsx) (Exam-cell routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exam_ui["Exam-cell interface"]
  node_exam_app["Exam-cell routes<br/>[App.jsx]"]
  node_bank_upload["Upload bank"]
  node_exam_preview["Paper preview"]
end

subgraph group_faculty_ui["Faculty interface"]
  node_faculty_app["Faculty routes<br/>[App.jsx]"]
  node_faculty_bank["Bank review"]
  node_add_question["Add question<br/>[AddQuestion.jsx]"]
  node_paper_preview["Paper preview"]
  node_section_views["Pattern sections"]
end

subgraph group_api["Backend API"]
  node_api_app["API router<br/>[app.js]"]
  node_bank_routes["Bank routes"]
  node_bank_controller["Bank management"]
  node_external_bank_routes["External bank routes"]
  node_external_bank_controller["External bank handling"]
  node_preview_controller["Question preview"]
end

subgraph group_generation["Paper generation"]
  node_paper_controller["Paper orchestration"]
  node_pattern_services["Pattern generators"]
end

subgraph group_data["Domain data"]
  node_question_bank[("Question bank<br/>[QuestionBank.js]")]
  node_external_question[("External questions")]
  node_external_access[("Faculty access<br/>[ExternalAccess.js]")]
  node_question_paper[("Generated papers<br/>[QuestionPaper.js]")]
end

node_exam_actor(("Exam-cell staff"))
node_faculty_actor(("External faculty"))

node_exam_actor -->|"uses"| node_exam_app
node_exam_app -->|"routes to"| node_bank_upload
node_exam_app -->|"routes to"| node_exam_preview
node_faculty_actor -->|"uses"| node_faculty_app
node_faculty_app -->|"routes to"| node_faculty_bank
node_faculty_app -->|"routes to"| node_add_question
node_faculty_app -->|"routes to"| node_paper_preview
node_paper_preview -->|"renders"| node_section_views
node_api_app -->|"mounts"| node_bank_routes
node_bank_routes -->|"dispatches"| node_bank_controller
node_api_app -->|"mounts"| node_external_bank_routes
node_external_bank_routes -->|"dispatches"| node_external_bank_controller
node_bank_controller -->|"reads/writes"| node_question_bank
node_bank_controller -->|"creates"| node_external_access
node_bank_controller -->|"reads"| node_question_paper
node_external_bank_controller -->|"reads"| node_external_access
node_external_bank_controller -->|"reads"| node_question_bank
node_external_bank_controller -->|"uses"| node_external_question
node_preview_controller -->|"reads"| node_external_access
node_preview_controller -->|"reads"| node_question_bank
node_paper_controller -->|"invokes"| node_pattern_services
node_paper_controller -->|"reads/writes"| node_question_paper
node_pattern_services -->|"reads"| node_external_question

click node_exam_app "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/App.jsx"
click node_bank_upload "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/pages/UploadQuestionBank.jsx"
click node_exam_preview "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/components/ExamCellPaperPreview.jsx"
click node_faculty_app "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/App.jsx"
click node_faculty_bank "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/ExternalQuestionBank.jsx"
click node_add_question "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/AddQuestion.jsx"
click node_paper_preview "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/GeneratedQuestionPaperPreview.jsx"
click node_section_views "https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/components/R24/IA1PartAGeneratedSection.jsx"
click node_api_app "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/app.js"
click node_bank_routes "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/routes/questionBankRoutes.js"
click node_bank_controller "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/questionBankController.js"
click node_external_bank_routes "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/routes/externalQuestionBankRoutes.js"
click node_external_bank_controller "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/externalQuestionBankController.js"
click node_preview_controller "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/externalQuestionPreviewController.js"
click node_paper_controller "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/paperGenerationController.js"
click node_pattern_services "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/services/R24/IA1paperGenerationService.js"
click node_question_bank "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/QuestionBank.js"
click node_external_question "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/ExternalQuestion.js"
click node_external_access "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/ExternalAccess.js"
click node_question_paper "https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/QuestionPaper.js"

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_exam_app,node_bank_upload,node_exam_preview toneBlue
class node_faculty_app,node_faculty_bank,node_add_question,node_paper_preview,node_section_views toneAmber
class node_api_app,node_bank_routes,node_bank_controller,node_external_bank_routes,node_external_bank_controller,node_preview_controller toneMint
class node_paper_controller,node_pattern_services toneRose
class node_question_bank,node_external_question,node_external_access,node_question_paper,node_exam_actor,node_faculty_actor toneIndigo
```

## Components

### Exam-cell interface

- [Exam-cell routes](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/App.jsx): `frontend/exam-cell-frontend/src/App.jsx`
- [Upload bank](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/pages/UploadQuestionBank.jsx): `frontend/exam-cell-frontend/src/pages/UploadQuestionBank.jsx`
- [Paper preview](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/exam-cell-frontend/src/components/ExamCellPaperPreview.jsx): `frontend/exam-cell-frontend/src/components/ExamCellPaperPreview.jsx`

### Faculty interface

- [Faculty routes](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/App.jsx): `frontend/external-frontend/src/App.jsx`
- [Bank review](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/ExternalQuestionBank.jsx): `frontend/external-frontend/src/pages/ExternalQuestionBank.jsx`
- [Add question](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/AddQuestion.jsx): `frontend/external-frontend/src/pages/AddQuestion.jsx`
- [Paper preview](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/pages/GeneratedQuestionPaperPreview.jsx): `frontend/external-frontend/src/pages/GeneratedQuestionPaperPreview.jsx`
- [Pattern sections](https://github.com/coe26-qp/question-paper-automation/blob/main/frontend/external-frontend/src/components/R24/IA1PartAGeneratedSection.jsx): `frontend/external-frontend/src/components/R24/IA1PartAGeneratedSection.jsx`

### Backend API

- [API router](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/app.js): `backend/src/app.js`
- [Bank routes](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/routes/questionBankRoutes.js): `backend/src/routes/questionBankRoutes.js`
- [Bank management](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/questionBankController.js): `backend/src/controllers/questionBankController.js`
- [External bank routes](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/routes/externalQuestionBankRoutes.js): `backend/src/routes/externalQuestionBankRoutes.js`
- [External bank handling](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/externalQuestionBankController.js): `backend/src/controllers/externalQuestionBankController.js`
- [Question preview](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/externalQuestionPreviewController.js): `backend/src/controllers/externalQuestionPreviewController.js`

### Paper generation

- [Paper orchestration](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/controllers/paperGenerationController.js): `backend/src/controllers/paperGenerationController.js`
- [Pattern generators](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/services/R24/IA1paperGenerationService.js): `backend/src/services/R24/IA1paperGenerationService.js`

### Domain data

- [Question bank](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/QuestionBank.js): `backend/src/models/QuestionBank.js`
- [External questions](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/ExternalQuestion.js): `backend/src/models/ExternalQuestion.js`
- [Faculty access](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/ExternalAccess.js): `backend/src/models/ExternalAccess.js`
- [Generated papers](https://github.com/coe26-qp/question-paper-automation/blob/main/backend/src/models/QuestionPaper.js): `backend/src/models/QuestionPaper.js`

### Other components

- **Exam-cell staff**
- **External faculty**

## Connections

- Exam-cell staff → Exam-cell routes: uses (evidence: `frontend/exam-cell-frontend/src/App.jsx`)
- Exam-cell routes → Upload bank: routes to (evidence: `frontend/exam-cell-frontend/src/App.jsx`)
- Exam-cell routes → Paper preview: routes to (evidence: `frontend/exam-cell-frontend/src/App.jsx`)
- External faculty → Faculty routes: uses (evidence: `frontend/external-frontend/src/App.jsx`)
- Faculty routes → Bank review: routes to (evidence: `frontend/external-frontend/src/App.jsx`)
- Faculty routes → Add question: routes to (evidence: `frontend/external-frontend/src/App.jsx`)
- Faculty routes → Paper preview: routes to (evidence: `frontend/external-frontend/src/App.jsx`)
- Paper preview → Pattern sections: renders (evidence: `frontend/external-frontend/src/pages/GeneratedQuestionPaperPreview.jsx`)
- API router → Bank routes: mounts (evidence: `backend/src/app.js`)
- Bank routes → Bank management: dispatches (evidence: `backend/src/routes/questionBankRoutes.js`)
- API router → External bank routes: mounts (evidence: `backend/src/app.js`)
- External bank routes → External bank handling: dispatches (evidence: `backend/src/routes/externalQuestionBankRoutes.js`)
- Bank management → Question bank: reads/writes (evidence: `backend/src/controllers/questionBankController.js`)
- Bank management → Faculty access: creates (evidence: `backend/src/controllers/questionBankController.js`)
- Bank management → Generated papers: reads (evidence: `backend/src/controllers/questionBankController.js`)
- External bank handling → Faculty access: reads (evidence: `backend/src/controllers/externalQuestionBankController.js`)
- External bank handling → Question bank: reads (evidence: `backend/src/controllers/externalQuestionBankController.js`)
- External bank handling → External questions: uses (evidence: `backend/src/controllers/externalQuestionBankController.js`)
- Question preview → Faculty access: reads (evidence: `backend/src/controllers/externalQuestionPreviewController.js`)
- Question preview → Question bank: reads (evidence: `backend/src/controllers/externalQuestionPreviewController.js`)
- Paper orchestration → Pattern generators: invokes (evidence: `backend/src/controllers/paperGenerationController.js`)
- Paper orchestration → Generated papers: reads/writes (evidence: `backend/src/controllers/paperGenerationController.js`)
- Pattern generators → External questions: reads (evidence: `backend/src/services/R24/IA1paperGenerationService.js`)
