How karanmehta1806/library-management works
This is a MERN library-management application for students, librarians, and administrators. Its principal workflow is browsing books, requesting an issue, librarian approval, and tracking returns and fines; separate capabilities cover account management, catalog administration, analytics, contact messages, and password reset. The backend routes requests through role-protected Express routes to controllers and MongoDB models. The excerpts show this backend structure and frontend page routing, but not the frontend API-call implementations, so no frontend-to-backend request edges are asserted.
Main entry points: App.jsx Page router · routes/books.js Book routes · controller/books.js Catalog and borrowing · index.js Express server
Components 31
Web application
- Page router
frontend/src/App.jsx - Book discovery
frontend/src/pages/user/books.jsx - Book details
frontend/src/pages/user/bookdetails.jsx - Home page
frontend/src/pages/user/home.jsx - Student profile
frontend/src/pages/user/profile.jsx - Admin analytics
frontend/src/pages/admin/admindashboard.jsx - Book administration
frontend/src/pages/admin/viewbook.jsx - Issue requests
frontend/src/pages/librarian/LibrarianRequest.jsx - Return requests
frontend/src/pages/librarian/ReturnRequest.jsx
API and access
- Express server
backend/index.js - Book routes
backend/routes/books.js - Home routes
backend/routes/home.js - Librarian routes
backend/routes/librarian.js - User routes
backend/routes/user.js - JWT authentication
backend/middlewares/userAuth.js - Role authorization
backend/middlewares/checkRole.js
Catalog and circulation
- Catalog and borrowing
backend/controller/books.js - Circulation approvals
backend/controller/librarian.js - Book records
backend/model/BookModel.js - Borrow records
backend/model/BorrowModel.js - Fine calculation
backend/utils/fineCalculator.js - Home cache
backend/utils/cache.js - Image uploads
backend/utils/cloudConfig.js
Accounts and messaging
- Account services
backend/controller/user.js - Admin services
backend/controller/admin.js - User records
backend/model/UserModel.js - Contact messages
backend/model/ContactModel.js - OTP records
backend/model/OtpModel.js
Other components
- Student
- Librarian
- Administrator
Connections 40
- Student → Book discovery: browses
- Student → Book details: views details
- Student → Student profile: tracks borrowing
- Librarian → Issue requests: reviews issues
- Librarian → Return requests: reviews returns
- Administrator → Admin analytics: views analytics
- Administrator → Book administration: manages books
- Page router → Home page: routes to
frontend/src/App.jsx - Page router → Book discovery: routes to
frontend/src/App.jsx - Page router → Book details: routes to
frontend/src/App.jsx - Page router → Student profile: routes to
frontend/src/App.jsx - Page router → Admin analytics: routes to
frontend/src/App.jsx - Page router → Book administration: routes to
frontend/src/App.jsx - Page router → Issue requests: routes to
frontend/src/App.jsx - Page router → Return requests: routes to
frontend/src/App.jsx - Express server → Book routes: mounts
backend/index.js - Express server → Home routes: mounts
backend/index.js - Express server → Librarian routes: mounts
backend/index.js - Express server → User routes: mounts
backend/index.js - Book routes → JWT authentication: checks token
backend/routes/books.js - Book routes → Role authorization: checks role
backend/routes/books.js - Book routes → Catalog and borrowing: dispatches
backend/routes/books.js - Librarian routes → JWT authentication: checks token
backend/routes/librarian.js - Librarian routes → Role authorization: checks role
backend/routes/librarian.js - Librarian routes → Circulation approvals: dispatches
backend/routes/librarian.js - Catalog and borrowing → Book records: reads and writes
backend/controller/books.js - Catalog and borrowing → Borrow records: reads and writes
backend/controller/books.js - Catalog and borrowing → Fine calculation: calculates fines
backend/controller/books.js - Catalog and borrowing → Home cache: clears cache
backend/controller/books.js - Book routes → Image uploads: uses uploads
backend/routes/books.js - Circulation approvals → User records: queries users
backend/controller/librarian.js - Circulation approvals → Borrow records: updates borrowing
backend/controller/librarian.js - Circulation approvals → Book records: updates books
backend/controller/librarian.js - User routes → Account services: dispatches
backend/routes/user.js - Account services → User records: reads and writes
backend/controller/user.js - Account services → Contact messages: saves messages
backend/controller/user.js - Account services → OTP records: manages OTPs
backend/controller/user.js - User routes → JWT authentication: checks token
backend/routes/user.js - User routes → Role authorization: checks role
backend/routes/user.js - Admin services → User records: manages accounts