A modern, full-stack library management application built with the MERN stack (MongoDB, Express.js, React, Node.js) and Tailwind CSS.
- User Authentication: Secure registration and login with JWT
- Book Browsing: Search, filter, and browse the library catalog
- Book Borrowing: Borrow books with due date selection
- Borrow History: Track all borrowed books and their status
- Dashboard: Overview of borrowing statistics and recent activity
- Responsive Design: Works seamlessly on desktop and mobile devices
- Admin Panel: Comprehensive dashboard with library statistics
- Book Management: Add, edit, and manage books in the catalog
- User Management: View and manage user accounts
- Borrowing Management: Process book returns and track overdue items
- Fine Calculation: Automatic fine calculation for overdue books
- Reports: Generate borrowing and fine reports
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcryptjs - Password hashing
- express-validator - Input validation
- helmet - Security middleware
- cors - Cross-origin resource sharing
- morgan - HTTP request logger
- React 19 - UI library
- Vite - Build tool
- React Router - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Axios - HTTP client
- React Hook Form - Form handling
- React Hot Toast - Toast notifications
- Lucide React - Icon library
- date-fns - Date manipulation
Library Management/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── context/ # React context providers
│ │ ├── hooks/ # Custom React hooks
│ │ ├── pages/ # Page components
│ │ ├── services/ # API service functions
│ │ ├── App.jsx # Main app component
│ │ └── main.jsx # App entry point
│ ├── package.json
│ └── vite.config.js
├── server/ # Backend Node.js application
│ ├── config/ # Configuration files
│ ├── middleware/ # Express middleware
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── index.js # Server entry point
│ └── 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
-
Install backend dependencies
cd server npm install -
Install frontend dependencies
cd ../client npm install -
Set up environment variables
Create a
.envfile in the server directory:PORT=8000 MONGODB_URI=mongodb://localhost:27017/library_management JWT_SECRET=your_super_secret_jwt_key_change_in_production NODE_ENV=development
-
Start the development servers
Backend:
cd server npm run devFrontend:
cd client npm run dev -
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current user
GET /api/books- Get all books (with pagination, search, filters)GET /api/books/:id- Get single bookPOST /api/books- Create new book (admin only)PUT /api/books/:id- Update book (admin only)DELETE /api/books/:id- Delete book (admin only)GET /api/books/categories- Get book categories
GET /api/borrows- Get user's borrows (or all for admin)GET /api/borrows/:id- Get single borrowPOST /api/borrows- Borrow a bookPUT /api/borrows/:id/return- Return a book (admin only)GET /api/borrows/overdue- Get overdue books (admin only)GET /api/borrows/stats- Get borrowing statistics (admin only)
- Modern Design: Clean, professional interface with Tailwind CSS
- Responsive Layout: Mobile-first design approach
- Interactive Elements: Hover effects, transitions, and animations
- Loading States: Skeleton loaders and spinners
- Toast Notifications: User feedback for actions
- Form Validation: Real-time validation with error messages
- Accessibility: ARIA labels and keyboard navigation
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcryptjs for password security
- Input Validation: Server-side validation with express-validator
- Rate Limiting: API rate limiting to prevent abuse
- CORS Protection: Configured CORS for security
- Helmet.js: Security headers middleware
- Environment Variables: Secure configuration management
- Name, email, password
- Role (user/admin)
- Membership number
- Contact information
- Address details
- Title, author, ISBN
- Category, description
- Publication details
- Copy management (total/available)
- Location information
- User and book references
- Borrow and due dates
- Status tracking
- Fine calculation
- Notes and metadata
- Create a Heroku account
- Install Heroku CLI
- Create a new Heroku app
- Set environment variables in Heroku dashboard
- Deploy using Git
- Build the project:
npm run build - Deploy the
distfolder to your preferred platform
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request