# yashchaudhari11/study-geni architecture

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

- Interactive diagram: https://gitdiagram.com/yashchaudhari11/study-geni
- Repository: https://github.com/yashchaudhari11/study-geni

## Overview

StudyGeni is an API for teacher-uploaded study notes and student access, with account authentication and AI-generated summaries or quizzes from note PDFs. The main flow enters through mounted Express routes, then passes through route middleware and controllers to user or file models; AI handlers retrieve a note, fetch its PDF, and request generated content. The graph also shows the documented database connection and upload integration. The README is empty, and cloud configuration and upload middleware internals were not excerpted, so their details are limited.

Main entry points: [`index.js`](https://github.com/yashchaudhari11/study-geni/blob/main/index.js) (Express server), [`routes/file.routes.js`](https://github.com/yashchaudhari11/study-geni/blob/main/routes/file.routes.js) (File routes), [`controller/ai.controller.js`](https://github.com/yashchaudhari11/study-geni/blob/main/controller/ai.controller.js) (Summary and quiz), [`routes/auth.routes.js`](https://github.com/yashchaudhari11/study-geni/blob/main/routes/auth.routes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API routing"]
  node_server["Express server<br/>[index.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_file_routes["File routes<br/>[file.routes.js]"]
  node_ai_routes["AI routes<br/>[ai.routes.js]"]
end

subgraph group_identity["Accounts and access"]
  node_user_controller["Account handlers<br/>[user.controller.js]"]
  node_auth_middleware["Auth and roles<br/>[auth.middleware.js]"]
  node_user_model["User records<br/>[user.model.js]"]
end

subgraph group_notes["Study notes"]
  node_file_controller["Note handlers<br/>[file.controller.js]"]
  node_upload_middleware["File upload"]
  node_file_model["Note records<br/>[file.model.js]"]
end

subgraph group_ai["AI study tools"]
  node_ai_controller["Summary and quiz<br/>[ai.controller.js]"]
end

subgraph group_runtime["Runtime and integrations"]
  node_db_config["Database connection<br/>[db.js]"]
  node_cloud_config["Cloud configuration<br/>[cloud.js]"]
  node_mongo[("MongoDB")]
  node_cloudinary(("Cloudinary"))
  node_gemini(("Google Gemini"))
end

node_caller(("API clients"))
node_pdf_source(("PDF URL"))

node_caller -->|"sends requests"| node_server
node_server -->|"connects database"| node_db_config
node_server -->|"mounts auth"| node_auth_routes
node_server -->|"mounts files"| node_file_routes
node_server -->|"mounts AI"| node_ai_routes
node_auth_routes -->|"dispatches"| node_user_controller
node_auth_routes -->|"protects profile"| node_auth_middleware
node_user_controller -->|"reads and creates"| node_user_model
node_auth_middleware -->|"loads user"| node_user_model
node_file_routes -->|"protects uploads"| node_auth_middleware
node_file_routes -->|"parses upload"| node_upload_middleware
node_file_routes -->|"dispatches"| node_file_controller
node_file_controller -->|"reads and creates"| node_file_model
node_file_controller -->|"uses uploader"| node_cloud_config
node_cloud_config -.->|"uploads file"| node_cloudinary
node_db_config -->|"connects"| node_mongo
node_ai_routes -->|"dispatches"| node_ai_controller
node_ai_controller -->|"loads note"| node_file_model
node_ai_controller -->|"fetches PDF"| node_pdf_source
node_ai_controller -->|"requests generation"| node_gemini

click node_server "https://github.com/yashchaudhari11/study-geni/blob/main/index.js"
click node_auth_routes "https://github.com/yashchaudhari11/study-geni/blob/main/routes/auth.routes.js"
click node_file_routes "https://github.com/yashchaudhari11/study-geni/blob/main/routes/file.routes.js"
click node_ai_routes "https://github.com/yashchaudhari11/study-geni/blob/main/routes/ai.routes.js"
click node_user_controller "https://github.com/yashchaudhari11/study-geni/blob/main/controller/user.controller.js"
click node_auth_middleware "https://github.com/yashchaudhari11/study-geni/blob/main/middleware/auth.middleware.js"
click node_user_model "https://github.com/yashchaudhari11/study-geni/blob/main/model/user.model.js"
click node_file_controller "https://github.com/yashchaudhari11/study-geni/blob/main/controller/file.controller.js"
click node_upload_middleware "https://github.com/yashchaudhari11/study-geni/blob/main/middleware/upload.middleware.js"
click node_file_model "https://github.com/yashchaudhari11/study-geni/blob/main/model/file.model.js"
click node_ai_controller "https://github.com/yashchaudhari11/study-geni/blob/main/controller/ai.controller.js"
click node_db_config "https://github.com/yashchaudhari11/study-geni/blob/main/config/db.js"
click node_cloud_config "https://github.com/yashchaudhari11/study-geni/blob/main/config/cloud.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_server,node_auth_routes,node_file_routes,node_ai_routes,node_caller toneBlue
class node_user_controller,node_auth_middleware,node_user_model toneAmber
class node_file_controller,node_upload_middleware,node_file_model toneMint
class node_ai_controller toneRose
class node_db_config,node_cloud_config,node_mongo,node_cloudinary,node_gemini,node_pdf_source toneIndigo
```

## Components

### API routing

- [Express server](https://github.com/yashchaudhari11/study-geni/blob/main/index.js): `index.js`
- [Auth routes](https://github.com/yashchaudhari11/study-geni/blob/main/routes/auth.routes.js): `routes/auth.routes.js`
- [File routes](https://github.com/yashchaudhari11/study-geni/blob/main/routes/file.routes.js): `routes/file.routes.js`
- [AI routes](https://github.com/yashchaudhari11/study-geni/blob/main/routes/ai.routes.js): `routes/ai.routes.js`

### Accounts and access

- [Account handlers](https://github.com/yashchaudhari11/study-geni/blob/main/controller/user.controller.js): `controller/user.controller.js`
- [Auth and roles](https://github.com/yashchaudhari11/study-geni/blob/main/middleware/auth.middleware.js): `middleware/auth.middleware.js`
- [User records](https://github.com/yashchaudhari11/study-geni/blob/main/model/user.model.js): `model/user.model.js`

### Study notes

- [Note handlers](https://github.com/yashchaudhari11/study-geni/blob/main/controller/file.controller.js): `controller/file.controller.js`
- [File upload](https://github.com/yashchaudhari11/study-geni/blob/main/middleware/upload.middleware.js): `middleware/upload.middleware.js`
- [Note records](https://github.com/yashchaudhari11/study-geni/blob/main/model/file.model.js): `model/file.model.js`

### AI study tools

- [Summary and quiz](https://github.com/yashchaudhari11/study-geni/blob/main/controller/ai.controller.js): `controller/ai.controller.js`

### Runtime and integrations

- [Database connection](https://github.com/yashchaudhari11/study-geni/blob/main/config/db.js): `config/db.js`
- [Cloud configuration](https://github.com/yashchaudhari11/study-geni/blob/main/config/cloud.js): `config/cloud.js`
- **MongoDB**
- **Cloudinary**
- **Google Gemini**

### Other components

- **API clients**
- **PDF URL**

## Connections

- API clients → Express server: sends requests (evidence: `index.js`)
- Express server → Database connection: connects database (evidence: `index.js`)
- Express server → Auth routes: mounts auth (evidence: `index.js`)
- Express server → File routes: mounts files (evidence: `index.js`)
- Express server → AI routes: mounts AI (evidence: `index.js`)
- Auth routes → Account handlers: dispatches (evidence: `routes/auth.routes.js`)
- Auth routes → Auth and roles: protects profile (evidence: `routes/auth.routes.js`)
- Account handlers → User records: reads and creates (evidence: `controller/user.controller.js`)
- Auth and roles → User records: loads user (evidence: `middleware/auth.middleware.js`)
- File routes → Auth and roles: protects uploads (evidence: `routes/file.routes.js`)
- File routes → File upload: parses upload (evidence: `routes/file.routes.js`)
- File routes → Note handlers: dispatches (evidence: `routes/file.routes.js`)
- Note handlers → Note records: reads and creates (evidence: `controller/file.controller.js`)
- Note handlers → Cloud configuration: uses uploader (evidence: `controller/file.controller.js`)
- Cloud configuration → Cloudinary: uploads file
- Database connection → MongoDB: connects (evidence: `config/db.js`)
- AI routes → Summary and quiz: dispatches (evidence: `routes/ai.routes.js`)
- Summary and quiz → Note records: loads note (evidence: `controller/ai.controller.js`)
- Summary and quiz → PDF URL: fetches PDF (evidence: `controller/ai.controller.js`)
- Summary and quiz → Google Gemini: requests generation (evidence: `controller/ai.controller.js`)
