# sreevarshinidesa/notemind architecture

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

- Interactive diagram: https://gitdiagram.com/sreevarshinidesa/notemind
- Repository: https://github.com/sreevarshinidesa/notemind

## Overview

NoteMind is a full-stack notes and document-grounded Q&A app. Users authenticate, manage private notes, upload PDFs for text extraction and indexing, then ask questions about one PDF or search across all PDFs and receive grounded answers with sources. The graph follows the documented capabilities and backend upload/chat handlers; source excerpts do not include Chat.jsx or several model implementations, so those links are documented or marked unverified rather than inferred from unsampled code.

Main entry points: [`backend/index.js`](https://github.com/sreevarshinidesa/notemind/blob/main/backend/index.js) (HTTP routes), [`frontend/src/App.jsx`](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/App.jsx) (App and notes), [`frontend/src/Documents.jsx`](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Documents.jsx) (Document library), [`frontend/src/Auth.jsx`](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Auth.jsx) (Login form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App and notes<br/>[App.jsx]"]
  node_authui["Login form<br/>[Auth.jsx]"]
  node_documentsui["Document library<br/>[Documents.jsx]"]
  node_singlechat["PDF chat UI<br/>[Chat.jsx]"]
  node_allchat["Ask all UI<br/>[AskAll.jsx]"]
end

subgraph group_api["API and identity"]
  node_server["HTTP routes<br/>[index.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
  node_uploadmw["PDF upload validation<br/>[upload.js]"]
end

subgraph group_index["Document indexing and retrieval"]
  node_chunking["Text chunking<br/>[chunking.js]"]
  node_embedding["Embedding service<br/>[embeddings.js]"]
  node_similarity["Similarity ranking<br/>[similarity.js]"]
  node_pdfparser["PDF text extraction<br/>[index.js]"]
end

subgraph group_data["Persistent data"]
  node_userstore[("User records<br/>[User.js]")]
  node_notestore[("Notes<br/>[Note.js]")]
  node_docstore[("Documents<br/>[Document.js]")]
  node_chunkstore[("Embedded chunks<br/>[Chunk.js]")]
end

node_person(("User"))
node_gemini{{"Gemini API"}}
node_mongodb[("MongoDB")]

node_person -->|"uses"| node_app
node_app -->|"renders"| node_authui
node_app -->|"renders"| node_documentsui
node_app -->|"renders"| node_allchat
node_app -->|"requests notes"| node_server
node_authui -->|"posts credentials"| node_server
node_documentsui -->|"requests documents"| node_server
node_documentsui -->|"renders"| node_singlechat
node_singlechat -.->|"asks PDF"| node_server
node_allchat -.->|"asks all"| node_server
node_server -->|"protects routes"| node_authmw
node_server -->|"accepts PDF"| node_uploadmw
node_server -->|"reads and creates"| node_userstore
node_server -->|"manages notes"| node_notestore
node_server -->|"stores and reads"| node_docstore
node_server -->|"extracts text"| node_pdfparser
node_server -->|"splits text"| node_chunking
node_server -->|"embeds text"| node_embedding
node_server -->|"creates and queries"| node_chunkstore
node_server -->|"ranks chunks"| node_similarity
node_server -->|"generates answers"| node_gemini
node_embedding -->|"requests vectors"| node_gemini
node_server -->|"connects"| node_mongodb
node_userstore -.->|"persists in"| node_mongodb
node_notestore -.->|"persists in"| node_mongodb
node_docstore -.->|"persists in"| node_mongodb
node_chunkstore -.->|"persists in"| node_mongodb

click node_app "https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Auth.jsx"
click node_documentsui "https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Documents.jsx"
click node_singlechat "https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Chat.jsx"
click node_allchat "https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/AskAll.jsx"
click node_server "https://github.com/sreevarshinidesa/notemind/blob/main/backend/index.js"
click node_authmw "https://github.com/sreevarshinidesa/notemind/blob/main/backend/middleware/auth.js"
click node_uploadmw "https://github.com/sreevarshinidesa/notemind/blob/main/backend/middleware/upload.js"
click node_userstore "https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/User.js"
click node_notestore "https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Note.js"
click node_docstore "https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Document.js"
click node_chunkstore "https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Chunk.js"
click node_chunking "https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/chunking.js"
click node_embedding "https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/embeddings.js"
click node_similarity "https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/similarity.js"
click node_pdfparser "https://github.com/sreevarshinidesa/notemind/blob/main/backend/index.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_authui,node_documentsui,node_singlechat,node_allchat,node_person toneBlue
class node_server,node_authmw,node_uploadmw,node_mongodb toneAmber
class node_chunking,node_embedding,node_similarity,node_pdfparser,node_gemini toneMint
class node_userstore,node_notestore,node_docstore,node_chunkstore toneRose
```

## Components

### Web client

- [App and notes](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login form](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Auth.jsx): `frontend/src/Auth.jsx`
- [Document library](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Documents.jsx): `frontend/src/Documents.jsx`
- [PDF chat UI](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/Chat.jsx): `frontend/src/Chat.jsx`
- [Ask all UI](https://github.com/sreevarshinidesa/notemind/blob/main/frontend/src/AskAll.jsx): `frontend/src/AskAll.jsx`

### API and identity

- [HTTP routes](https://github.com/sreevarshinidesa/notemind/blob/main/backend/index.js): `backend/index.js`
- [JWT middleware](https://github.com/sreevarshinidesa/notemind/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [PDF upload validation](https://github.com/sreevarshinidesa/notemind/blob/main/backend/middleware/upload.js): `backend/middleware/upload.js`

### Document indexing and retrieval

- [Text chunking](https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/chunking.js): `backend/utils/chunking.js`
- [Embedding service](https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/embeddings.js): `backend/utils/embeddings.js`
- [Similarity ranking](https://github.com/sreevarshinidesa/notemind/blob/main/backend/utils/similarity.js): `backend/utils/similarity.js`
- [PDF text extraction](https://github.com/sreevarshinidesa/notemind/blob/main/backend/index.js): `backend/index.js`

### Persistent data

- [User records](https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/User.js): `backend/models/User.js`
- [Notes](https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Note.js): `backend/models/Note.js`
- [Documents](https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Document.js): `backend/models/Document.js`
- [Embedded chunks](https://github.com/sreevarshinidesa/notemind/blob/main/backend/models/Chunk.js): `backend/models/Chunk.js`

### Other components

- **User**
- **Gemini API**
- **MongoDB**

## Connections

- User → App and notes: uses (evidence: `README.md`)
- App and notes → Login form: renders (evidence: `frontend/src/App.jsx`)
- App and notes → Document library: renders (evidence: `frontend/src/App.jsx`)
- App and notes → Ask all UI: renders (evidence: `frontend/src/App.jsx`)
- App and notes → HTTP routes: requests notes (evidence: `frontend/src/App.jsx`)
- Login form → HTTP routes: posts credentials (evidence: `frontend/src/Auth.jsx`)
- Document library → HTTP routes: requests documents (evidence: `frontend/src/Documents.jsx`)
- Document library → PDF chat UI: renders (evidence: `frontend/src/Documents.jsx`)
- PDF chat UI → HTTP routes: asks PDF (evidence: `README.md`)
- Ask all UI → HTTP routes: asks all (evidence: `README.md`)
- HTTP routes → JWT middleware: protects routes (evidence: `backend/index.js`)
- HTTP routes → PDF upload validation: accepts PDF (evidence: `backend/index.js`)
- HTTP routes → User records: reads and creates (evidence: `backend/index.js`)
- HTTP routes → Notes: manages notes (evidence: `backend/index.js`)
- HTTP routes → Documents: stores and reads (evidence: `backend/index.js`)
- HTTP routes → PDF text extraction: extracts text (evidence: `backend/index.js`)
- HTTP routes → Text chunking: splits text (evidence: `backend/index.js`)
- HTTP routes → Embedding service: embeds text (evidence: `backend/index.js`)
- HTTP routes → Embedded chunks: creates and queries (evidence: `backend/index.js`)
- HTTP routes → Similarity ranking: ranks chunks (evidence: `backend/index.js`)
- HTTP routes → Gemini API: generates answers (evidence: `backend/index.js`)
- Embedding service → Gemini API: requests vectors (evidence: `backend/utils/embeddings.js`)
- HTTP routes → MongoDB: connects (evidence: `backend/index.js`)
- User records → MongoDB: persists in
- Notes → MongoDB: persists in
- Documents → MongoDB: persists in
- Embedded chunks → MongoDB: persists in
