# rahulkumar971/studyhub architecture

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

- Interactive diagram: https://gitdiagram.com/rahulkumar971/studyhub
- Repository: https://github.com/rahulkumar971/studyhub

## Overview

StudyHub is a student-facing study-material library with an admin path for uploading and managing resources. Students sign in, search and filter a paginated catalog, open or download materials, and save items to a personal collection; admins can add and delete resources. The graph also preserves registration, feedback, and seeding capabilities visible in the repository. Backend route and model calls are based on excerpts; some frontend-to-API links are only indicated as unverified because those page implementations were not sampled.

Main entry points: [`backend/routes/resourceRoutes.js`](https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/resourceRoutes.js) (Resource endpoints), [`frontend/src/App.jsx`](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/App.jsx) (App and routing), [`backend/server.js`](https://github.com/rahulkumar971/studyhub/blob/main/backend/server.js) (Express server), [`frontend/src/pages/Home.jsx`](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Home.jsx) (Resource search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Student application"]
  node_app["App and routing<br/>[App.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_home["Resource search<br/>[Home.jsx]"]
  node_resourcecard["Resource actions<br/>[ResourceCard.jsx]"]
  node_skeleton["Loading placeholders<br/>[SkeletonLoader.jsx]"]
  node_collection["Saved collection<br/>[Collection.jsx]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_feedbackui["Feedback form<br/>[Feedback.jsx]"]
  node_login["Login page<br/>[Login.jsx]"]
  node_register["Registration page<br/>[Register.jsx]"]
end

subgraph group_api["API and workflows"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authcontroller["Authentication logic<br/>[authController.js]"]
  node_authmiddleware["Access control<br/>[auth.js]"]
  node_resourceroutes["Resource endpoints<br/>[resourceRoutes.js]"]
  node_feedbackroutes["Feedback endpoint<br/>[feedbackRoutes.js]"]
  node_seedroutes["Sample data seeding<br/>[seedRoutes.js]"]
  node_upload["Upload middleware<br/>[upload.js]"]
end

subgraph group_data["Persistence and files"]
  node_user[("User records<br/>[User.js]")]
  node_resource[("Resource records<br/>[Resource.js]")]
  node_feedback[("Feedback records<br/>[Feedback.js]")]
  node_imageconfig["ImageKit configuration<br/>[imagekit.js]"]
end

node_student(("Student"))
node_admin(("Admin"))
node_mongodb[("MongoDB")]
node_imagekit["ImageKit file service"]

node_student -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_collection
node_app -->|"routes to"| node_adminui
node_app -->|"routes to"| node_feedbackui
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_home -->|"fetches resources"| node_resourceroutes
node_home -->|"renders"| node_resourcecard
node_home -->|"renders loading"| node_skeleton
node_collection -->|"renders"| node_resourcecard
node_collection -->|"renders loading"| node_skeleton
node_resourcecard -->|"saves or deletes"| node_resourceroutes
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_resourceroutes
node_server -->|"mounts"| node_feedbackroutes
node_server -->|"mounts"| node_seedroutes
node_server -->|"connects"| node_mongodb
node_authroutes -->|"dispatches"| node_authcontroller
node_authcontroller -->|"reads and saves"| node_user
node_authmiddleware -->|"loads user"| node_user
node_resourceroutes -->|"queries and saves"| node_resource
node_resourceroutes -->|"reads and updates"| node_user
node_resourceroutes -->|"guards routes"| node_authmiddleware
node_resourceroutes -->|"processes uploads"| node_upload
node_resourceroutes -->|"uses client"| node_imageconfig
node_resourceroutes -->|"uploads or deletes files"| node_imagekit
node_feedbackroutes -->|"saves feedback"| node_feedback
node_seedroutes -->|"inserts sample records"| node_resource
node_mongodb -.->|"stores"| node_user
node_mongodb -.->|"stores"| node_resource
node_mongodb -.->|"stores"| node_feedback
node_login -.->|"submits credentials"| node_authroutes
node_register -.->|"submits registration"| node_authroutes
node_adminui -.->|"manages resources"| node_resourceroutes
node_feedbackui -.->|"submits feedback"| node_feedbackroutes
node_collection -.->|"loads saved items"| node_resourceroutes

click node_app "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/App.jsx"
click node_navbar "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/Navbar.jsx"
click node_home "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Home.jsx"
click node_resourcecard "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/ResourceCard.jsx"
click node_skeleton "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/SkeletonLoader.jsx"
click node_collection "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Collection.jsx"
click node_adminui "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_feedbackui "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Feedback.jsx"
click node_login "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Login.jsx"
click node_register "https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Register.jsx"
click node_server "https://github.com/rahulkumar971/studyhub/blob/main/backend/server.js"
click node_authroutes "https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/authRoutes.js"
click node_authcontroller "https://github.com/rahulkumar971/studyhub/blob/main/backend/controllers/authController.js"
click node_authmiddleware "https://github.com/rahulkumar971/studyhub/blob/main/backend/middleware/auth.js"
click node_resourceroutes "https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/resourceRoutes.js"
click node_feedbackroutes "https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/feedbackRoutes.js"
click node_seedroutes "https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/seedRoutes.js"
click node_user "https://github.com/rahulkumar971/studyhub/blob/main/backend/models/User.js"
click node_resource "https://github.com/rahulkumar971/studyhub/blob/main/backend/models/Resource.js"
click node_feedback "https://github.com/rahulkumar971/studyhub/blob/main/backend/models/Feedback.js"
click node_upload "https://github.com/rahulkumar971/studyhub/blob/main/backend/middleware/upload.js"
click node_imageconfig "https://github.com/rahulkumar971/studyhub/blob/main/backend/config/imagekit.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_navbar,node_home,node_resourcecard,node_skeleton,node_collection,node_adminui,node_feedbackui,node_login,node_register toneBlue
class node_server,node_authroutes,node_authcontroller,node_authmiddleware,node_resourceroutes,node_feedbackroutes,node_seedroutes,node_upload,node_mongodb toneAmber
class node_user,node_resource,node_feedback,node_imageconfig toneMint
class node_student,node_admin,node_imagekit toneIndigo
```

## Components

### Student application

- [App and routing](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Navigation](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Resource search](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Resource actions](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/ResourceCard.jsx): `frontend/src/components/ResourceCard.jsx`
- [Loading placeholders](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/components/SkeletonLoader.jsx): `frontend/src/components/SkeletonLoader.jsx`
- [Saved collection](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Collection.jsx): `frontend/src/pages/Collection.jsx`
- [Admin dashboard](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Feedback form](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Feedback.jsx): `frontend/src/pages/Feedback.jsx`
- [Login page](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Registration page](https://github.com/rahulkumar971/studyhub/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`

### API and workflows

- [Express server](https://github.com/rahulkumar971/studyhub/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication logic](https://github.com/rahulkumar971/studyhub/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Access control](https://github.com/rahulkumar971/studyhub/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Resource endpoints](https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/resourceRoutes.js): `backend/routes/resourceRoutes.js`
- [Feedback endpoint](https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/feedbackRoutes.js): `backend/routes/feedbackRoutes.js`
- [Sample data seeding](https://github.com/rahulkumar971/studyhub/blob/main/backend/routes/seedRoutes.js): `backend/routes/seedRoutes.js`
- [Upload middleware](https://github.com/rahulkumar971/studyhub/blob/main/backend/middleware/upload.js): `backend/middleware/upload.js`

### Persistence and files

- [User records](https://github.com/rahulkumar971/studyhub/blob/main/backend/models/User.js): `backend/models/User.js`
- [Resource records](https://github.com/rahulkumar971/studyhub/blob/main/backend/models/Resource.js): `backend/models/Resource.js`
- [Feedback records](https://github.com/rahulkumar971/studyhub/blob/main/backend/models/Feedback.js): `backend/models/Feedback.js`
- [ImageKit configuration](https://github.com/rahulkumar971/studyhub/blob/main/backend/config/imagekit.js): `backend/config/imagekit.js`

### Other components

- **Student**
- **Admin**
- **MongoDB**
- **ImageKit file service**

## Connections

- Student → App and routing: uses (evidence: `frontend/src/App.jsx`)
- Admin → App and routing: uses (evidence: `frontend/src/App.jsx`)
- App and routing → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App and routing → Resource search: routes to (evidence: `frontend/src/App.jsx`)
- App and routing → Saved collection: routes to (evidence: `frontend/src/App.jsx`)
- App and routing → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App and routing → Feedback form: routes to (evidence: `frontend/src/App.jsx`)
- App and routing → Login page: routes to (evidence: `frontend/src/App.jsx`)
- App and routing → Registration page: routes to (evidence: `frontend/src/App.jsx`)
- Resource search → Resource endpoints: fetches resources (evidence: `frontend/src/pages/Home.jsx`)
- Resource search → Resource actions: renders (evidence: `frontend/src/pages/Home.jsx`)
- Resource search → Loading placeholders: renders loading (evidence: `frontend/src/pages/Home.jsx`)
- Saved collection → Resource actions: renders (evidence: `frontend/src/pages/Collection.jsx`)
- Saved collection → Loading placeholders: renders loading (evidence: `frontend/src/pages/Collection.jsx`)
- Resource actions → Resource endpoints: saves or deletes (evidence: `frontend/src/components/ResourceCard.jsx`)
- Express server → Authentication routes: mounts (evidence: `backend/server.js`)
- Express server → Resource endpoints: mounts (evidence: `backend/server.js`)
- Express server → Feedback endpoint: mounts (evidence: `backend/server.js`)
- Express server → Sample data seeding: mounts (evidence: `backend/server.js`)
- Express server → MongoDB: connects (evidence: `backend/server.js`)
- Authentication routes → Authentication logic: dispatches (evidence: `backend/routes/authRoutes.js`)
- Authentication logic → User records: reads and saves (evidence: `backend/controllers/authController.js`)
- Access control → User records: loads user (evidence: `backend/middleware/auth.js`)
- Resource endpoints → Resource records: queries and saves (evidence: `backend/routes/resourceRoutes.js`)
- Resource endpoints → User records: reads and updates (evidence: `backend/routes/resourceRoutes.js`)
- Resource endpoints → Access control: guards routes (evidence: `backend/routes/resourceRoutes.js`)
- Resource endpoints → Upload middleware: processes uploads (evidence: `backend/routes/resourceRoutes.js`)
- Resource endpoints → ImageKit configuration: uses client (evidence: `backend/routes/resourceRoutes.js`)
- Resource endpoints → ImageKit file service: uploads or deletes files (evidence: `backend/routes/resourceRoutes.js`)
- Feedback endpoint → Feedback records: saves feedback (evidence: `backend/routes/feedbackRoutes.js`)
- Sample data seeding → Resource records: inserts sample records (evidence: `backend/routes/seedRoutes.js`)
- MongoDB → User records: stores
- MongoDB → Resource records: stores
- MongoDB → Feedback records: stores
- Login page → Authentication routes: submits credentials
- Registration page → Authentication routes: submits registration
- Admin dashboard → Resource endpoints: manages resources
- Feedback form → Feedback endpoint: submits feedback
- Saved collection → Resource endpoints: loads saved items
