# pranjaliingle293/papermind-ai architecture

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

- Interactive diagram: https://gitdiagram.com/pranjaliingle293/papermind-ai
- Repository: https://github.com/pranjaliingle293/papermind-ai

## Overview

PaperMind AI lets researchers upload papers, receive structured, paper-grounded analysis, and explore results through a dashboard and paper chat. The backend coordinates PDF validation, text extraction and preparation, AI analysis, persistence, and retrieval; authentication and activity metrics support the broader experience. The README also documents literature review, analysis tabs, and presentation/report capabilities. Some frontend networking and route details were not sampled, so those links are omitted or marked unverified rather than inferred.

Main entry points: [`server/src/index.js`](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/index.js) (Express API entry), [`server/src/routes/papers.js`](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/papers.js) (Paper operations), [`server/src/routes/dashboard.js`](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/dashboard.js) (Dashboard activity), [`src/components/Dashboard.jsx`](https://github.com/pranjaliingle293/papermind-ai/blob/main/src/components/Dashboard.jsx) (Dashboard and paper views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Research workspace"]
  node_app["App shell and sign-in<br/>[App.jsx]"]
  node_workspace["Dashboard and paper views<br/>[Dashboard.jsx]"]
end

subgraph group_api["Application API"]
  node_api_server["Express API entry<br/>[index.js]"]
  node_auth_routes["Signup and admin<br/>[auth.js]"]
  node_paper_routes["Paper operations<br/>[papers.js]"]
  node_dashboard_routes["Dashboard activity<br/>[dashboard.js]"]
  node_health["Health endpoint<br/>[health.js]"]
  node_auth_middleware["Token protection<br/>[authMiddleware.js]"]
  node_error_handler["Error responses<br/>[errorHandler.js]"]
end

subgraph group_processing["Paper processing"]
  node_processor["PDF and AI processing<br/>[paperProcessor.js]"]
end

subgraph group_data["Identity and persistence"]
  node_db_config["Database connection<br/>[db.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_paper_model[("Paper records<br/>[Paper.js]")]
  node_activity_model[("Activity records<br/>[Activity.js]")]
end

node_researcher(("Researcher"))
node_gemini["Gemini AI"]
node_mongodb[("MongoDB")]

node_researcher -->|"uses"| node_app
node_app -->|"renders"| node_workspace
node_workspace -.->|"requests papers"| node_paper_routes
node_workspace -.->|"loads dashboard"| node_dashboard_routes
node_workspace -.->|"requests account"| node_auth_routes
node_api_server -->|"connects"| node_db_config
node_api_server -->|"mounts"| node_health
node_api_server -->|"mounts"| node_auth_routes
node_api_server -->|"mounts"| node_paper_routes
node_api_server -->|"mounts"| node_dashboard_routes
node_api_server -->|"handles errors"| node_error_handler
node_auth_routes -->|"reads and writes"| node_user_model
node_paper_routes -->|"protects routes"| node_auth_middleware
node_dashboard_routes -->|"protects routes"| node_auth_middleware
node_auth_middleware -->|"loads user"| node_user_model
node_paper_routes -->|"processes upload and chat"| node_processor
node_paper_routes -->|"reads and writes"| node_paper_model
node_paper_routes -->|"records upload"| node_activity_model
node_dashboard_routes -->|"reads papers"| node_paper_model
node_dashboard_routes -->|"reads and writes"| node_activity_model
node_processor -->|"requests analysis and chat"| node_gemini
node_db_config -->|"connects"| node_mongodb

click node_app "https://github.com/pranjaliingle293/papermind-ai/blob/main/src/App.jsx"
click node_workspace "https://github.com/pranjaliingle293/papermind-ai/blob/main/src/components/Dashboard.jsx"
click node_api_server "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/index.js"
click node_auth_routes "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/auth.js"
click node_paper_routes "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/papers.js"
click node_dashboard_routes "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/dashboard.js"
click node_health "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/health.js"
click node_auth_middleware "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/middleware/authMiddleware.js"
click node_error_handler "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/middleware/errorHandler.js"
click node_processor "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/utils/paperProcessor.js"
click node_db_config "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/config/db.js"
click node_user_model "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/User.js"
click node_paper_model "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/Paper.js"
click node_activity_model "https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/Activity.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_workspace toneBlue
class node_api_server,node_auth_routes,node_paper_routes,node_dashboard_routes,node_health,node_auth_middleware,node_error_handler,node_mongodb toneAmber
class node_processor toneMint
class node_db_config,node_user_model,node_paper_model,node_activity_model toneRose
class node_researcher,node_gemini toneIndigo
```

## Components

### Research workspace

- [App shell and sign-in](https://github.com/pranjaliingle293/papermind-ai/blob/main/src/App.jsx): `src/App.jsx`
- [Dashboard and paper views](https://github.com/pranjaliingle293/papermind-ai/blob/main/src/components/Dashboard.jsx): `src/components/Dashboard.jsx`

### Application API

- [Express API entry](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/index.js): `server/src/index.js`
- [Signup and admin](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Paper operations](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/papers.js): `server/src/routes/papers.js`
- [Dashboard activity](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/dashboard.js): `server/src/routes/dashboard.js`
- [Health endpoint](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/routes/health.js): `server/src/routes/health.js`
- [Token protection](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/middleware/authMiddleware.js): `server/src/middleware/authMiddleware.js`
- [Error responses](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/middleware/errorHandler.js): `server/src/middleware/errorHandler.js`

### Paper processing

- [PDF and AI processing](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/utils/paperProcessor.js): `server/src/utils/paperProcessor.js`

### Identity and persistence

- [Database connection](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/config/db.js): `server/src/config/db.js`
- [User records](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Paper records](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/Paper.js): `server/src/models/Paper.js`
- [Activity records](https://github.com/pranjaliingle293/papermind-ai/blob/main/server/src/models/Activity.js): `server/src/models/Activity.js`

### Other components

- **Researcher**
- **Gemini AI**
- **MongoDB**

## Connections

- Researcher → App shell and sign-in: uses (evidence: `README.md`)
- App shell and sign-in → Dashboard and paper views: renders (evidence: `src/App.jsx`)
- Dashboard and paper views → Paper operations: requests papers
- Dashboard and paper views → Dashboard activity: loads dashboard
- Dashboard and paper views → Signup and admin: requests account
- Express API entry → Database connection: connects (evidence: `server/src/index.js`)
- Express API entry → Health endpoint: mounts (evidence: `server/src/index.js`)
- Express API entry → Signup and admin: mounts (evidence: `server/src/index.js`)
- Express API entry → Paper operations: mounts (evidence: `server/src/index.js`)
- Express API entry → Dashboard activity: mounts (evidence: `server/src/index.js`)
- Express API entry → Error responses: handles errors (evidence: `server/src/index.js`)
- Signup and admin → User records: reads and writes (evidence: `server/src/routes/auth.js`)
- Paper operations → Token protection: protects routes (evidence: `server/src/routes/papers.js`)
- Dashboard activity → Token protection: protects routes (evidence: `server/src/routes/dashboard.js`)
- Token protection → User records: loads user (evidence: `server/src/middleware/authMiddleware.js`)
- Paper operations → PDF and AI processing: processes upload and chat (evidence: `server/src/routes/papers.js`)
- Paper operations → Paper records: reads and writes (evidence: `server/src/routes/papers.js`)
- Paper operations → Activity records: records upload (evidence: `server/src/routes/papers.js`)
- Dashboard activity → Paper records: reads papers (evidence: `server/src/routes/dashboard.js`)
- Dashboard activity → Activity records: reads and writes (evidence: `server/src/routes/dashboard.js`)
- PDF and AI processing → Gemini AI: requests analysis and chat (evidence: `server/src/utils/paperProcessor.js`)
- Database connection → MongoDB: connects (evidence: `server/src/config/db.js`)
