- Node.js (v16 or higher)
- MongoDB (local or cloud instance)
- npm or yarn
# Copy the example environment file
cp env.example .env
# Edit .env with your configuration
NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/library_management
JWT_SECRET=your_jwt_secret_key_here
JWT_EXPIRE=7d
# Email configuration for notifications
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
# Admin credentials
ADMIN_EMAIL=admin@library.com
ADMIN_PASSWORD=admin123# Navigate to client directory
cd client
# Copy the example environment file
cp env.example .env
# Edit .env with your configuration
VITE_API_URL=http://localhost:5000/api# From project root
npm install# From client directory
cd client
npm install# From project root
npm run dev
# or
npm start# From client directory
cd client
npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- API Health Check: http://localhost:5000/api/health
- User Authentication (JWT-based)
- Book Management (CRUD operations)
- Individual Book Borrowing
- Group Book Borrowing (3-6 members)
- Fine Calculation System
- Feedback System
- Admin Dashboard
- Email Notifications
- Each book has 3 copies available
- Real-time availability tracking
- Book search and filtering
- Genre-based categorization
- ISBN validation
- 1-month borrowing duration
- Individual and group borrowing support
- Automatic due date calculation
- Overdue book tracking
- Return condition tracking
- βΉ50 fine for overdue books
- 200% of book cost + βΉ50 for lost books after 1 month
- 200% of book cost for lost books within 1 month
- 10% fine for minor damage
- 50% fine for major damage
- Group fines distributed equally among members
- Groups can have 3-6 members
- Group leader management
- Leadership transfer
- Group disbanding with proper checks
- User management
- Book management
- Borrow record tracking
- Fine management
- Feedback moderation
- Dashboard analytics
- Daily overdue book checks (cron jobs)
- Email notifications for fines and overdue books
- Automatic fine calculation
- Book availability updates
- users: User information and authentication
- books: Book catalog and availability
- borrowRecords: Borrowing history and fine tracking
- groups: Group information and member management
- feedback: User feedback and ratings
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/me- Get current userPUT /api/auth/profile- Update user profile
GET /api/books- Get all books (with search and filters)GET /api/books/:id- Get single bookPOST /api/books- Create book (Admin only)PUT /api/books/:id- Update book (Admin only)DELETE /api/books/:id- Delete book (Admin only)
POST /api/borrow/individual- Borrow book individuallyPOST /api/borrow/group- Borrow book for groupPUT /api/borrow/return/:id- Return bookGET /api/borrow/history- Get borrow historyGET /api/borrow/current- Get current borrowings
POST /api/groups- Create groupGET /api/groups/my-group- Get user's groupPUT /api/groups/:id/add-member- Add member to groupPUT /api/groups/:id/remove-member- Remove member from group
POST /api/feedback- Submit feedbackGET /api/feedback- Get all public feedbackGET /api/feedback/my-feedback- Get user's feedback
GET /api/admin/dashboard- Get dashboard statisticsGET /api/admin/users- Get all usersGET /api/admin/borrow-records- Get all borrow recordsPUT /api/admin/feedback/:id/status- Update feedback status
- Responsive design with Tailwind CSS
- Modern React components
- Form validation with Formik + Yup
- Toast notifications
- Loading states and error handling
- Login/Register pages
- Dashboard with statistics
- Book catalog with search
- Book detail page
- My Books (borrowing history)
- Groups management
- Feedback system
- User profile
- Admin dashboard
- Admin book management
- Admin user management
- Admin borrow records
- Admin feedback management
- JWT-based authentication
- Password hashing with bcrypt
- Role-based access control
- Input validation and sanitization
- CORS configuration
- Environment variable protection
- Welcome emails for new users
- Overdue book notifications
- Fine notifications with detailed breakdown
- Admin notifications for system events
- Set up MongoDB database (local or cloud)
- Configure environment variables
- Deploy to your preferred platform (Heroku, AWS, etc.)
- Ensure MongoDB connection is accessible
- Build the React app:
npm run build - Deploy the
distfolder to your hosting platform - Update API URL in environment variables
- User registration and login
- Book browsing and search
- Individual book borrowing
- Group creation and management
- Group book borrowing
- Book return with different conditions
- Fine calculation and payment
- Feedback submission
- Admin dashboard functionality
- Email notifications
After setting up the system, you can create an admin account using the API:
curl -X POST http://localhost:5000/api/admin/create-admin \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-d '{
"name": "Admin User",
"email": "admin@library.com",
"password": "admin123",
"phone": "1234567890",
"address": "Admin Address"
}'-
MongoDB Connection Error
- Ensure MongoDB is running
- Check connection string in .env file
- Verify network access if using cloud MongoDB
-
Email Notifications Not Working
- Check email configuration in .env
- Verify SMTP credentials
- Test with a simple email service first
-
Frontend Not Connecting to Backend
- Verify VITE_API_URL in client/.env
- Check if backend server is running
- Ensure CORS is properly configured
-
Authentication Issues
- Check JWT_SECRET in .env
- Verify token expiration settings
- Clear browser localStorage if needed
- MongoDB Documentation
- Express.js Documentation
- React Documentation
- Tailwind CSS Documentation
- Vite Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
Happy Coding! π
For any issues or questions, please check the troubleshooting section or create an issue in the repository.