# atharvkolte/edugpt architecture

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

- Interactive diagram: https://gitdiagram.com/atharvkolte/edugpt
- Repository: https://github.com/atharvkolte/edugpt

## Overview

eduGPT combines a React study interface with Python services for educational chat and image retrieval. The student workflow is login, enter a question, and receive a chat response; chat builds context from short- and long-term memory, invokes an LLM agent, and stores the exchange. The frontend also provides study visualizers and chat history, while teacher-facing planning and notifications are separate capabilities. The README describes Image RAG, but the sampled frontend and image service expose no verified connection between them; that integration is therefore shown as unverified.

Main entry points: [`frontend/src/pages/Home.tsx`](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/pages/Home.tsx) (Role-based home), [`frontend/src/components/MainContent.tsx`](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/MainContent.tsx) (Chat workspace), [`backend/chat/GPTv2.py`](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/GPTv2.py) (Educational agent), [`frontend/src/context/NotificationContext.tsx`](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/context/NotificationContext.tsx) (Notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Study interface"]
  node_app["Route and access<br/>[App.tsx]"]
  node_home["Role-based home<br/>[Home.tsx]"]
  node_login["Login<br/>[Login.tsx]"]
  node_chat_ui["Chat workspace<br/>[MainContent.tsx]"]
  node_chat_state["Chat threads<br/>[ChatContext.tsx]"]
  node_sidebar["Thread sidebar<br/>[Sidebar.tsx]"]
  node_speech["Speech input<br/>[speechToText.tsx]"]
  node_visualizers["Study visualizers"]
  node_calendar["Weekly planner<br/>[CalendarPanel.tsx]"]
  node_notifications["Notifications"]
  node_island["Notification display<br/>[DynamicIsland.tsx]"]
  node_right_panel["Study side panel<br/>[RightPanel.tsx]"]
end

subgraph group_chat["Conversational AI"]
  node_chat_api["Chat API<br/>[main.py]"]
  node_gpt["Educational agent<br/>[GPTv2.py]"]
  node_weather["Weather tool<br/>[weather.py]"]
end

subgraph group_memory["Conversation memory"]
  node_stm["Short-term memory<br/>[STM.py]"]
  node_summary["Memory summarizer<br/>[summary.py]"]
  node_ltm["Long-term memory<br/>[LTM.py]"]
end

subgraph group_images["Image retrieval"]
  node_image_app["Image RAG service<br/>[app.py]"]
  node_image_search["Image search"]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_pg[("PostgreSQL")]
node_ollama["Ollama models"]
node_serpapi["SerpAPI"]
node_browser_storage[("Browser storage")]

node_student -->|"opens"| node_app
node_teacher -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_home
node_home -->|"renders"| node_chat_ui
node_home -->|"renders"| node_sidebar
node_home -->|"renders"| node_calendar
node_home -->|"renders"| node_island
node_home -->|"renders"| node_right_panel
node_home -->|"provides"| node_chat_state
node_home -->|"provides"| node_notifications
node_chat_ui -->|"uses"| node_chat_state
node_sidebar -->|"uses"| node_chat_state
node_chat_ui -->|"renders"| node_speech
node_chat_ui -->|"renders"| node_visualizers
node_chat_ui -->|"posts chat"| node_chat_api
node_chat_ui -.->|"posts search"| node_image_app
node_chat_ui -->|"notifies"| node_notifications
node_calendar -->|"notifies"| node_notifications
node_island -->|"reads"| node_notifications
node_chat_state -->|"persists threads"| node_browser_storage
node_notifications -->|"persists history"| node_browser_storage
node_chat_api -->|"invokes"| node_gpt
node_gpt -->|"reads and writes"| node_stm
node_gpt -->|"retrieves and extracts"| node_ltm
node_gpt -->|"registers tool"| node_weather
node_stm -->|"summarizes"| node_summary
node_ltm -->|"reads recent memory"| node_stm
node_stm -->|"reads and writes"| node_pg
node_ltm -->|"reads and writes"| node_pg
node_ltm -->|"embeds and extracts"| node_ollama
node_summary -->|"summarizes with"| node_ollama
node_gpt -->|"generates with"| node_ollama
node_image_app -->|"uses"| node_image_search
node_image_search -->|"searches"| node_serpapi

click node_app "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/App.tsx"
click node_home "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/pages/Home.tsx"
click node_login "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/pages/Login.tsx"
click node_chat_ui "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/MainContent.tsx"
click node_chat_state "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/context/ChatContext.tsx"
click node_sidebar "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/Sidebar.tsx"
click node_speech "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/speechToText.tsx"
click node_visualizers "https://github.com/atharvkolte/edugpt/tree/main/frontend/src/components/visualizers"
click node_calendar "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/CalendarPanel.tsx"
click node_notifications "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/context/NotificationContext.tsx"
click node_island "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/DynamicIsland.tsx"
click node_right_panel "https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/RightPanel.tsx"
click node_chat_api "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/main.py"
click node_gpt "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/GPTv2.py"
click node_weather "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/tools/weather.py"
click node_stm "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/memory_manager/STM.py"
click node_summary "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/tools/summary.py"
click node_ltm "https://github.com/atharvkolte/edugpt/blob/main/backend/chat/memory_manager/LTM.py"
click node_image_app "https://github.com/atharvkolte/edugpt/blob/main/backend/img_rag/app.py"
click node_image_search "https://github.com/atharvkolte/edugpt/blob/main/backend/img_rag/serpapi_image_search.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_home,node_login,node_chat_ui,node_chat_state,node_sidebar,node_speech,node_visualizers,node_calendar,node_notifications,node_island,node_right_panel toneBlue
class node_chat_api,node_gpt,node_weather,node_pg,node_browser_storage toneAmber
class node_stm,node_summary,node_ltm,node_serpapi toneMint
class node_image_app,node_image_search toneRose
class node_student,node_teacher,node_ollama toneIndigo
```

## Components

### Study interface

- [Route and access](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Role-based home](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/pages/Home.tsx): `frontend/src/pages/Home.tsx`
- [Login](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Chat workspace](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/MainContent.tsx): `frontend/src/components/MainContent.tsx`
- [Chat threads](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/context/ChatContext.tsx): `frontend/src/context/ChatContext.tsx`
- [Thread sidebar](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/Sidebar.tsx): `frontend/src/components/Sidebar.tsx`
- [Speech input](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/speechToText.tsx): `frontend/src/components/speechToText.tsx`
- [Study visualizers](https://github.com/atharvkolte/edugpt/tree/main/frontend/src/components/visualizers): `frontend/src/components/visualizers`
- [Weekly planner](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/CalendarPanel.tsx): `frontend/src/components/CalendarPanel.tsx`
- [Notifications](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/context/NotificationContext.tsx): `frontend/src/context/NotificationContext.tsx`
- [Notification display](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/DynamicIsland.tsx): `frontend/src/components/DynamicIsland.tsx`
- [Study side panel](https://github.com/atharvkolte/edugpt/blob/main/frontend/src/components/RightPanel.tsx): `frontend/src/components/RightPanel.tsx`

### Conversational AI

- [Chat API](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/main.py): `backend/chat/main.py`
- [Educational agent](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/GPTv2.py): `backend/chat/GPTv2.py`
- [Weather tool](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/tools/weather.py): `backend/chat/tools/weather.py`

### Conversation memory

- [Short-term memory](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/memory_manager/STM.py): `backend/chat/memory_manager/STM.py`
- [Memory summarizer](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/tools/summary.py): `backend/chat/tools/summary.py`
- [Long-term memory](https://github.com/atharvkolte/edugpt/blob/main/backend/chat/memory_manager/LTM.py): `backend/chat/memory_manager/LTM.py`

### Image retrieval

- [Image RAG service](https://github.com/atharvkolte/edugpt/blob/main/backend/img_rag/app.py): `backend/img_rag/app.py`
- [Image search](https://github.com/atharvkolte/edugpt/blob/main/backend/img_rag/serpapi_image_search.py): `backend/img_rag/serpapi_image_search.py`

### Other components

- **Student**
- **Teacher**
- **PostgreSQL**
- **Ollama models**
- **SerpAPI**
- **Browser storage**

## Connections

- Student → Route and access: opens (evidence: `frontend/src/App.tsx`)
- Teacher → Route and access: opens (evidence: `frontend/src/App.tsx`)
- Route and access → Login: routes to (evidence: `frontend/src/App.tsx`)
- Route and access → Role-based home: routes to (evidence: `frontend/src/App.tsx`)
- Role-based home → Chat workspace: renders (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Thread sidebar: renders (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Weekly planner: renders (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Notification display: renders (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Study side panel: renders (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Chat threads: provides (evidence: `frontend/src/pages/Home.tsx`)
- Role-based home → Notifications: provides (evidence: `frontend/src/pages/Home.tsx`)
- Chat workspace → Chat threads: uses (evidence: `frontend/src/components/MainContent.tsx`)
- Thread sidebar → Chat threads: uses (evidence: `frontend/src/components/Sidebar.tsx`)
- Chat workspace → Speech input: renders (evidence: `frontend/src/components/MainContent.tsx`)
- Chat workspace → Study visualizers: renders (evidence: `frontend/src/components/MainContent.tsx`)
- Chat workspace → Chat API: posts chat (evidence: `frontend/src/components/MainContent.tsx`)
- Chat workspace → Image RAG service: posts search
- Chat workspace → Notifications: notifies (evidence: `frontend/src/components/MainContent.tsx`)
- Weekly planner → Notifications: notifies (evidence: `frontend/src/components/CalendarPanel.tsx`)
- Notification display → Notifications: reads (evidence: `frontend/src/components/DynamicIsland.tsx`)
- Chat threads → Browser storage: persists threads (evidence: `frontend/src/context/ChatContext.tsx`)
- Notifications → Browser storage: persists history (evidence: `frontend/src/context/NotificationContext.tsx`)
- Chat API → Educational agent: invokes (evidence: `backend/chat/main.py`)
- Educational agent → Short-term memory: reads and writes (evidence: `backend/chat/GPTv2.py`)
- Educational agent → Long-term memory: retrieves and extracts (evidence: `backend/chat/GPTv2.py`)
- Educational agent → Weather tool: registers tool (evidence: `backend/chat/GPTv2.py`)
- Short-term memory → Memory summarizer: summarizes (evidence: `backend/chat/memory_manager/STM.py`)
- Long-term memory → Short-term memory: reads recent memory (evidence: `backend/chat/memory_manager/LTM.py`)
- Short-term memory → PostgreSQL: reads and writes (evidence: `backend/chat/memory_manager/STM.py`)
- Long-term memory → PostgreSQL: reads and writes (evidence: `backend/chat/memory_manager/LTM.py`)
- Long-term memory → Ollama models: embeds and extracts (evidence: `backend/chat/memory_manager/LTM.py`)
- Memory summarizer → Ollama models: summarizes with (evidence: `backend/chat/tools/summary.py`)
- Educational agent → Ollama models: generates with (evidence: `backend/chat/GPTv2.py`)
- Image RAG service → Image search: uses (evidence: `backend/img_rag/app.py`)
- Image search → SerpAPI: searches (evidence: `backend/img_rag/serpapi_image_search.py`)
