# pradeep-polishetty/elibrary architecture

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

- Interactive diagram: https://gitdiagram.com/pradeep-polishetty/elibrary
- Repository: https://github.com/pradeep-polishetty/elibrary

## Overview

This is a book-access platform for students and faculty, with user accounts and an admin workflow for uploading and managing books. Readers browse books, open details, and submit ratings; admins upload PDFs and view usage statistics and users. The backend routes requests to controllers, which work with MongoDB models and Cloudinary. The tree and sampled files establish these backend relationships, but the frontend API wiring was not sampled, so no UI-to-API calls are asserted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/App.jsx) (App routes), [`backend/server.js`](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/server.js) (Express server), [`backend/controllers/auth.controller.js`](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/auth.controller.js) (Authentication), [`backend/controllers/admin.controller.js`](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/admin.controller.js) (Admin operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["App routes<br/>[App.jsx]"]
  node_browse_ui["Book browsing<br/>[HomePage.jsx]"]
  node_book_detail_ui["Book details<br/>[BookDetailPage.jsx]"]
  node_rating_ui["Rating form<br/>[RatingForm.jsx]"]
  node_auth_ui["Account pages<br/>[LoginPage.jsx]"]
  node_profile_ui["Profile page<br/>[ProfilePage.jsx]"]
  node_admin_ui["Admin pages"]
  node_api_state["API state<br/>[apiSlice.js]"]
end

subgraph group_api["API access"]
  node_server["Express server<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_book_routes["Book routes<br/>[book.routes.js]"]
  node_user_routes["User routes<br/>[user.routes.js]"]
  node_admin_routes["Admin routes<br/>[admin.routes.js]"]
  node_auth_middleware["Access control<br/>[auth.middleware.js]"]
end

subgraph group_domain["Domain workflows"]
  node_auth_controller["Authentication<br/>[auth.controller.js]"]
  node_book_controller["Book operations<br/>[book.controller.js]"]
  node_user_controller["User profiles<br/>[user.controller.js]"]
  node_admin_controller["Admin operations"]
end

subgraph group_integrations["Data and integrations"]
  node_book_model["Book records<br/>[book.model.js]"]
  node_rating_model["Rating records<br/>[rating.model.js]"]
  node_user_model["User records<br/>[user.model.js]"]
  node_admin_model["Admin records<br/>[admin.model.js]"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_cloudinary_service["PDF upload"]
end

node_reader(("Reader"))
node_admin_actor(("Administrator"))
node_cloudinary[("Cloudinary")]
node_firebase["Firebase Auth"]

node_reader -->|"uses"| node_app
node_admin_actor -->|"uses"| node_app
node_app -->|"routes to"| node_browse_ui
node_app -->|"routes to"| node_book_detail_ui
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_profile_ui
node_app -->|"routes to"| node_admin_ui
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_book_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_admin_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_book_routes -->|"dispatches"| node_book_controller
node_user_routes -->|"guards"| node_auth_middleware
node_user_routes -->|"dispatches"| node_user_controller
node_admin_routes -->|"guards"| node_auth_middleware
node_admin_routes -->|"dispatches"| node_admin_controller
node_book_routes -->|"guards"| node_auth_middleware
node_auth_controller -->|"reads/writes"| node_user_model
node_auth_controller -->|"reads"| node_admin_model
node_auth_controller -->|"verifies token"| node_firebase
node_book_controller -->|"reads/writes"| node_book_model
node_book_controller -->|"reads/writes"| node_rating_model
node_user_controller -->|"reads/writes"| node_user_model
node_admin_controller -->|"reads"| node_user_model
node_admin_controller -->|"reads/writes"| node_book_model
node_admin_controller -->|"uploads PDF"| node_cloudinary_service
node_cloudinary_service -->|"stores file"| node_cloudinary
node_book_model -->|"persists"| node_mongo
node_rating_model -->|"persists"| node_mongo
node_user_model -->|"persists"| node_mongo
node_admin_model -->|"persists"| node_mongo

click node_app "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/App.jsx"
click node_browse_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/HomePage.jsx"
click node_book_detail_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/BookDetailPage.jsx"
click node_rating_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/components/books/RatingForm.jsx"
click node_auth_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/LoginPage.jsx"
click node_profile_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_admin_ui "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/AdminDashboardPage.jsx"
click node_api_state "https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/store/slices/apiSlice.js"
click node_server "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/server.js"
click node_auth_routes "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/auth.routes.js"
click node_book_routes "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/book.routes.js"
click node_user_routes "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/user.routes.js"
click node_admin_routes "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/admin.routes.js"
click node_auth_controller "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/auth.controller.js"
click node_book_controller "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/book.controller.js"
click node_user_controller "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/user.controller.js"
click node_admin_controller "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/admin.controller.js"
click node_auth_middleware "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/middlewares/auth.middleware.js"
click node_book_model "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/book.model.js"
click node_rating_model "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/rating.model.js"
click node_user_model "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/user.model.js"
click node_admin_model "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/admin.model.js"
click node_mongo "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/config/db.js"
click node_cloudinary_service "https://github.com/pradeep-polishetty/elibrary/blob/main/backend/services/cloudinary.service.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_browse_ui,node_book_detail_ui,node_rating_ui,node_auth_ui,node_profile_ui,node_admin_ui,node_api_state toneBlue
class node_server,node_auth_routes,node_book_routes,node_user_routes,node_admin_routes,node_auth_middleware,node_cloudinary toneAmber
class node_auth_controller,node_book_controller,node_user_controller,node_admin_controller toneMint
class node_book_model,node_rating_model,node_user_model,node_admin_model,node_mongo,node_cloudinary_service toneRose
class node_reader,node_admin_actor,node_firebase toneIndigo
```

## Components

### Web interface

- [App routes](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Book browsing](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Book details](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/BookDetailPage.jsx): `frontend/src/pages/BookDetailPage.jsx`
- [Rating form](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/components/books/RatingForm.jsx): `frontend/src/components/books/RatingForm.jsx`
- [Account pages](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Profile page](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Admin pages](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/pages/AdminDashboardPage.jsx): `frontend/src/pages/AdminDashboardPage.jsx`
- [API state](https://github.com/pradeep-polishetty/elibrary/blob/main/frontend/src/store/slices/apiSlice.js): `frontend/src/store/slices/apiSlice.js`

### API access

- [Express server](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/auth.routes.js): `backend/routes/auth.routes.js`
- [Book routes](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/book.routes.js): `backend/routes/book.routes.js`
- [User routes](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/user.routes.js): `backend/routes/user.routes.js`
- [Admin routes](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/routes/admin.routes.js): `backend/routes/admin.routes.js`
- [Access control](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/middlewares/auth.middleware.js): `backend/middlewares/auth.middleware.js`

### Domain workflows

- [Authentication](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/auth.controller.js): `backend/controllers/auth.controller.js`
- [Book operations](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/book.controller.js): `backend/controllers/book.controller.js`
- [User profiles](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/user.controller.js): `backend/controllers/user.controller.js`
- [Admin operations](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/controllers/admin.controller.js): `backend/controllers/admin.controller.js`

### Data and integrations

- [Book records](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/book.model.js): `backend/models/book.model.js`
- [Rating records](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/rating.model.js): `backend/models/rating.model.js`
- [User records](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/user.model.js): `backend/models/user.model.js`
- [Admin records](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/models/admin.model.js): `backend/models/admin.model.js`
- [MongoDB](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/config/db.js): `backend/config/db.js`
- [PDF upload](https://github.com/pradeep-polishetty/elibrary/blob/main/backend/services/cloudinary.service.js): `backend/services/cloudinary.service.js`

### Other components

- **Reader**
- **Administrator**
- **Cloudinary**
- **Firebase Auth**

## Connections

- Reader → App routes: uses
- Administrator → App routes: uses
- App routes → Book browsing: routes to
- App routes → Book details: routes to
- App routes → Account pages: routes to
- App routes → Profile page: routes to
- App routes → Admin pages: routes to
- Express server → Auth routes: mounts
- Express server → Book routes: mounts
- Express server → User routes: mounts
- Express server → Admin routes: mounts
- Auth routes → Authentication: dispatches
- Book routes → Book operations: dispatches
- User routes → Access control: guards
- User routes → User profiles: dispatches
- Admin routes → Access control: guards
- Admin routes → Admin operations: dispatches
- Book routes → Access control: guards
- Authentication → User records: reads/writes
- Authentication → Admin records: reads
- Authentication → Firebase Auth: verifies token
- Book operations → Book records: reads/writes
- Book operations → Rating records: reads/writes
- User profiles → User records: reads/writes
- Admin operations → User records: reads
- Admin operations → Book records: reads/writes
- Admin operations → PDF upload: uploads PDF
- PDF upload → Cloudinary: stores file
- Book records → MongoDB: persists
- Rating records → MongoDB: persists
- User records → MongoDB: persists
- Admin records → MongoDB: persists
