# ravishankar141/study_buddy architecture

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

- Interactive diagram: https://gitdiagram.com/ravishankar141/study_buddy
- Repository: https://github.com/ravishankar141/study_buddy

## Overview

Study Buddy is a local AI study assistant: students upload material, then use it for notes, doubt solving, quizzes and revision planning. The React app routes users to feature pages; its API client sends requests to FastAPI, whose feature routes perform processing and persist selected results in SQLite. Authentication and password recovery form a separate capability. The README documents OCR/PDF extraction and performance analysis; sampled source confirms quiz analysis and upload utility wiring. Some unsampled feature internals and model-call relationships are therefore represented only where the README or source index supports them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/App.jsx) (App routing), [`backend/main.py`](https://github.com/ravishankar141/study_buddy/blob/main/backend/main.py) (FastAPI app), [`frontend/src/api.js`](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/api.js) (API client), [`backend/database/db.py`](https://github.com/ravishankar141/study_buddy/blob/main/backend/database/db.py) (SQLite access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student application"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth_context["Auth state<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_upload_page["Upload page<br/>[UploadPage.jsx]"]
  node_notes_page["Notes page<br/>[NotesPage.jsx]"]
  node_doubt_page["Doubt page<br/>[DoubtPage.jsx]"]
  node_quiz_page["Quiz page<br/>[QuizPage.jsx]"]
  node_revision_page["Revision page<br/>[RevisionPage.jsx]"]
end

subgraph group_api["Backend API"]
  node_backend["FastAPI app<br/>[main.py]"]
end

subgraph group_learning["Learning features"]
  node_upload_route["Document extraction<br/>[upload.py]"]
  node_pdf_util["PDF extraction<br/>[pdf.py]"]
  node_ocr_util["Image OCR<br/>[ocr.py]"]
  node_notes_route["Smart notes<br/>[notes.py]"]
  node_chunking["Text chunking<br/>[chunking.py]"]
  node_doubt_route["Doubt solving<br/>[doubt.py]"]
  node_quiz_route["Quiz and analysis<br/>[quiz.py]"]
  node_revision_route["Revision planning<br/>[revision.py]"]
end

subgraph group_identity["Identity"]
  node_auth_route["Authentication<br/>[auth_routes.py]"]
  node_auth_util["Token security<br/>[auth.py]"]
end

subgraph group_storage["Persistence"]
  node_db[("SQLite access<br/>[db.py]")]
  node_models["Domain records<br/>[models.py]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"reads auth"| node_auth_context
node_app -->|"routes to"| node_upload_page
node_app -->|"routes to"| node_notes_page
node_app -->|"routes to"| node_doubt_page
node_app -->|"routes to"| node_quiz_page
node_app -->|"routes to"| node_revision_page
node_auth_context -->|"calls"| node_api_client
node_upload_page -->|"uploads through"| node_api_client
node_notes_page -->|"requests notes"| node_api_client
node_doubt_page -->|"requests answers"| node_api_client
node_quiz_page -->|"requests quiz"| node_api_client
node_revision_page -->|"requests plans"| node_api_client
node_api_client -->|"HTTP requests"| node_backend
node_backend -->|"registers route"| node_upload_route
node_backend -->|"registers route"| node_notes_route
node_backend -->|"registers route"| node_doubt_route
node_backend -->|"registers route"| node_quiz_route
node_backend -->|"registers route"| node_revision_route
node_backend -->|"registers route"| node_auth_route
node_upload_route -->|"uses"| node_pdf_util
node_upload_route -->|"uses"| node_ocr_util
node_notes_route -->|"chunks text"| node_chunking
node_auth_route -->|"uses security"| node_auth_util
node_auth_route -->|"queries"| node_db
node_auth_route -->|"uses records"| node_models
node_notes_route -->|"persists data"| node_db
node_notes_route -->|"uses records"| node_models
node_doubt_route -->|"persists data"| node_db
node_doubt_route -->|"uses records"| node_models
node_quiz_route -->|"persists quiz"| node_db
node_quiz_route -->|"uses records"| node_models
node_revision_route -->|"stores plans"| node_db

click node_app "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/App.jsx"
click node_auth_context "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/AuthContext.jsx"
click node_api_client "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/api.js"
click node_upload_page "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/UploadPage.jsx"
click node_notes_page "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/NotesPage.jsx"
click node_doubt_page "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/DoubtPage.jsx"
click node_quiz_page "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/QuizPage.jsx"
click node_revision_page "https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/RevisionPage.jsx"
click node_backend "https://github.com/ravishankar141/study_buddy/blob/main/backend/main.py"
click node_upload_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/upload.py"
click node_pdf_util "https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/pdf.py"
click node_ocr_util "https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/ocr.py"
click node_notes_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/notes.py"
click node_chunking "https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/chunking.py"
click node_doubt_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/doubt.py"
click node_quiz_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/quiz.py"
click node_revision_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/revision.py"
click node_auth_route "https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/auth_routes.py"
click node_auth_util "https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/auth.py"
click node_db "https://github.com/ravishankar141/study_buddy/blob/main/backend/database/db.py"
click node_models "https://github.com/ravishankar141/study_buddy/blob/main/backend/database/models.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,node_auth_context,node_api_client,node_upload_page,node_notes_page,node_doubt_page,node_quiz_page,node_revision_page toneBlue
class node_backend toneAmber
class node_upload_route,node_pdf_util,node_ocr_util,node_notes_route,node_chunking,node_doubt_route,node_quiz_route,node_revision_route toneMint
class node_auth_route,node_auth_util toneRose
class node_db,node_models,node_student toneIndigo
```

## Components

### Student application

- [App routing](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/AuthContext.jsx): `frontend/src/AuthContext.jsx`
- [API client](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Upload page](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/UploadPage.jsx): `frontend/src/pages/UploadPage.jsx`
- [Notes page](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/NotesPage.jsx): `frontend/src/pages/NotesPage.jsx`
- [Doubt page](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/DoubtPage.jsx): `frontend/src/pages/DoubtPage.jsx`
- [Quiz page](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/QuizPage.jsx): `frontend/src/pages/QuizPage.jsx`
- [Revision page](https://github.com/ravishankar141/study_buddy/blob/main/frontend/src/pages/RevisionPage.jsx): `frontend/src/pages/RevisionPage.jsx`

### Backend API

- [FastAPI app](https://github.com/ravishankar141/study_buddy/blob/main/backend/main.py): `backend/main.py`

### Learning features

- [Document extraction](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/upload.py): `backend/routes/upload.py`
- [PDF extraction](https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/pdf.py): `backend/utils/pdf.py`
- [Image OCR](https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/ocr.py): `backend/utils/ocr.py`
- [Smart notes](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/notes.py): `backend/routes/notes.py`
- [Text chunking](https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/chunking.py): `backend/utils/chunking.py`
- [Doubt solving](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/doubt.py): `backend/routes/doubt.py`
- [Quiz and analysis](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/quiz.py): `backend/routes/quiz.py`
- [Revision planning](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/revision.py): `backend/routes/revision.py`

### Identity

- [Authentication](https://github.com/ravishankar141/study_buddy/blob/main/backend/routes/auth_routes.py): `backend/routes/auth_routes.py`
- [Token security](https://github.com/ravishankar141/study_buddy/blob/main/backend/utils/auth.py): `backend/utils/auth.py`

### Persistence

- [SQLite access](https://github.com/ravishankar141/study_buddy/blob/main/backend/database/db.py): `backend/database/db.py`
- [Domain records](https://github.com/ravishankar141/study_buddy/blob/main/backend/database/models.py): `backend/database/models.py`

### Other components

- **Student**

## Connections

- Student → App routing: uses (evidence: `README.md`)
- App routing → Auth state: reads auth (evidence: `frontend/src/App.jsx`)
- App routing → Upload page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Notes page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Doubt page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Quiz page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Revision page: routes to (evidence: `frontend/src/App.jsx`)
- Auth state → API client: calls (evidence: `frontend/src/AuthContext.jsx`)
- Upload page → API client: uploads through (evidence: `frontend/src/pages/UploadPage.jsx`)
- Notes page → API client: requests notes (evidence: `frontend/src/pages/NotesPage.jsx`)
- Doubt page → API client: requests answers (evidence: `frontend/src/pages/DoubtPage.jsx`)
- Quiz page → API client: requests quiz (evidence: `frontend/src/pages/QuizPage.jsx`)
- Revision page → API client: requests plans (evidence: `frontend/src/pages/RevisionPage.jsx`)
- API client → FastAPI app: HTTP requests (evidence: `frontend/src/api.js`)
- FastAPI app → Document extraction: registers route (evidence: `backend/main.py`)
- FastAPI app → Smart notes: registers route (evidence: `backend/main.py`)
- FastAPI app → Doubt solving: registers route (evidence: `backend/main.py`)
- FastAPI app → Quiz and analysis: registers route (evidence: `backend/main.py`)
- FastAPI app → Revision planning: registers route (evidence: `backend/main.py`)
- FastAPI app → Authentication: registers route (evidence: `backend/main.py`)
- Document extraction → PDF extraction: uses (evidence: `backend/routes/upload.py`)
- Document extraction → Image OCR: uses (evidence: `backend/routes/upload.py`)
- Smart notes → Text chunking: chunks text (evidence: `backend/routes/notes.py`)
- Authentication → Token security: uses security (evidence: `backend/routes/auth_routes.py`)
- Authentication → SQLite access: queries (evidence: `backend/routes/auth_routes.py`)
- Authentication → Domain records: uses records (evidence: `backend/routes/auth_routes.py`)
- Smart notes → SQLite access: persists data (evidence: `backend/routes/notes.py`)
- Smart notes → Domain records: uses records (evidence: `backend/routes/notes.py`)
- Doubt solving → SQLite access: persists data (evidence: `backend/routes/doubt.py`)
- Doubt solving → Domain records: uses records (evidence: `backend/routes/doubt.py`)
- Quiz and analysis → SQLite access: persists quiz (evidence: `backend/routes/quiz.py`)
- Quiz and analysis → Domain records: uses records (evidence: `backend/routes/quiz.py`)
- Revision planning → SQLite access: stores plans (evidence: `backend/routes/revision.py`)
