# git-commit-shilpa/sudybuddy architecture

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

- Interactive diagram: https://gitdiagram.com/git-commit-shilpa/sudybuddy
- Repository: https://github.com/git-commit-shilpa/sudybuddy
- Video tour (about a minute): https://gitdiagram.com/git-commit-shilpa/sudybuddy/video

## Overview

StudyBuddy is a local-first study companion: learners organize courses, upload learning materials, and generate grounded notes, quizzes, flashcards, and revision plans. The main workflow runs from the React course/materials interface through the API, document extraction and optional media reading, then background generation and persistent results. Course content and study artifacts are stored in SQLite; local Ollama and Whisper provide AI capabilities. The graph combines excerpted calls with README-documented behavior; some frontend-to-API and scheduling details are documented rather than directly visible in sampled source.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/api/client.ts) (API client), [`frontend/src/App.tsx`](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/App.tsx) (React routes), [`backend/app/db.py`](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/db.py) (Database access), [`backend/app/services/media_processing.py`](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/services/media_processing.py) (Media reading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Study interface"]
  node_app["React routes<br/>[App.tsx]"]
  node_course_ui["Course workspace<br/>[CoursePage.tsx]"]
  node_materials_ui["Materials<br/>[MaterialsTab.tsx]"]
  node_study_ui["Study content<br/>[ContentTabs.tsx]"]
  node_quiz_ui["Quiz player<br/>[QuizPlay.tsx]"]
  node_flashcards_ui["Flashcard study<br/>[FlashcardStudy.tsx]"]
  node_notes_ui["Notes viewer<br/>[NotesViewer.tsx]"]
  node_schedule_ui["Revision plan<br/>[SchedulePage.tsx]"]
  node_settings_ui["AI settings<br/>[SettingsPage.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
end

subgraph group_api["Course API"]
  node_backend_api["REST endpoints<br/>[core.py]"]
  node_content_api["Content endpoints<br/>[content.py]"]
end

subgraph group_ingestion["Material reading"]
  node_parser["Document parser<br/>[parsers.py]"]
  node_media_discovery["Media extraction<br/>[media.py]"]
  node_media_processing["Media reading"]
  node_imaging["Image preparation<br/>[imaging.py]"]
  node_speech["Speech transcription<br/>[speech.py]"]
end

subgraph group_study["Study generation"]
  node_generation["Background generation<br/>[generation.py]"]
  node_grounding["Citation grounding<br/>[grounding.py]"]
  node_prompts["Task prompts<br/>[prompts.py]"]
  node_planner["Revision planner<br/>[planner.py]"]
  node_ollama_client["Ollama client<br/>[client.py]"]
end

subgraph group_persistence["Local persistence"]
  node_db_session["Database access<br/>[db.py]"]
  node_models["Study records<br/>[__init__.py]"]
  node_sqlite[("SQLite database")]
end

node_learner(("Learner"))
node_ollama{{"Ollama"}}
node_whisper{{"Whisper model"}}

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_course_ui
node_app -->|"routes to"| node_quiz_ui
node_app -->|"routes to"| node_flashcards_ui
node_app -->|"routes to"| node_notes_ui
node_app -->|"routes to"| node_schedule_ui
node_app -->|"routes to"| node_settings_ui
node_course_ui -->|"renders"| node_materials_ui
node_course_ui -->|"renders"| node_study_ui
node_materials_ui -->|"requests"| node_api_client
node_study_ui -->|"requests"| node_api_client
node_quiz_ui -->|"requests"| node_api_client
node_flashcards_ui -->|"requests"| node_api_client
node_notes_ui -->|"requests"| node_api_client
node_schedule_ui -->|"requests"| node_api_client
node_settings_ui -->|"requests"| node_api_client
node_api_client -->|"HTTP requests"| node_backend_api
node_api_client -.->|"HTTP requests"| node_content_api
node_backend_api -->|"parses uploads"| node_parser
node_backend_api -->|"queues reading"| node_media_processing
node_parser -->|"finds embedded media"| node_media_discovery
node_media_processing -->|"prepares images"| node_imaging
node_media_processing -->|"transcribes audio"| node_speech
node_media_processing -->|"requests image reading"| node_ollama_client
node_speech -.->|"transcribes with"| node_whisper
node_ollama_client -->|"sends requests"| node_ollama
node_content_api -->|"starts jobs"| node_generation
node_content_api -->|"creates plans"| node_planner
node_generation -->|"uses"| node_prompts
node_generation -->|"validates output"| node_grounding
node_generation -->|"generates content"| node_ollama_client
node_backend_api -->|"reads and writes"| node_db_session
node_content_api -->|"reads and writes"| node_db_session
node_generation -->|"reads and writes"| node_db_session
node_planner -.->|"persists plans"| node_db_session
node_media_processing -->|"stores extracted text"| node_db_session
node_db_session -->|"maps records"| node_models
node_db_session -->|"persists data"| node_sqlite

click node_app "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/App.tsx"
click node_course_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/CoursePage.tsx"
click node_materials_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/MaterialsTab.tsx"
click node_study_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/ContentTabs.tsx"
click node_quiz_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/QuizPlay.tsx"
click node_flashcards_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/FlashcardStudy.tsx"
click node_notes_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/NotesViewer.tsx"
click node_schedule_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/SchedulePage.tsx"
click node_settings_ui "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_api_client "https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/api/client.ts"
click node_backend_api "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/routers/core.py"
click node_content_api "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/routers/content.py"
click node_parser "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/parsers.py"
click node_media_discovery "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/media.py"
click node_media_processing "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/services/media_processing.py"
click node_imaging "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/imaging.py"
click node_speech "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/speech.py"
click node_generation "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/services/generation.py"
click node_grounding "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/grounding.py"
click node_prompts "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/prompts.py"
click node_planner "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/scheduler/planner.py"
click node_ollama_client "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/client.py"
click node_db_session "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/db.py"
click node_models "https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/models/__init__.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_course_ui,node_materials_ui,node_study_ui,node_quiz_ui,node_flashcards_ui,node_notes_ui,node_schedule_ui,node_settings_ui,node_api_client toneBlue
class node_backend_api,node_content_api toneAmber
class node_parser,node_media_discovery,node_media_processing,node_imaging,node_speech toneMint
class node_generation,node_grounding,node_prompts,node_planner,node_ollama_client toneRose
class node_db_session,node_models,node_sqlite,node_learner,node_ollama,node_whisper toneIndigo
```

## Components

### Study interface

- [React routes](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Course workspace](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/CoursePage.tsx): `frontend/src/pages/CoursePage.tsx`
- [Materials](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/MaterialsTab.tsx): `frontend/src/pages/MaterialsTab.tsx`
- [Study content](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/ContentTabs.tsx): `frontend/src/pages/ContentTabs.tsx`
- [Quiz player](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/QuizPlay.tsx): `frontend/src/pages/QuizPlay.tsx`
- [Flashcard study](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/FlashcardStudy.tsx): `frontend/src/pages/FlashcardStudy.tsx`
- [Notes viewer](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/NotesViewer.tsx): `frontend/src/pages/NotesViewer.tsx`
- [Revision plan](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/SchedulePage.tsx): `frontend/src/pages/SchedulePage.tsx`
- [AI settings](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [API client](https://github.com/git-commit-shilpa/sudybuddy/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Course API

- [REST endpoints](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/routers/core.py): `backend/app/routers/core.py`
- [Content endpoints](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/routers/content.py): `backend/app/routers/content.py`

### Material reading

- [Document parser](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/parsers.py): `backend/app/ingestion/parsers.py`
- [Media extraction](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/media.py): `backend/app/ingestion/media.py`
- [Media reading](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/services/media_processing.py): `backend/app/services/media_processing.py`
- [Image preparation](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ingestion/imaging.py): `backend/app/ingestion/imaging.py`
- [Speech transcription](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/speech.py): `backend/app/ai/speech.py`

### Study generation

- [Background generation](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/services/generation.py): `backend/app/services/generation.py`
- [Citation grounding](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/grounding.py): `backend/app/ai/grounding.py`
- [Task prompts](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/prompts.py): `backend/app/ai/prompts.py`
- [Revision planner](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/scheduler/planner.py): `backend/app/scheduler/planner.py`
- [Ollama client](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/ai/client.py): `backend/app/ai/client.py`

### Local persistence

- [Database access](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/db.py): `backend/app/db.py`
- [Study records](https://github.com/git-commit-shilpa/sudybuddy/blob/main/backend/app/models/__init__.py): `backend/app/models/__init__.py`
- **SQLite database**

### Other components

- **Learner**
- **Ollama**
- **Whisper model**

## Connections

- Learner → React routes: uses (evidence: `frontend/src/App.tsx`)
- React routes → Course workspace: routes to (evidence: `frontend/src/App.tsx`)
- React routes → Quiz player: routes to (evidence: `frontend/src/App.tsx`)
- React routes → Flashcard study: routes to (evidence: `frontend/src/App.tsx`)
- React routes → Notes viewer: routes to (evidence: `frontend/src/App.tsx`)
- React routes → Revision plan: routes to (evidence: `frontend/src/App.tsx`)
- React routes → AI settings: routes to (evidence: `frontend/src/App.tsx`)
- Course workspace → Materials: renders (evidence: `frontend/src/pages/CoursePage.tsx`)
- Course workspace → Study content: renders (evidence: `frontend/src/pages/CoursePage.tsx`)
- Materials → API client: requests (evidence: `frontend/src/api/client.ts`)
- Study content → API client: requests (evidence: `frontend/src/api/client.ts`)
- Quiz player → API client: requests (evidence: `frontend/src/api/client.ts`)
- Flashcard study → API client: requests (evidence: `frontend/src/api/client.ts`)
- Notes viewer → API client: requests (evidence: `frontend/src/api/client.ts`)
- Revision plan → API client: requests (evidence: `frontend/src/api/client.ts`)
- AI settings → API client: requests (evidence: `frontend/src/api/client.ts`)
- API client → REST endpoints: HTTP requests (evidence: `frontend/src/api/client.ts`)
- API client → Content endpoints: HTTP requests
- REST endpoints → Document parser: parses uploads (evidence: `backend/app/routers/core.py`)
- REST endpoints → Media reading: queues reading (evidence: `backend/app/routers/core.py`)
- Document parser → Media extraction: finds embedded media (evidence: `backend/app/ingestion/parsers.py`)
- Media reading → Image preparation: prepares images (evidence: `backend/app/services/media_processing.py`)
- Media reading → Speech transcription: transcribes audio (evidence: `backend/app/services/media_processing.py`)
- Media reading → Ollama client: requests image reading (evidence: `backend/app/services/media_processing.py`)
- Speech transcription → Whisper model: transcribes with
- Ollama client → Ollama: sends requests (evidence: `backend/app/ai/client.py`)
- Content endpoints → Background generation: starts jobs (evidence: `backend/app/routers/content.py`)
- Content endpoints → Revision planner: creates plans (evidence: `backend/app/routers/content.py`)
- Background generation → Task prompts: uses (evidence: `backend/app/services/generation.py`)
- Background generation → Citation grounding: validates output (evidence: `backend/app/services/generation.py`)
- Background generation → Ollama client: generates content (evidence: `backend/app/services/generation.py`)
- REST endpoints → Database access: reads and writes (evidence: `backend/app/routers/core.py`)
- Content endpoints → Database access: reads and writes (evidence: `backend/app/routers/content.py`)
- Background generation → Database access: reads and writes (evidence: `backend/app/services/generation.py`)
- Revision planner → Database access: persists plans
- Media reading → Database access: stores extracted text (evidence: `backend/app/services/media_processing.py`)
- Database access → Study records: maps records (evidence: `backend/app/db.py`)
- Database access → SQLite database: persists data (evidence: `backend/app/db.py`)
