# shravan6778/tuition_companion architecture

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

- Interactive diagram: https://gitdiagram.com/shravan6778/tuition_companion
- Repository: https://github.com/shravan6778/tuition_companion

## Overview

This is an educational platform for teachers, students, and parents, combining textbook-library management with classrooms, assignments, doubts, quizzes, checks, and progress views. Teachers manage books and rooms, assign work, and review student activity; students join rooms, link books, ask textbook-grounded questions, and complete assessments; parents link to students and view their children. The graph reflects explicit route calls and frontend routing where shown. Several backend subsystems are represented from the source index, so their internal flow is omitted where no relationship was evidenced.

Main entry points: [`backend/app/teacher/routes.py`](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/teacher/routes.py) (Teacher book routes), [`backend/app/auth/dependencies.py`](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/auth/dependencies.py) (Role authorization), [`backend/app/student/routes.py`](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/student/routes.py) (Student library and rooms), [`frontend/src/App.jsx`](https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/App.jsx) (Role routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Role-based web app"]
  node_app_routes["Role routes<br/>[App.jsx]"]
  node_teacher_ui["Teacher library UI<br/>[TeacherLibrary.jsx]"]
  node_content_api["Content API client<br/>[content.js]"]
end

subgraph group_library["Textbook library"]
  node_teacher_routes["Teacher book routes<br/>[routes.py]"]
  node_library_access["Library access<br/>[access.py]"]
  node_library_upload["Book and chapter upload<br/>[upload.py]"]
  node_library_search["Library search<br/>[search.py]"]
  node_chapter_graph["Chapter graph view<br/>[graph_view.py]"]
end

subgraph group_learning["Learning workflows"]
  node_student_routes["Student library and rooms<br/>[routes.py]"]
  node_assignments["Assignment workflow<br/>[routes.py]"]
  node_doubts["Textbook doubts<br/>[routes.py]"]
  node_checks["Assignment checks<br/>[routes.py]"]
  node_quizzes["Quiz workflow<br/>[quiz_routes.py]"]
  node_parent_routes["Parent links and children<br/>[routes.py]"]
  node_quiz_service["Quiz generation and grading<br/>[quiz_service.py]"]
  node_mastery["Mastery tracking<br/>[mastery.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth_context["Session and profile<br/>[AuthContext.jsx]"]
  node_auth_dependencies["Role authorization<br/>[dependencies.py]"]
end

subgraph group_processing["Content processing"]
  node_pipeline_jobs["Chapter processing jobs<br/>[jobs.py]"]
  node_storage["Hashed file storage<br/>[storage.py]"]
  node_ingest_reference["Reference book ingestion"]
end

node_user(("User"))

node_user -->|"uses"| node_app_routes
node_app_routes -->|"provides sessions"| node_auth_context
node_app_routes -->|"routes teachers"| node_teacher_ui
node_teacher_ui -->|"requests library data"| node_content_api
node_teacher_routes -->|"checks visibility"| node_library_access
node_teacher_routes -->|"manages uploads"| node_library_upload
node_teacher_routes -->|"searches books"| node_library_search
node_teacher_routes -->|"serves graph view"| node_chapter_graph
node_student_routes -->|"checks visibility"| node_library_access
node_student_routes -->|"serves graph view"| node_chapter_graph
node_user -->|"joins and links"| node_student_routes
node_user -->|"creates work"| node_assignments
node_user -->|"asks questions"| node_doubts
node_doubts -->|"checks assignment"| node_assignments
node_user -->|"completes work"| node_checks
node_checks -->|"records mastery"| node_mastery
node_user -->|"takes quizzes"| node_quizzes
node_quizzes -->|"generates and grades"| node_quiz_service
node_user -->|"links child"| node_parent_routes
node_ingest_reference -->|"stores PDF chapters"| node_storage
node_ingest_reference -->|"runs chapter job"| node_pipeline_jobs
node_teacher_routes -->|"requires teacher"| node_auth_dependencies
node_student_routes -->|"requires student"| node_auth_dependencies
node_assignments -->|"requires role"| node_auth_dependencies
node_doubts -->|"requires student"| node_auth_dependencies
node_checks -->|"requires student"| node_auth_dependencies
node_parent_routes -->|"requires parent"| node_auth_dependencies

click node_app_routes "https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/App.jsx"
click node_auth_context "https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/auth/AuthContext.jsx"
click node_teacher_ui "https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/teacher/TeacherLibrary.jsx"
click node_content_api "https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/api/content.js"
click node_teacher_routes "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/teacher/routes.py"
click node_library_access "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/access.py"
click node_library_upload "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/upload.py"
click node_library_search "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/search.py"
click node_chapter_graph "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/graph_view.py"
click node_student_routes "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/student/routes.py"
click node_assignments "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assignments/routes.py"
click node_doubts "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/doubts/routes.py"
click node_checks "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/routes.py"
click node_quizzes "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/quiz_routes.py"
click node_parent_routes "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/parent/routes.py"
click node_quiz_service "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/quiz_service.py"
click node_mastery "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/mastery.py"
click node_pipeline_jobs "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/pipeline/jobs.py"
click node_storage "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/core/storage.py"
click node_ingest_reference "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/db/ingest_reference.py"
click node_auth_dependencies "https://github.com/shravan6778/tuition_companion/blob/main/backend/app/auth/dependencies.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_app_routes,node_teacher_ui,node_content_api,node_user toneBlue
class node_teacher_routes,node_library_access,node_library_upload,node_library_search,node_chapter_graph toneAmber
class node_student_routes,node_assignments,node_doubts,node_checks,node_quizzes,node_parent_routes,node_quiz_service,node_mastery toneMint
class node_auth_context,node_auth_dependencies toneRose
class node_pipeline_jobs,node_storage,node_ingest_reference toneIndigo
```

## Components

### Role-based web app

- [Role routes](https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Teacher library UI](https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/teacher/TeacherLibrary.jsx): `frontend/src/teacher/TeacherLibrary.jsx`
- [Content API client](https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/api/content.js): `frontend/src/api/content.js`

### Textbook library

- [Teacher book routes](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/teacher/routes.py): `backend/app/teacher/routes.py`
- [Library access](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/access.py): `backend/app/content_library/access.py`
- [Book and chapter upload](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/upload.py): `backend/app/content_library/upload.py`
- [Library search](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/search.py): `backend/app/content_library/search.py`
- [Chapter graph view](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/content_library/graph_view.py): `backend/app/content_library/graph_view.py`

### Learning workflows

- [Student library and rooms](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/student/routes.py): `backend/app/student/routes.py`
- [Assignment workflow](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assignments/routes.py): `backend/app/assignments/routes.py`
- [Textbook doubts](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/doubts/routes.py): `backend/app/doubts/routes.py`
- [Assignment checks](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/routes.py): `backend/app/assessment/routes.py`
- [Quiz workflow](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/quiz_routes.py): `backend/app/assessment/quiz_routes.py`
- [Parent links and children](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/parent/routes.py): `backend/app/parent/routes.py`
- [Quiz generation and grading](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/quiz_service.py): `backend/app/assessment/quiz_service.py`
- [Mastery tracking](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/assessment/mastery.py): `backend/app/assessment/mastery.py`

### Identity and access

- [Session and profile](https://github.com/shravan6778/tuition_companion/blob/main/frontend/src/auth/AuthContext.jsx): `frontend/src/auth/AuthContext.jsx`
- [Role authorization](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/auth/dependencies.py): `backend/app/auth/dependencies.py`

### Content processing

- [Chapter processing jobs](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/pipeline/jobs.py): `backend/app/pipeline/jobs.py`
- [Hashed file storage](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/core/storage.py): `backend/app/core/storage.py`
- [Reference book ingestion](https://github.com/shravan6778/tuition_companion/blob/main/backend/app/db/ingest_reference.py): `backend/app/db/ingest_reference.py`

### Other components

- **User**

## Connections

- User → Role routes: uses (evidence: `frontend/src/App.jsx`)
- Role routes → Session and profile: provides sessions (evidence: `frontend/src/main.jsx`)
- Role routes → Teacher library UI: routes teachers (evidence: `frontend/src/App.jsx`)
- Teacher library UI → Content API client: requests library data (evidence: `frontend/src/teacher/TeacherLibrary.jsx`)
- Teacher book routes → Library access: checks visibility (evidence: `backend/app/teacher/routes.py`)
- Teacher book routes → Book and chapter upload: manages uploads (evidence: `backend/app/teacher/routes.py`)
- Teacher book routes → Library search: searches books (evidence: `backend/app/teacher/routes.py`)
- Teacher book routes → Chapter graph view: serves graph view (evidence: `backend/app/teacher/routes.py`)
- Student library and rooms → Library access: checks visibility (evidence: `backend/app/student/routes.py`)
- Student library and rooms → Chapter graph view: serves graph view (evidence: `backend/app/student/routes.py`)
- User → Student library and rooms: joins and links (evidence: `backend/app/student/routes.py`)
- User → Assignment workflow: creates work (evidence: `backend/app/assignments/routes.py`)
- User → Textbook doubts: asks questions (evidence: `backend/app/doubts/routes.py`)
- Textbook doubts → Assignment workflow: checks assignment (evidence: `backend/app/doubts/routes.py`)
- User → Assignment checks: completes work (evidence: `backend/app/assessment/routes.py`)
- Assignment checks → Mastery tracking: records mastery (evidence: `backend/app/assessment/routes.py`)
- User → Quiz workflow: takes quizzes (evidence: `backend/app/assessment/quiz_routes.py`)
- Quiz workflow → Quiz generation and grading: generates and grades (evidence: `backend/app/assessment/quiz_routes.py`)
- User → Parent links and children: links child (evidence: `backend/app/parent/routes.py`)
- Reference book ingestion → Hashed file storage: stores PDF chapters (evidence: `backend/app/db/ingest_reference.py`)
- Reference book ingestion → Chapter processing jobs: runs chapter job (evidence: `backend/app/db/ingest_reference.py`)
- Teacher book routes → Role authorization: requires teacher (evidence: `backend/app/teacher/routes.py`)
- Student library and rooms → Role authorization: requires student (evidence: `backend/app/student/routes.py`)
- Assignment workflow → Role authorization: requires role (evidence: `backend/app/assignments/routes.py`)
- Textbook doubts → Role authorization: requires student (evidence: `backend/app/doubts/routes.py`)
- Assignment checks → Role authorization: requires student (evidence: `backend/app/assessment/routes.py`)
- Parent links and children → Role authorization: requires parent (evidence: `backend/app/parent/routes.py`)
