# honey-singh716/mindmate-ai architecture

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

- Interactive diagram: https://gitdiagram.com/honey-singh716/mindmate-ai
- Repository: https://github.com/honey-singh716/mindmate-ai

## Overview

MindMate AI is a learning assistant whose main workflow runs from an authenticated learner’s chat or document upload through the Node API to Groq and PostgreSQL. For document-grounded answers, the backend extracts and chunks PDFs, embeds and stores their content, then retrieves relevant passages for chat responses with citations. The React client also exposes study planning and study tools, while the backend provides live model selection and persistent conversations. Some route implementations are excerpted only partially; links for those capabilities rely on README documentation.

Main entry points: [`server.js`](https://github.com/honey-singh716/mindmate-ai/blob/main/server.js) (HTTP API and workflows), [`frontend/src/App.jsx`](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/App.jsx) (App state), [`db.js`](https://github.com/honey-singh716/mindmate-ai/blob/main/db.js) (PostgreSQL store and retrieval), [`frontend/src/api.js`](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Learning client"]
  node_app["App state<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_chat_ui["Chat interface<br/>[AIChatView.jsx]"]
  node_documents_ui["Documents view<br/>[DocumentsView.jsx]"]
  node_planner_ui["Study planner"]
  node_tools_ui["Study tools<br/>[StudyToolsView.jsx]"]
  node_auth_ui["Authentication UI<br/>[AuthModal.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP API and workflows<br/>[server.js]"]
end

subgraph group_rag["Document retrieval"]
  node_rag_pipeline["RAG chunking and context<br/>[rag.js]"]
  node_embeddings["Embeddings<br/>[embeddings.js]"]
end

subgraph group_services["Models and persistence"]
  node_database[("PostgreSQL store and retrieval<br/>[db.js]")]
  node_system_design["Chat support services<br/>[systemDesign.js]"]
  node_models["Groq model service<br/>[models.js]"]
end

node_learner(("Learner"))
node_groq{{"Groq API"}}
node_postgres[("PostgreSQL")]
node_pdf["PDF text extraction"]

node_learner -->|"uses"| node_app
node_app -->|"requests through"| node_api_client
node_app -->|"renders"| node_chat_ui
node_app -->|"renders"| node_documents_ui
node_app -->|"renders"| node_planner_ui
node_app -->|"renders"| node_tools_ui
node_app -->|"renders"| node_auth_ui
node_api_client -->|"calls API"| node_server
node_server -->|"reads and writes"| node_database
node_database -->|"queries"| node_postgres
node_server -->|"chunks and builds context"| node_rag_pipeline
node_server -->|"embeds text"| node_embeddings
node_server -->|"extracts text"| node_pdf
node_server -->|"generates answers"| node_groq
node_server -->|"fetches model list"| node_models
node_server -->|"uses chat support"| node_system_design
node_server -->|"stores conversations"| node_database

click node_app "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/api.js"
click node_chat_ui "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/AIChatView.jsx"
click node_documents_ui "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/DocumentsView.jsx"
click node_planner_ui "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/StudyPlannerView.jsx"
click node_tools_ui "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/StudyToolsView.jsx"
click node_auth_ui "https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/AuthModal.jsx"
click node_server "https://github.com/honey-singh716/mindmate-ai/blob/main/server.js"
click node_rag_pipeline "https://github.com/honey-singh716/mindmate-ai/blob/main/rag.js"
click node_embeddings "https://github.com/honey-singh716/mindmate-ai/blob/main/embeddings.js"
click node_database "https://github.com/honey-singh716/mindmate-ai/blob/main/db.js"
click node_system_design "https://github.com/honey-singh716/mindmate-ai/blob/main/systemDesign.js"
click node_models "https://github.com/honey-singh716/mindmate-ai/blob/main/models.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_api_client,node_chat_ui,node_documents_ui,node_planner_ui,node_tools_ui,node_auth_ui toneBlue
class node_server,node_postgres toneAmber
class node_rag_pipeline,node_embeddings,node_groq toneMint
class node_database,node_system_design,node_models toneRose
class node_learner,node_pdf toneIndigo
```

## Components

### Learning client

- [App state](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Chat interface](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/AIChatView.jsx): `frontend/src/components/AIChatView.jsx`
- [Documents view](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/DocumentsView.jsx): `frontend/src/components/DocumentsView.jsx`
- [Study planner](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/StudyPlannerView.jsx): `frontend/src/components/StudyPlannerView.jsx`
- [Study tools](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/StudyToolsView.jsx): `frontend/src/components/StudyToolsView.jsx`
- [Authentication UI](https://github.com/honey-singh716/mindmate-ai/blob/main/frontend/src/components/AuthModal.jsx): `frontend/src/components/AuthModal.jsx`

### Backend API

- [HTTP API and workflows](https://github.com/honey-singh716/mindmate-ai/blob/main/server.js): `server.js`

### Document retrieval

- [RAG chunking and context](https://github.com/honey-singh716/mindmate-ai/blob/main/rag.js): `rag.js`
- [Embeddings](https://github.com/honey-singh716/mindmate-ai/blob/main/embeddings.js): `embeddings.js`

### Models and persistence

- [PostgreSQL store and retrieval](https://github.com/honey-singh716/mindmate-ai/blob/main/db.js): `db.js`
- [Chat support services](https://github.com/honey-singh716/mindmate-ai/blob/main/systemDesign.js): `systemDesign.js`
- [Groq model service](https://github.com/honey-singh716/mindmate-ai/blob/main/models.js): `models.js`

### Other components

- **Learner**
- **Groq API**
- **PostgreSQL**
- **PDF text extraction**

## Connections

- Learner → App state: uses (evidence: `README.md`)
- App state → API client: requests through (evidence: `frontend/src/App.jsx`)
- App state → Chat interface: renders (evidence: `frontend/src/App.jsx`)
- App state → Documents view: renders (evidence: `frontend/src/App.jsx`)
- App state → Study planner: renders (evidence: `frontend/src/App.jsx`)
- App state → Study tools: renders (evidence: `frontend/src/App.jsx`)
- App state → Authentication UI: renders (evidence: `frontend/src/App.jsx`)
- API client → HTTP API and workflows: calls API (evidence: `README.md`)
- HTTP API and workflows → PostgreSQL store and retrieval: reads and writes (evidence: `README.md`)
- PostgreSQL store and retrieval → PostgreSQL: queries (evidence: `db.js`)
- HTTP API and workflows → RAG chunking and context: chunks and builds context (evidence: `README.md`)
- HTTP API and workflows → Embeddings: embeds text (evidence: `README.md`)
- HTTP API and workflows → PDF text extraction: extracts text (evidence: `server.js`)
- HTTP API and workflows → Groq API: generates answers (evidence: `README.md`)
- HTTP API and workflows → Groq model service: fetches model list (evidence: `server.js`)
- HTTP API and workflows → Chat support services: uses chat support (evidence: `server.js`)
- HTTP API and workflows → PostgreSQL store and retrieval: stores conversations (evidence: `README.md`)
