# siddu-119/ai-studymate architecture

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

- Interactive diagram: https://gitdiagram.com/siddu-119/ai-studymate
- Repository: https://github.com/siddu-119/ai-studymate

## Overview

AI StudyMate is a student-facing learning companion. Students use its dashboard and study tools to organize tasks and notes, adjust settings, and request explanations, follow-ups, or quizzes. The AI workflow runs from a study page through the client API to the server, which can use built-in demo articles or Google Gemini. Local study data is persisted in browser storage. The excerpts show key frontend and server links; some page behavior and server routing details were not sampled, so those connections are omitted where evidence is insufficient.

Main entry points: [`client/src/context/AppContext.jsx`](https://github.com/siddu-119/ai-studymate/blob/main/client/src/context/AppContext.jsx) (App State), [`client/src/App.jsx`](https://github.com/siddu-119/ai-studymate/blob/main/client/src/App.jsx) (App Routes), [`client/src/components/Layout.jsx`](https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Layout.jsx) (Page Shell), [`client/src/lib/api.js`](https://github.com/siddu-119/ai-studymate/blob/main/client/src/lib/api.js) (Client API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client Experience"]
  node_app["App Routes<br/>[App.jsx]"]
  node_layout["Page Shell<br/>[Layout.jsx]"]
  node_sidebar["Navigation<br/>[Sidebar.jsx]"]
  node_topbar["Top Bar<br/>[TopBar.jsx]"]
  node_toasts["Notifications<br/>[Toasts.jsx]"]
end

subgraph group_study["Study Tools"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_assistant["AI Assistant<br/>[Assistant.jsx]"]
  node_quiz["Quiz Generator<br/>[Quiz.jsx]"]
  node_planner["Study Planner<br/>[Planner.jsx]"]
  node_notes["Study Notes<br/>[Notes.jsx]"]
  node_settings["Settings<br/>[Settings.jsx]"]
end

subgraph group_state["Local State"]
  node_context["App State<br/>[AppContext.jsx]"]
  node_storage[("Browser Storage<br/>[storage.js]")]
end

subgraph group_ai["AI Service"]
  node_api["Client API<br/>[api.js]"]
  node_server["AI API Server<br/>[index.js]"]
  node_demo["Demo Engine<br/>[demo.js]"]
  node_knowledge["Study Articles<br/>[knowledge.js]"]
  node_gemini{{"Google Gemini"}}
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"renders"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_assistant
node_app -->|"routes to"| node_quiz
node_app -->|"routes to"| node_planner
node_app -->|"routes to"| node_notes
node_app -->|"routes to"| node_settings
node_layout -->|"renders"| node_sidebar
node_layout -->|"renders"| node_topbar
node_layout -->|"renders"| node_toasts
node_sidebar -->|"reads status"| node_context
node_topbar -->|"reads state"| node_context
node_toasts -->|"reads notices"| node_context
node_dashboard -->|"reads study state"| node_context
node_assistant -->|"reads and updates"| node_context
node_quiz -->|"updates history"| node_context
node_planner -->|"reads and updates"| node_context
node_notes -->|"reads and updates"| node_context
node_settings -->|"reads and updates"| node_context
node_context -->|"loads and saves"| node_storage
node_context -->|"checks status"| node_api
node_assistant -->|"requests explanations"| node_api
node_quiz -->|"requests quizzes"| node_api
node_api -.->|"sends API requests"| node_server
node_server -->|"dispatches demo requests"| node_demo
node_demo -->|"finds article content"| node_knowledge
node_server -.->|"generates live results"| node_gemini

click node_app "https://github.com/siddu-119/ai-studymate/blob/main/client/src/App.jsx"
click node_layout "https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Layout.jsx"
click node_sidebar "https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Sidebar.jsx"
click node_topbar "https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/TopBar.jsx"
click node_toasts "https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Toasts.jsx"
click node_dashboard "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Dashboard.jsx"
click node_assistant "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Assistant.jsx"
click node_quiz "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Quiz.jsx"
click node_planner "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Planner.jsx"
click node_notes "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Notes.jsx"
click node_settings "https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Settings.jsx"
click node_context "https://github.com/siddu-119/ai-studymate/blob/main/client/src/context/AppContext.jsx"
click node_storage "https://github.com/siddu-119/ai-studymate/blob/main/client/src/lib/storage.js"
click node_api "https://github.com/siddu-119/ai-studymate/blob/main/client/src/lib/api.js"
click node_server "https://github.com/siddu-119/ai-studymate/blob/main/server/index.js"
click node_demo "https://github.com/siddu-119/ai-studymate/blob/main/server/demo.js"
click node_knowledge "https://github.com/siddu-119/ai-studymate/blob/main/server/knowledge.js"

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_layout,node_sidebar,node_topbar,node_toasts toneBlue
class node_dashboard,node_assistant,node_quiz,node_planner,node_notes,node_settings toneAmber
class node_context,node_storage toneMint
class node_api,node_server,node_demo,node_knowledge,node_gemini toneRose
class node_student toneIndigo
```

## Components

### Client Experience

- [App Routes](https://github.com/siddu-119/ai-studymate/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Page Shell](https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Layout.jsx): `client/src/components/Layout.jsx`
- [Navigation](https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Sidebar.jsx): `client/src/components/Sidebar.jsx`
- [Top Bar](https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/TopBar.jsx): `client/src/components/TopBar.jsx`
- [Notifications](https://github.com/siddu-119/ai-studymate/blob/main/client/src/components/Toasts.jsx): `client/src/components/Toasts.jsx`

### Study Tools

- [Dashboard](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [AI Assistant](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Assistant.jsx): `client/src/pages/Assistant.jsx`
- [Quiz Generator](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Quiz.jsx): `client/src/pages/Quiz.jsx`
- [Study Planner](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Planner.jsx): `client/src/pages/Planner.jsx`
- [Study Notes](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Notes.jsx): `client/src/pages/Notes.jsx`
- [Settings](https://github.com/siddu-119/ai-studymate/blob/main/client/src/pages/Settings.jsx): `client/src/pages/Settings.jsx`

### Local State

- [App State](https://github.com/siddu-119/ai-studymate/blob/main/client/src/context/AppContext.jsx): `client/src/context/AppContext.jsx`
- [Browser Storage](https://github.com/siddu-119/ai-studymate/blob/main/client/src/lib/storage.js): `client/src/lib/storage.js`

### AI Service

- [Client API](https://github.com/siddu-119/ai-studymate/blob/main/client/src/lib/api.js): `client/src/lib/api.js`
- [AI API Server](https://github.com/siddu-119/ai-studymate/blob/main/server/index.js): `server/index.js`
- [Demo Engine](https://github.com/siddu-119/ai-studymate/blob/main/server/demo.js): `server/demo.js`
- [Study Articles](https://github.com/siddu-119/ai-studymate/blob/main/server/knowledge.js): `server/knowledge.js`
- **Google Gemini**

### Other components

- **Student**

## Connections

- Student → App Routes: uses (evidence: `README.md`)
- App Routes → Page Shell: renders (evidence: `client/src/App.jsx`)
- App Routes → Dashboard: routes to (evidence: `client/src/App.jsx`)
- App Routes → AI Assistant: routes to (evidence: `client/src/App.jsx`)
- App Routes → Quiz Generator: routes to (evidence: `client/src/App.jsx`)
- App Routes → Study Planner: routes to (evidence: `client/src/App.jsx`)
- App Routes → Study Notes: routes to (evidence: `client/src/App.jsx`)
- App Routes → Settings: routes to (evidence: `client/src/App.jsx`)
- Page Shell → Navigation: renders (evidence: `client/src/components/Layout.jsx`)
- Page Shell → Top Bar: renders (evidence: `client/src/components/Layout.jsx`)
- Page Shell → Notifications: renders (evidence: `client/src/components/Layout.jsx`)
- Navigation → App State: reads status (evidence: `client/src/components/Sidebar.jsx`)
- Top Bar → App State: reads state (evidence: `client/src/components/TopBar.jsx`)
- Notifications → App State: reads notices (evidence: `client/src/components/Toasts.jsx`)
- Dashboard → App State: reads study state (evidence: `client/src/pages/Dashboard.jsx`)
- AI Assistant → App State: reads and updates (evidence: `client/src/pages/Assistant.jsx`)
- Quiz Generator → App State: updates history (evidence: `client/src/pages/Quiz.jsx`)
- Study Planner → App State: reads and updates (evidence: `client/src/pages/Planner.jsx`)
- Study Notes → App State: reads and updates (evidence: `client/src/pages/Notes.jsx`)
- Settings → App State: reads and updates (evidence: `client/src/pages/Settings.jsx`)
- App State → Browser Storage: loads and saves (evidence: `client/src/context/AppContext.jsx`)
- App State → Client API: checks status (evidence: `client/src/context/AppContext.jsx`)
- AI Assistant → Client API: requests explanations (evidence: `client/src/pages/Assistant.jsx`)
- Quiz Generator → Client API: requests quizzes (evidence: `client/src/pages/Quiz.jsx`)
- Client API → AI API Server: sends API requests
- AI API Server → Demo Engine: dispatches demo requests (evidence: `server/index.js`)
- Demo Engine → Study Articles: finds article content (evidence: `server/demo.js`)
- AI API Server → Google Gemini: generates live results (evidence: `README.md`)
