# roshini-nawanjala/studymate-ai architecture

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

- Interactive diagram: https://gitdiagram.com/roshini-nawanjala/studymate-ai
- Repository: https://github.com/roshini-nawanjala/studymate-ai

## Overview

StudyMate AI turns uploaded lecture PDFs into searchable study material, then supports summarization, grounded question answering, quizzes, and personalized reflection. The main workflow runs from Streamlit upload through PDF extraction, chunking, embedding, and persistent vector storage; learning pages use those notes to generate or assess responses. Quiz results travel to reflection through a structured message persisted in session state. The graph follows sampled service and provider calls; several page-to-service connections and capabilities are based on the README because their page implementations were not sampled.

Main entry points: [`app.py`](https://github.com/roshini-nawanjala/studymate-ai/blob/main/app.py) (Home and navigation), [`agents/ai_provider.py`](https://github.com/roshini-nawanjala/studymate-ai/blob/main/agents/ai_provider.py) (Task-based routing), [`services/document_service.py`](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/document_service.py) (Document processing), [`rag/vector_store.py`](https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/vector_store.py) (Vector store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Learning interface"]
  node_home["Home and navigation<br/>[app.py]"]
  node_upload_page["Upload page<br/>[Upload.py]"]
  node_summary_page["Summary page<br/>[Summary.py]"]
  node_ask_page["Ask AI page<br/>[Ask_AI.py]"]
  node_quiz_page["Quiz page<br/>[Quiz.py]"]
  node_reflection_page["Reflection page<br/>[Reflection.py]"]
end

subgraph group_documents["Document and retrieval"]
  node_document_service["Document processing"]
  node_pdf_loader["PDF extraction<br/>[file_loader.py]"]
  node_chunker["Text chunking<br/>[chunker.py]"]
  node_embeddings["Embedding model<br/>[embeddings.py]"]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
end

subgraph group_learning["Learning services"]
  node_summary_service["Summary generation<br/>[summary_service.py]"]
  node_chat_service["Grounded Q&amp;A<br/>[chat_service.py]"]
  node_quiz_service["Quiz and review<br/>[quiz_service.py]"]
  node_reflection_service["Learning reflection"]
end

subgraph group_agents["Agents and providers"]
  node_ai_provider["Task-based routing<br/>[ai_provider.py]"]
  node_quiz_message["Quiz result protocol<br/>[messages.py]"]
  node_session_state[("Streamlit session state<br/>[Quiz.py]")]
end

node_student(("Student"))
node_groq["Groq"]
node_openrouter["OpenRouter"]

node_student -->|"opens"| node_home
node_home -->|"navigates"| node_upload_page
node_home -->|"navigates"| node_summary_page
node_home -->|"navigates"| node_ask_page
node_home -->|"navigates"| node_quiz_page
node_home -->|"navigates"| node_reflection_page
node_student -->|"uploads PDF"| node_upload_page
node_upload_page -->|"processes upload"| node_document_service
node_document_service -->|"extracts text"| node_pdf_loader
node_document_service -->|"splits text"| node_chunker
node_document_service -->|"encodes chunks"| node_embeddings
node_document_service -->|"stores chunks"| node_vector_store
node_summary_page -->|"requests summary"| node_summary_service
node_summary_service -->|"reads notes"| node_vector_store
node_summary_service -->|"requests model"| node_ai_provider
node_ask_page -->|"asks question"| node_chat_service
node_chat_service -->|"searches notes"| node_vector_store
node_chat_service -->|"requests model"| node_ai_provider
node_quiz_page -->|"generates and submits"| node_quiz_service
node_quiz_service -->|"reads notes"| node_vector_store
node_quiz_service -->|"requests model"| node_ai_provider
node_quiz_service -->|"builds result"| node_quiz_message
node_quiz_page -->|"persists result"| node_session_state
node_session_state -->|"provides result"| node_reflection_page
node_reflection_page -->|"requests reflection"| node_reflection_service
node_reflection_service -->|"reads result"| node_quiz_message
node_reflection_service -->|"reads notes"| node_vector_store
node_reflection_service -->|"requests model"| node_ai_provider
node_ai_provider -.->|"routes tasks"| node_groq
node_ai_provider -.->|"routes tasks"| node_openrouter

click node_home "https://github.com/roshini-nawanjala/studymate-ai/blob/main/app.py"
click node_upload_page "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Upload.py"
click node_summary_page "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Summary.py"
click node_ask_page "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Ask_AI.py"
click node_quiz_page "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Quiz.py"
click node_reflection_page "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Reflection.py"
click node_document_service "https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/document_service.py"
click node_pdf_loader "https://github.com/roshini-nawanjala/studymate-ai/blob/main/utils/file_loader.py"
click node_chunker "https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/chunker.py"
click node_embeddings "https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/embeddings.py"
click node_vector_store "https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/vector_store.py"
click node_summary_service "https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/summary_service.py"
click node_chat_service "https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/chat_service.py"
click node_quiz_service "https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/quiz_service.py"
click node_reflection_service "https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/reflection_service.py"
click node_ai_provider "https://github.com/roshini-nawanjala/studymate-ai/blob/main/agents/ai_provider.py"
click node_quiz_message "https://github.com/roshini-nawanjala/studymate-ai/blob/main/agents/messages.py"
click node_session_state "https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Quiz.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_home,node_upload_page,node_summary_page,node_ask_page,node_quiz_page,node_reflection_page toneBlue
class node_document_service,node_pdf_loader,node_chunker,node_embeddings,node_vector_store toneAmber
class node_summary_service,node_chat_service,node_quiz_service,node_reflection_service,node_openrouter toneMint
class node_ai_provider,node_quiz_message,node_session_state toneRose
class node_student,node_groq toneIndigo
```

## Components

### Learning interface

- [Home and navigation](https://github.com/roshini-nawanjala/studymate-ai/blob/main/app.py): `app.py`
- [Upload page](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Upload.py): `pages/Upload.py`
- [Summary page](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Summary.py): `pages/Summary.py`
- [Ask AI page](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Ask_AI.py): `pages/Ask_AI.py`
- [Quiz page](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Quiz.py): `pages/Quiz.py`
- [Reflection page](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Reflection.py): `pages/Reflection.py`

### Document and retrieval

- [Document processing](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/document_service.py): `services/document_service.py`
- [PDF extraction](https://github.com/roshini-nawanjala/studymate-ai/blob/main/utils/file_loader.py): `utils/file_loader.py`
- [Text chunking](https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/chunker.py): `rag/chunker.py`
- [Embedding model](https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/embeddings.py): `rag/embeddings.py`
- [Vector store](https://github.com/roshini-nawanjala/studymate-ai/blob/main/rag/vector_store.py): `rag/vector_store.py`

### Learning services

- [Summary generation](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/summary_service.py): `services/summary_service.py`
- [Grounded Q&A](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/chat_service.py): `services/chat_service.py`
- [Quiz and review](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/quiz_service.py): `services/quiz_service.py`
- [Learning reflection](https://github.com/roshini-nawanjala/studymate-ai/blob/main/services/reflection_service.py): `services/reflection_service.py`

### Agents and providers

- [Task-based routing](https://github.com/roshini-nawanjala/studymate-ai/blob/main/agents/ai_provider.py): `agents/ai_provider.py`
- [Quiz result protocol](https://github.com/roshini-nawanjala/studymate-ai/blob/main/agents/messages.py): `agents/messages.py`
- [Streamlit session state](https://github.com/roshini-nawanjala/studymate-ai/blob/main/pages/Quiz.py): `pages/Quiz.py`

### Other components

- **Student**
- **Groq**
- **OpenRouter**

## Connections

- Student → Home and navigation: opens
- Home and navigation → Upload page: navigates
- Home and navigation → Summary page: navigates
- Home and navigation → Ask AI page: navigates
- Home and navigation → Quiz page: navigates
- Home and navigation → Reflection page: navigates
- Student → Upload page: uploads PDF
- Upload page → Document processing: processes upload
- Document processing → PDF extraction: extracts text
- Document processing → Text chunking: splits text
- Document processing → Embedding model: encodes chunks
- Document processing → Vector store: stores chunks
- Summary page → Summary generation: requests summary
- Summary generation → Vector store: reads notes
- Summary generation → Task-based routing: requests model
- Ask AI page → Grounded Q&A: asks question
- Grounded Q&A → Vector store: searches notes
- Grounded Q&A → Task-based routing: requests model
- Quiz page → Quiz and review: generates and submits
- Quiz and review → Vector store: reads notes
- Quiz and review → Task-based routing: requests model
- Quiz and review → Quiz result protocol: builds result
- Quiz page → Streamlit session state: persists result
- Streamlit session state → Reflection page: provides result
- Reflection page → Learning reflection: requests reflection
- Learning reflection → Quiz result protocol: reads result
- Learning reflection → Vector store: reads notes
- Learning reflection → Task-based routing: requests model
- Task-based routing → Groq: routes tasks
- Task-based routing → OpenRouter: routes tasks
