A comprehensive full-stack MERN (MongoDB, Express.js, React, Node.js) application for managing library operations with modern design and advanced features.
-
User Authentication & Role-Based Access Control (RBAC)
- JWT-based authentication
- Three user roles: Admin, User, Guest
- Protected routes and API endpoints
-
Book Inventory Management
- Add, update, delete books
- Track stock levels and availability
- Search and filter by title, author, genre
- Book categorization and reviews
-
Borrowing & Return System
- 14-day borrowing period
- Due date tracking and overdue notifications
- Renewal system (up to 2 renewals)
- Automatic fine calculation
-
Advanced Search & Filtering
- Full-text search across books
- Filter by genre, author, availability
- Pagination and sorting options
-
Data Visualization
- Admin dashboard with charts and analytics
- Monthly borrowing trends
- Genre distribution
- Popular books tracking
-
Fine Management
- Automatic fine calculation for overdue books
- Payment tracking with multiple payment methods
- Fine waiver capabilities for admins
- User Dashboard: Personal borrowing history and active loans
- Book Reviews & Ratings: User-generated content and ratings
- Responsive Design: Mobile-first approach with Tailwind CSS
- Modern UI/UX: Clean, professional interface with animations
- Real-time Updates: Dynamic data updates and notifications
- React - UI library with hooks and context
- React Router DOM - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Axios - HTTP client for API calls
- React Toastify - Toast notifications
- Recharts - Data visualization charts
- Lucide React - Modern icon library
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Tokens for authentication
- bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
- Express Validator - Input validation
library-management-system/
βββ backend/
β βββ config/
β β βββ database.js
β βββ controllers/
β β βββ authController.js
β β βββ bookController.js
β β βββ borrowController.js
β β βββ adminController.js
β βββ middleware/
β β βββ auth.js
β β βββ errorHandler.js
β βββ models/
β β βββ User.js
β β βββ Book.js
β β βββ BorrowTransaction.js
β β βββ Fine.js
β βββ routes/
β β βββ authRoutes.js
β β βββ bookRoutes.js
β β βββ borrowRoutes.js
β β βββ adminRoutes.js
β βββ .env
β βββ server.js
β βββ package.json
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ BookCard.jsx
β β β βββ Navbar.jsx
β β β βββ Footer.jsx
β β β βββ SearchFilters.jsx
β β β βββ Pagination.jsx
β β β βββ ProtectedRoute.jsx
β β βββ context/
β β β βββ AuthContext.jsx
β β βββ pages/
β β β βββ Home.jsx
β β β βββ Login.jsx
β β β βββ Register.jsx
β β β βββ Books.jsx
β β β βββ BookDetail.jsx
β β β βββ Dashboard.jsx
β β β βββ Profile.jsx
β β β βββ admin/
β β β βββ AdminDashboard.jsx
β β β βββ AdminBooks.jsx
β β β βββ AdminUsers.jsx
β β β βββ AdminBorrowings.jsx
β β β βββ AdminFines.jsx
β β βββ services/
β β β βββ api.js
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ package.json
β βββ vite.config.js
βββ package.json
βββ README.md
- Node.js (v16 or higher)
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd library-management-system
-
Install dependencies
npm run install-all
-
Set up environment variables
Create a
.envfile in thebackenddirectory:NODE_ENV=development PORT=5000 MONGODB_URI=mongodb://localhost:27017/library_management JWT_SECRET=your_jwt_secret_key_here_make_it_very_secure EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USER=your_email@gmail.com EMAIL_PASS=your_app_password
-
Start the application
npm start
This will start both the backend server (port 5000) and frontend development server (port 5173).
If you prefer to start services separately:
Backend:
cd backend
npm run devFrontend:
cd frontend
npm run dev- Browse books catalog
- View book details
- Search and filter books
- Register for an account
- All guest permissions
- Borrow and return books
- View borrowing history
- Renew borrowed books
- Leave reviews and ratings
- Manage personal profile
- All user permissions
- Manage book inventory (CRUD operations)
- Manage user accounts
- View all borrowing transactions
- Manage fines and payments
- Access admin dashboard with analytics
- Generate reports
Admin Account:
- Email: admin@library.com
- Password: admin123
User Account:
- Email: user@library.com
- Password: user123
- JWT-based authentication with refresh tokens
- Password hashing using bcrypt
- Role-based access control middleware
- Protected routes on both frontend and backend
- Full CRUD operations for books
- Image upload support for book covers
- Inventory tracking with available/total copies
- Search functionality with full-text indexing
- 14-day default borrowing period
- Automatic due date calculation
- Renewal system with limits
- Overdue detection and fine calculation
- Automatic fine calculation ($1 per day overdue)
- Multiple payment methods supported
- Fine waiver capabilities for admins
- Payment history tracking
- Monthly borrowing trends chart
- Genre distribution pie chart
- Popular books ranking
- Real-time statistics dashboard
- Modern UI/UX: Clean, professional design with intuitive navigation
- Responsive Design: Mobile-first approach with Tailwind CSS
- Micro-interactions: Smooth animations and hover effects
- Loading States: Skeleton loading for better UX
- Toast Notifications: Real-time feedback for user actions
- Form Validation: Client and server-side validation
cd frontend
npm run buildEnsure environment variables are set in your hosting platform.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- React team for the amazing framework
- Tailwind CSS for the utility-first CSS framework
- MongoDB team for the flexible database solution
- Lucide React for the beautiful icons
- All open-source contributors who made this project possible
For support and questions:
- Create an issue on GitHub
- Email: support@libraryms.com
- Documentation: [Link to docs]
Built with β€οΈ using the MERN stack