How khan-aamir01/library-management-system works
This is a MERN library-management application. Users register or sign in, browse and search a book catalog, and request borrowing; administrators manage books and members, process requests and loans, and review fines. Backend controllers handle catalog, account, borrowing, and fine operations against MongoDB models; scheduled jobs also update loan statuses. The route tree and controller/model relationships are supported by excerpts or the SOURCE INDEX. Frontend-to-backend request wiring was not shown, so that link is marked unverified.
Main entry points: main.jsx Role routes · server.js Express server · userController.js Account operations · auth Authentication
Components 31
Web application
- Role routes
frontend/src/main.jsx - User catalog
frontend/src/components/User/Books - User account
frontend/src/components/User - Admin catalog
frontend/src/components/Admin/Books - Member management
frontend/src/components/Admin/Members - Request queue
frontend/src/components/Admin/PendingRequest - Loan dashboard
frontend/src/components/Admin/bookOnLoan - Late fees
frontend/src/components/Admin/LateFeesBooks
API and domain
- Express server
backend/server.js - Book routes
backend/routes/bookRoutes.js - User routes
backend/routes/userRoutes.js - Borrow routes
backend/routes/borrowRoutes.js - Fine routes
backend/routes/fineRoutes.js - Auth routes
backend/routes/authRoutes.js - Catalog operations
backend/controllers/bookController.js - Account operations
backend/controllers/userController.js - Authentication
backend/controllers/auth - Borrow operations
backend/controllers/borrowController.js - Fine operations
backend/controllers/fineController.js - Email delivery
backend/services/emailService.js - Reset email
backend/services/updatePassEmailService.js
MongoDB records
- Book records
backend/models/books.js - User records
backend/models/user.js - Admin records
backend/models/admin.js - Borrow records
backend/models/borrow.js - Fine records
backend/models/fine.js - OTP records
backend/models/otp.js
Scheduled operations
- Expire requests
backend/cronJobs/updateExpiredStatus.js - Overdue processing
backend/cronJobs/updateNotReturnStatus.js
Other components
- Library user
- Librarian
Connections 41
- Library user → Role routes: uses
frontend/src/main.jsx - Librarian → Role routes: uses
frontend/src/main.jsx - Role routes → User catalog: routes to
frontend/src/main.jsx - Role routes → User account: routes to
frontend/src/main.jsx - Role routes → Admin catalog: routes to
frontend/src/main.jsx - Role routes → Member management: routes to
frontend/src/main.jsx - Role routes → Request queue: routes to
frontend/src/main.jsx - Role routes → Loan dashboard: routes to
frontend/src/main.jsx - Role routes → Late fees: routes to
frontend/src/main.jsx - Role routes → Express server: calls API
- Express server → Book routes: mounts
backend/server.js - Express server → User routes: mounts
backend/server.js - Express server → Borrow routes: mounts
backend/server.js - Express server → Fine routes: mounts
backend/server.js - Express server → Auth routes: mounts
backend/server.js - Book routes → Catalog operations: dispatches
backend/routes/bookRoutes.js - User routes → Account operations: dispatches
backend/routes/userRoutes.js - Borrow routes → Borrow operations: dispatches
backend/routes/borrowRoutes.js - Fine routes → Fine operations: dispatches
backend/routes/fineRoutes.js - Auth routes → Authentication: dispatches
backend/routes/authRoutes.js - Catalog operations → Book records: reads/writes
backend/controllers/bookController.js - Account operations → User records: reads/writes
backend/controllers/userController.js - Account operations → Borrow records: reads
backend/controllers/userController.js - Account operations → Fine records: reads
backend/controllers/userController.js - Account operations → OTP records: reads/writes
backend/controllers/userController.js - Account operations → Reset email: sends OTP
backend/controllers/userController.js - Authentication → User records: uses
backend/controllers/auth/userAuth.js - Authentication → Admin records: uses
backend/controllers/auth/adminAuth.js - Authentication → OTP records: uses
backend/controllers/auth/userAuth.js - Authentication → Email delivery: sends email
backend/controllers/auth/userAuth.js - Borrow operations → Borrow records: reads/writes
backend/controllers/borrowController.js - Borrow operations → Book records: reads
backend/controllers/borrowController.js - Borrow operations → User records: reads
backend/controllers/borrowController.js - Fine operations → Fine records: reads/writes
backend/controllers/fineController.js - Fine operations → User records: reads
backend/controllers/fineController.js - Fine operations → Book records: reads
backend/controllers/fineController.js - Expire requests → Borrow records: updates status
backend/cronJobs/updateExpiredStatus.js - Overdue processing → Borrow records: checks loans
backend/cronJobs/updateNotReturnStatus.js - Overdue processing → User records: references
backend/cronJobs/updateNotReturnStatus.js - Overdue processing → Fine records: creates fines
backend/cronJobs/updateNotReturnStatus.js - Overdue processing → Book records: updates availability
backend/cronJobs/updateNotReturnStatus.js