A full-stack, cloud-deployed Library Management System built with the MERN stack. This application digitizes library operations, featuring role-based access control (RBAC), real-time inventory tracking, and an automated borrowing/fining system. The backend is deployed on Render, communicating with a MongoDB Atlas database, and the frontend is deployed via Vercel with a complete CI/CD pipeline.
The backend service is currently live and successfully communicating with the MongoDB cluster. The CI/CD pipelines are active for both frontend (Vercel) and backend (Render), ensuring automatic deployment of new commits.
Below is a detailed breakdown of the functionality you have successfully built, paired with relevant views from the application.
The system is secured by Role-Based Access Control (RBAC).
- Unauthenticated Access: Random visitors see a public catalog and are forced to a login screen if they attempt any restricted action (Protected Routes logic).
- Member View: Logged-in members can search and filter the catalog.
Member view - browse and search, no 'Lend' button
- Librarian/Admin View: Authorized librarians have an unlocked "Librarian Dashboard" with full system management tools.
Admin View showing the critical 'Lend Book' button on available titles
When authorized, the Librarian Dashboard unlocks specialized operations: processing book lending, updating inventory data, and reviewing all transactions.
Left: Form to inject new titles | Right: Full Inventory management console
Form to update existing book details
This is the system's core business logic. The BorrowHistory module tracks who has what, when it's due, and automatically calculates penalties when books are returned past their due date. Late fines are automatically calculated in Rupees (Rs.) based on the date difference. For security, the "Return Date" is locked to the current system date.
Borrow History Table showing dynamic 'Fine' calculation for returned items and 'Borrowed' status for active loans
You implemented a seamless user experience on the frontend:
- Search: Instant filtering by Title or Author as the user types.
- Genre Filter: Dropdown to quickly narrow down choices.
- Custom Pagination: Efficiently displays results by slicing the database array (showing exactly 8 books per page).
Inventory view demonstrating custom pagination controls - page 2 view
Frontend (React):
- React.js (built with Vite)
- React Router DOM (Dynamic Navigation)
- Axios (Secure API Communication)
- Deployed on Vercel
Backend (Node.js/Express):
- Node.js & Express.js (RESTful API Design)
- MongoDB Atlas (Cloud Database Cluster)
- Mongoose (Data Modeling/Schemas)
- JSON Web Tokens (JWT) (Secure Authentication)
- Deployed on Render
If you wish to run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/MalindaBotheju/Smart-Library-Management-System.git
cd Smart-Library-Management-System -
Setup the Backend:
cd backendnpm install
- Create a
.envfile in thebackendfolder and add your variables (seebackend/server.jsfor required variables):
PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key
- Start the backend server:
npm start
- Create a
-
Setup the Frontend:
cd ../frontend npm install- Start the Vite development server:
npm run dev - Note: Ensure your frontend API calls are pointing to
http://localhost:5000for local testing.*
- Start the Vite development server:
The application uses three core interconnected Mongoose models/collections:
- Users Model: Stores login credentials, secured hashed passwords, and user role (
adminormember). - Books Model: Stores metadata (Title, Author, Genre, ISBN) and manages the crucial dynamic
availableCopiescount. - Transactions Model: Acts as the main transactional database, linking borrowers to specific books and recording issue dates, due dates, return dates, and late fine amounts.
