# rahul5977/studybot architecture

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

- Interactive diagram: https://gitdiagram.com/rahul5977/studybot
- Repository: https://github.com/rahul5977/studybot

## Overview

StudyBuddy AI turns uploaded study documents into searchable context for AI tutoring and related learning tools. The main flow runs from the learner through the React interface and API to document processing or chat orchestration, then returns answers and learning outputs. The README also describes plans, flashcards, web search, and progress analytics; some branches are documented but their implementations were not sampled, so only evidenced connections are drawn. Backend code excerpts are partial, limiting visibility into some processing and agent interactions.

Main entry points: [`frontend/src/pages/Home.jsx`](https://github.com/rahul5977/studybot/blob/main/frontend/src/pages/Home.jsx) (Study Workspace), [`backend/app/api/routes_chat.py`](https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_chat.py) (Chat Routes), [`backend/app/agents/conductor.py`](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/conductor.py) (Conductor Agent), [`backend/app/services/simple_rag.py`](https://github.com/rahul5977/studybot/blob/main/backend/app/services/simple_rag.py) (Simple RAG)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Study Interface"]
  node_home["Study Workspace<br/>[Home.jsx]"]
  node_upload_ui["Document Upload<br/>[UploadForm.jsx]"]
  node_chat_ui["Tutor Chat<br/>[ChatBox.jsx]"]
  node_plans_ui["Plan Editor<br/>[PlanEditor.jsx]"]
  node_steps_ui["Workflow View"]
  node_dashboard["Progress Dashboard<br/>[Dashboard.jsx]"]
  node_cards_ui["Flashcard Review<br/>[Flashcards.jsx]"]
  node_api_client["API Client<br/>[api.js]"]
end

subgraph group_api["API Routes"]
  node_doc_routes["Document Routes<br/>[routes_docs.py]"]
  node_chat_routes["Chat Routes<br/>[routes_chat.py]"]
  node_plan_routes["Plan Routes<br/>[routes_plan.py]"]
  node_flash_routes["Flashcard Routes"]
end

subgraph group_ai["Learning AI"]
  node_conductor["Conductor Agent<br/>[conductor.py]"]
  node_tutor["Tutor Agent<br/>[tutor.py]"]
  node_planner["Planner Agent<br/>[planner.py]"]
  node_search["Web Search Agent<br/>[search_agent.py]"]
  node_flash_agent["Flashcard Agent<br/>[flashcards.py]"]
end

subgraph group_knowledge["Document Knowledge"]
  node_retrieval["Simple RAG<br/>[simple_rag.py]"]
  node_chunker["Document Chunking<br/>[chunker.py]"]
  node_embeddings["Embedding Service<br/>[embeddings.py]"]
end

subgraph group_infra["State and Integrations"]
  node_vector_db[("Qdrant Vector Store<br/>[db.py]")]
  node_config["Application Settings<br/>[config.py]"]
  node_interaction_log[("Interaction Logger<br/>[logger.py]")]
end

node_learner(("Learner"))
node_openai{{"OpenAI API"}}
node_tavily{{"Tavily Search"}}

node_learner -->|"uses"| node_home
node_home -->|"shows"| node_upload_ui
node_home -->|"shows"| node_chat_ui
node_home -->|"shows"| node_dashboard
node_home -->|"shows"| node_cards_ui
node_home -->|"shows"| node_steps_ui
node_home -->|"shows"| node_plans_ui
node_home -->|"requests plans"| node_api_client
node_upload_ui -.->|"uploads files"| node_api_client
node_chat_ui -->|"sends chat"| node_api_client
node_api_client -->|"calls document API"| node_doc_routes
node_api_client -->|"calls chat API"| node_chat_routes
node_api_client -->|"calls plan API"| node_plan_routes
node_doc_routes -->|"chunks documents"| node_chunker
node_doc_routes -.->|"creates embeddings"| node_embeddings
node_doc_routes -->|"stores chunks"| node_vector_db
node_chat_routes -->|"orchestrates query"| node_conductor
node_chat_routes -->|"processes simple RAG"| node_retrieval
node_chat_routes -->|"enhances answer"| node_tutor
node_chat_routes -->|"generates cards"| node_flash_agent
node_chat_routes -->|"logs interaction"| node_interaction_log
node_plan_routes -->|"creates plan"| node_conductor
node_plan_routes -->|"refines plan"| node_planner
node_flash_routes -->|"handles cards"| node_flash_agent
node_conductor -->|"delegates planning"| node_planner
node_conductor -->|"delegates search"| node_search
node_conductor -->|"retrieves context"| node_retrieval
node_retrieval -->|"embeds query"| node_embeddings
node_retrieval -->|"queries chunks"| node_vector_db
node_retrieval -.->|"generates response"| node_openai
node_embeddings -->|"creates vectors"| node_openai
node_search -.->|"searches web"| node_tavily
node_conductor -.->|"uses language model"| node_openai
node_home -->|"renders plans"| node_plans_ui
node_home -->|"renders steps"| node_steps_ui
node_retrieval -->|"reads limits"| node_config
node_embeddings -->|"reads credentials"| node_config

click node_home "https://github.com/rahul5977/studybot/blob/main/frontend/src/pages/Home.jsx"
click node_upload_ui "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/UploadForm.jsx"
click node_chat_ui "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/ChatBox.jsx"
click node_plans_ui "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/PlanEditor.jsx"
click node_steps_ui "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/StepsVisualizer.jsx"
click node_dashboard "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/Dashboard.jsx"
click node_cards_ui "https://github.com/rahul5977/studybot/blob/main/frontend/src/components/Flashcards.jsx"
click node_api_client "https://github.com/rahul5977/studybot/blob/main/frontend/src/utils/api.js"
click node_doc_routes "https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_docs.py"
click node_chat_routes "https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_chat.py"
click node_plan_routes "https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_plan.py"
click node_flash_routes "https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_flashcards.py"
click node_conductor "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/conductor.py"
click node_tutor "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/tutor.py"
click node_planner "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/planner.py"
click node_search "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/search_agent.py"
click node_flash_agent "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/flashcards.py"
click node_retrieval "https://github.com/rahul5977/studybot/blob/main/backend/app/services/simple_rag.py"
click node_chunker "https://github.com/rahul5977/studybot/blob/main/backend/app/agents/chunker.py"
click node_embeddings "https://github.com/rahul5977/studybot/blob/main/backend/app/core/embeddings.py"
click node_vector_db "https://github.com/rahul5977/studybot/blob/main/backend/app/core/db.py"
click node_config "https://github.com/rahul5977/studybot/blob/main/backend/app/core/config.py"
click node_interaction_log "https://github.com/rahul5977/studybot/blob/main/backend/app/core/logger.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_ui,node_chat_ui,node_plans_ui,node_steps_ui,node_dashboard,node_cards_ui,node_api_client toneBlue
class node_doc_routes,node_chat_routes,node_plan_routes,node_flash_routes toneAmber
class node_conductor,node_tutor,node_planner,node_search,node_flash_agent,node_openai toneMint
class node_retrieval,node_chunker,node_embeddings toneRose
class node_vector_db,node_config,node_interaction_log,node_learner,node_tavily toneIndigo
```

## Components

### Study Interface

- [Study Workspace](https://github.com/rahul5977/studybot/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Document Upload](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/UploadForm.jsx): `frontend/src/components/UploadForm.jsx`
- [Tutor Chat](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/ChatBox.jsx): `frontend/src/components/ChatBox.jsx`
- [Plan Editor](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/PlanEditor.jsx): `frontend/src/components/PlanEditor.jsx`
- [Workflow View](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/StepsVisualizer.jsx): `frontend/src/components/StepsVisualizer.jsx`
- [Progress Dashboard](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [Flashcard Review](https://github.com/rahul5977/studybot/blob/main/frontend/src/components/Flashcards.jsx): `frontend/src/components/Flashcards.jsx`
- [API Client](https://github.com/rahul5977/studybot/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`

### API Routes

- [Document Routes](https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_docs.py): `backend/app/api/routes_docs.py`
- [Chat Routes](https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_chat.py): `backend/app/api/routes_chat.py`
- [Plan Routes](https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_plan.py): `backend/app/api/routes_plan.py`
- [Flashcard Routes](https://github.com/rahul5977/studybot/blob/main/backend/app/api/routes_flashcards.py): `backend/app/api/routes_flashcards.py`

### Learning AI

- [Conductor Agent](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/conductor.py): `backend/app/agents/conductor.py`
- [Tutor Agent](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/tutor.py): `backend/app/agents/tutor.py`
- [Planner Agent](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/planner.py): `backend/app/agents/planner.py`
- [Web Search Agent](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/search_agent.py): `backend/app/agents/search_agent.py`
- [Flashcard Agent](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/flashcards.py): `backend/app/agents/flashcards.py`

### Document Knowledge

- [Simple RAG](https://github.com/rahul5977/studybot/blob/main/backend/app/services/simple_rag.py): `backend/app/services/simple_rag.py`
- [Document Chunking](https://github.com/rahul5977/studybot/blob/main/backend/app/agents/chunker.py): `backend/app/agents/chunker.py`
- [Embedding Service](https://github.com/rahul5977/studybot/blob/main/backend/app/core/embeddings.py): `backend/app/core/embeddings.py`

### State and Integrations

- [Qdrant Vector Store](https://github.com/rahul5977/studybot/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Application Settings](https://github.com/rahul5977/studybot/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Interaction Logger](https://github.com/rahul5977/studybot/blob/main/backend/app/core/logger.py): `backend/app/core/logger.py`

### Other components

- **Learner**
- **OpenAI API**
- **Tavily Search**

## Connections

- Learner → Study Workspace: uses
- Study Workspace → Document Upload: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Tutor Chat: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Progress Dashboard: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Flashcard Review: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Workflow View: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Plan Editor: shows (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → API Client: requests plans (evidence: `frontend/src/pages/Home.jsx`)
- Document Upload → API Client: uploads files
- Tutor Chat → API Client: sends chat (evidence: `frontend/src/components/ChatBox.jsx`)
- API Client → Document Routes: calls document API (evidence: `frontend/src/utils/api.js`)
- API Client → Chat Routes: calls chat API (evidence: `frontend/src/utils/api.js`)
- API Client → Plan Routes: calls plan API (evidence: `frontend/src/utils/api.js`)
- Document Routes → Document Chunking: chunks documents (evidence: `backend/app/api/routes_docs.py`)
- Document Routes → Embedding Service: creates embeddings (evidence: `backend/app/api/routes_docs.py`)
- Document Routes → Qdrant Vector Store: stores chunks (evidence: `backend/app/api/routes_docs.py`)
- Chat Routes → Conductor Agent: orchestrates query (evidence: `backend/app/api/routes_chat.py`)
- Chat Routes → Simple RAG: processes simple RAG (evidence: `backend/app/api/routes_chat.py`)
- Chat Routes → Tutor Agent: enhances answer (evidence: `backend/app/api/routes_chat.py`)
- Chat Routes → Flashcard Agent: generates cards (evidence: `backend/app/api/routes_chat.py`)
- Chat Routes → Interaction Logger: logs interaction (evidence: `backend/app/api/routes_chat.py`)
- Plan Routes → Conductor Agent: creates plan (evidence: `backend/app/api/routes_plan.py`)
- Plan Routes → Planner Agent: refines plan (evidence: `backend/app/api/routes_plan.py`)
- Flashcard Routes → Flashcard Agent: handles cards (evidence: `backend/app/api/routes_flashcards.py`)
- Conductor Agent → Planner Agent: delegates planning (evidence: `backend/app/agents/conductor.py`)
- Conductor Agent → Web Search Agent: delegates search (evidence: `backend/app/agents/conductor.py`)
- Conductor Agent → Simple RAG: retrieves context (evidence: `backend/app/agents/conductor.py`)
- Simple RAG → Embedding Service: embeds query (evidence: `backend/app/services/simple_rag.py`)
- Simple RAG → Qdrant Vector Store: queries chunks (evidence: `backend/app/services/simple_rag.py`)
- Simple RAG → OpenAI API: generates response
- Embedding Service → OpenAI API: creates vectors (evidence: `backend/app/core/embeddings.py`)
- Web Search Agent → Tavily Search: searches web
- Conductor Agent → OpenAI API: uses language model
- Study Workspace → Plan Editor: renders plans (evidence: `frontend/src/pages/Home.jsx`)
- Study Workspace → Workflow View: renders steps (evidence: `frontend/src/pages/Home.jsx`)
- Simple RAG → Application Settings: reads limits (evidence: `backend/app/services/simple_rag.py`)
- Embedding Service → Application Settings: reads credentials (evidence: `backend/app/core/embeddings.py`)
