A modern, full-stack Library Management System built with the MERN stack (MongoDB, Express.js, React, Node.js) featuring beautiful UI with Tailwind CSS v3.4.17.
- Authentication: Simple JWT-based login and registration
- Book Discovery: Browse and search through the library catalog
- Book Requests: Request books with easy approval workflow
- Transaction History: View your borrowing history and current issues
- Profile Management: Update personal information and view library stats
- Real-time Updates: Socket.IO integration for live notifications
- User Management: View and manage all library users
- Book Management: Add, edit, and delete books from the catalog
- Transaction Management: Approve/reject book requests and manage returns
- Dashboard Analytics: Overview of library statistics and activity
- Real-time Monitoring: Live updates on system activity
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- Socket.IO - Real-time communication
- bcryptjs - Password hashing
- React 18 - UI library
- Vite - Build tool and dev server
- Tailwind CSS v3.4.17 - Styling framework
- React Router DOM - Client-side routing
- Axios - HTTP client
- React Hot Toast - Notifications
- Lucide React - Icons
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn package manager
git clone https://github.com/PLP-MERN-Stack-Development/libraryMS.git
cd libraryMS# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Edit the .env file with your configuration:
# PORT=5000
# MONGODB_URI=mongodb://localhost:27017/library-management
# JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# NODE_ENV=development
# Start the backend server
npm startThe backend server will start on http://localhost:5000
Open a new terminal window:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Create environment file (optional)
# Create a .env file in the frontend directory with:
# VITE_API_URL=http://localhost:5000/api
# VITE_APP_NAME=Library Management System
# Start the frontend development server
npm run devThe frontend development server will start on http://localhost:5173
If you're using local MongoDB:
# Start MongoDB service (Ubuntu/Debian)
sudo systemctl start mongod
# Or using MongoDB directly
mongodFor MongoDB Atlas:
- Create a cluster on MongoDB Atlas
- Get your connection string
- Update the
MONGODB_URIin your backend.envfile
The application includes demo accounts for testing:
- Email: admin@library.com
- Password: admin123
- Email: user@library.com
- Password: user123
library-management-system/
├── backend/
│ ├── controllers/ # Route controllers
│ ├── middleware/ # Custom middleware
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── server.js # Express server setup
│ └── package.json
├── frontend/
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── contexts/ # React contexts
│ │ ├── pages/ # Application pages
│ │ ├── services/ # API services
│ │ ├── App.jsx # Main app component
│ │ └── main.jsx # App entry point
│ ├── index.html
│ ├── package.json
│ ├── tailwind.config.js
│ └── vite.config.js
└── README.md
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/me- Get current user
GET /api/books- Get all books (paginated)GET /api/books/:id- Get specific bookPOST /api/books- Add new book (admin only)PUT /api/books/:id- Update book (admin only)DELETE /api/books/:id- Delete book (admin only)GET /api/books/search- Search books
GET /api/users/profile- Get user profilePUT /api/users/profile- Update user profileGET /api/users/transactions- Get user transactionsGET /api/users- Get all users (admin only)GET /api/users/:id- Get specific user (admin only)PUT /api/users/:id- Update user (admin only)
GET /api/transactions- Get all transactions (admin only)POST /api/transactions/request- Request bookPUT /api/transactions/:id/status- Update transaction status (admin only)POST /api/transactions/return- Return bookPUT /api/transactions/:id/complete- Complete return (admin only)
cd backend
# Run in development mode with auto-restart
npm run dev
# Run in production mode
npm startcd frontend
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lintThis project uses Tailwind CSS v3.4.17 with a custom configuration:
- Primary Colors: Custom blue palette defined in
tailwind.config.js - Components: Pre-built component classes like
.btn,.card,.input - Responsive Design: Mobile-first responsive design throughout
- Dark Mode: Ready for dark mode implementation
- Custom Fonts: Inter font family integration
/* Buttons */
.btn-primary /* Primary button styling */
.btn-secondary /* Secondary button styling */
/* Components */
.card /* Card container styling */
.input /* Form input styling */- JWT-based authentication
- Password hashing with bcryptjs
- Protected routes and role-based access control
- Automatic token refresh handling
- Complete CRUD operations for books
- Search functionality with multiple criteria
- Availability tracking and copy management
- Book request and approval workflow
- User profiles with editable information
- Transaction history tracking
- Role-based permissions (admin/user)
- Real-time activity monitoring
- Socket.IO integration for live updates
- Instant notifications for approvals/rejections
- Real-time dashboard updates
- Live transaction status changes
Create production environment files:
Backend (.env)
PORT=5000
MONGODB_URI=your-production-mongodb-uri
JWT_SECRET=super-secure-production-jwt-secret
NODE_ENV=production
Frontend (.env)
VITE_API_URL=https://your-backend-domain.com/api
VITE_APP_NAME=Library Management System
# Build frontend for production
cd frontend && npm run build
# Start backend in production
cd backend && npm start- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Check the documentation above
- Create an issue on GitHub
- Contact the development team
Built with ❤️ using the MERN stack