# rohanpudari/studymate architecture

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

- Interactive diagram: https://gitdiagram.com/rohanpudari/studymate
- Repository: https://github.com/rohanpudari/studymate

## Overview

StudyMate lets a user upload study notes, ask document-grounded questions with page citations, and generate a summary. The React UI calls FastAPI routes; backend handlers own PDF ingestion, retrieval, prompt construction, and model calls. The README documents the RAG components and debug search capability, while the sampled backend source confirms their orchestration. Those backend stages share one source file, so the graph distinguishes their responsibilities without implying separate modules.

Main entry points: [`frontend/src/App.jsx`](https://github.com/rohanpudari/studymate/blob/main/frontend/src/App.jsx) (Study UI), [`backend/main.py`](https://github.com/rohanpudari/studymate/blob/main/backend/main.py) (PDF upload), [`frontend/src/main.jsx`](https://github.com/rohanpudari/studymate/blob/main/frontend/src/main.jsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Study interface"]
  node_ui["Study UI<br/>[App.jsx]"]
  node_react_entry["React entry<br/>[main.jsx]"]
end

subgraph group_api["API workflows"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_upload["PDF upload<br/>[main.py]"]
  node_ask["Question answering<br/>[main.py]"]
  node_summarize["Document summary<br/>[main.py]"]
  node_search["Chunk search<br/>[main.py]"]
end

subgraph group_rag["Document processing"]
  node_pdf_loader["PDF extraction<br/>[main.py]"]
  node_splitter["Text chunking<br/>[main.py]"]
  node_embedding["Text embeddings<br/>[main.py]"]
  node_retrieval["Similarity retrieval<br/>[main.py]"]
  node_prompt["Prompt construction<br/>[main.py]"]
end

subgraph group_local["Local services"]
  node_file_store[("Uploaded PDFs<br/>[main.py]")]
  node_chroma[("Chroma vectors<br/>[main.py]")]
end

node_user(("Student"))
node_ollama["Ollama model"]

node_user -->|"uses"| node_ui
node_react_entry -->|"renders"| node_ui
node_ui -->|"uploads PDF"| node_upload
node_ui -->|"asks question"| node_ask
node_ui -->|"requests summary"| node_summarize
node_api_app -->|"dispatches"| node_upload
node_api_app -->|"dispatches"| node_ask
node_api_app -->|"dispatches"| node_summarize
node_api_app -->|"dispatches"| node_search
node_upload -->|"writes PDF"| node_file_store
node_upload -->|"loads PDF"| node_pdf_loader
node_pdf_loader -->|"provides pages"| node_splitter
node_upload -->|"splits pages"| node_splitter
node_upload -->|"stores chunks"| node_chroma
node_chroma -->|"embeds chunks"| node_embedding
node_ask -->|"searches active file"| node_retrieval
node_search -->|"searches all files"| node_retrieval
node_retrieval -->|"queries vectors"| node_chroma
node_chroma -->|"embeds query"| node_embedding
node_ask -->|"builds context prompt"| node_prompt
node_ask -->|"invokes model"| node_ollama
node_summarize -->|"fetches active chunks"| node_chroma
node_summarize -->|"invokes model"| node_ollama
node_ask -->|"returns answer and citations"| node_ui
node_summarize -->|"returns summary"| node_ui
node_search -.->|"returns matching chunks"| node_ui

click node_ui "https://github.com/rohanpudari/studymate/blob/main/frontend/src/App.jsx"
click node_react_entry "https://github.com/rohanpudari/studymate/blob/main/frontend/src/main.jsx"
click node_api_app "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_upload "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_ask "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_summarize "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_search "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_pdf_loader "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_splitter "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_embedding "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_retrieval "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_prompt "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_file_store "https://github.com/rohanpudari/studymate/blob/main/backend/main.py"
click node_chroma "https://github.com/rohanpudari/studymate/blob/main/backend/main.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_ui,node_react_entry toneBlue
class node_api_app,node_upload,node_ask,node_summarize,node_search toneAmber
class node_pdf_loader,node_splitter,node_embedding,node_retrieval,node_prompt toneMint
class node_file_store,node_chroma toneRose
class node_user,node_ollama toneIndigo
```

## Components

### Study interface

- [Study UI](https://github.com/rohanpudari/studymate/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [React entry](https://github.com/rohanpudari/studymate/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### API workflows

- [FastAPI app](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [PDF upload](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Question answering](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Document summary](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Chunk search](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`

### Document processing

- [PDF extraction](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Text chunking](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Text embeddings](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Similarity retrieval](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Prompt construction](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`

### Local services

- [Uploaded PDFs](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`
- [Chroma vectors](https://github.com/rohanpudari/studymate/blob/main/backend/main.py): `backend/main.py`

### Other components

- **Student**
- **Ollama model**

## Connections

- Student → Study UI: uses
- React entry → Study UI: renders
- Study UI → PDF upload: uploads PDF
- Study UI → Question answering: asks question
- Study UI → Document summary: requests summary
- FastAPI app → PDF upload: dispatches
- FastAPI app → Question answering: dispatches
- FastAPI app → Document summary: dispatches
- FastAPI app → Chunk search: dispatches
- PDF upload → Uploaded PDFs: writes PDF
- PDF upload → PDF extraction: loads PDF
- PDF extraction → Text chunking: provides pages
- PDF upload → Text chunking: splits pages
- PDF upload → Chroma vectors: stores chunks
- Chroma vectors → Text embeddings: embeds chunks
- Question answering → Similarity retrieval: searches active file
- Chunk search → Similarity retrieval: searches all files
- Similarity retrieval → Chroma vectors: queries vectors
- Chroma vectors → Text embeddings: embeds query
- Question answering → Prompt construction: builds context prompt
- Question answering → Ollama model: invokes model
- Document summary → Chroma vectors: fetches active chunks
- Document summary → Ollama model: invokes model
- Question answering → Study UI: returns answer and citations
- Document summary → Study UI: returns summary
- Chunk search → Study UI: returns matching chunks
