A comprehensive library management system with admin panel, student portal, chatbot support, QR code tracking, fine calculation, and most-read book analytics.
✅ Admin Login - Secure admin authentication
✅ Book Management - Add, update, delete, and search books
✅ Student Registration - Register and manage student accounts
✅ Issue & Return Books - Automated transaction tracking
✅ Available Books View - Browse available books
✅ Student Portal - Dashboard for students to manage their accounts
✅ QR Code Generation - Auto-generated QR codes for books
✅ Fine Calculation - Automatic fine calculation for late returns (₹10/day)
✅ Most Read Books - Analytics showing trending books
✅ Chatbot Support - AI-powered assistant for instant help
✅ Transaction History - Track all issue/return history
✅ Overdue Tracking - Monitor overdue books
library-management-system/
├── backend/
│ ├── app/
│ │ ├── __init__.py # Flask app initialization
│ │ ├── models/ # Database models
│ │ │ ├── __init__.py
│ │ │ ├── admin.py # Admin model
│ │ │ ├── student.py # Student model
│ │ │ ├── book.py # Book model
│ │ │ ├── transaction.py # Transaction model
│ │ │ ├── fine.py # Fine model
│ │ │ └── chatbot.py # Chatbot message model
│ │ └── routes/ # API routes
│ │ ├── __init__.py
│ │ ├── admin.py # Admin endpoints
│ │ ├── books.py # Book endpoints
│ │ ├── students.py # Student endpoints
│ │ ├── transactions.py# Transaction endpoints
│ │ └── chatbot.py # Chatbot endpoints
│ ├── config.py # Configuration settings
│ ├── .env # Environment variables
│ ├── requirements.txt # Python dependencies
│ └── run.py # Application entry point
├── database/
│ └── schema.sql # Database schema
├── frontend/
│ ├── index.html # Home page
│ ├── books.html # Browse books
│ ├── login.html # Login page
│ ├── register.html # Student registration
│ ├── dashboard.html # Student dashboard
│ ├── admin-dashboard.html # Admin dashboard
│ ├── css/
│ │ └── styles.css # Main stylesheet
│ └── js/
│ ├── main.js # Common functionality
│ ├── auth.js # Authentication logic
│ ├── books.js # Book page logic
│ ├── dashboard.js # Student dashboard logic
│ └── admin.js # Admin dashboard logic
└── README.md
- Backend: Flask (Python)
- Database: MySQL
- Frontend: HTML5, CSS3, JavaScript
- Authentication: JWT (JSON Web Tokens)
- QR Code Generation: Python qrcode library
- ORM: SQLAlchemy
- Python 3.8+
- MySQL Server
- pip (Python package manager)
- Create MySQL database:
mysql -u root -p < database/schema.sql- Or manually create the database:
CREATE DATABASE IF NOT EXISTS library_management;- Navigate to backend directory:
cd backend- Create virtual environment:
python -m venv venv
source venv/Scripts/activate # Windows
# or
source venv/bin/activate # Linux/Mac- Install dependencies:
pip install -r requirements.txt- Update
.envfile with your database credentials:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=library_management
JWT_SECRET_KEY=your_secret_key
JWT_ACCESS_TOKEN_EXPIRES=3600- Run the Flask server:
python run.pyThe backend API will be available at http://localhost:5000
- Navigate to frontend directory:
cd frontend- Open any HTML file in a web browser:
# Windows
start index.html
# Linux/Mac
open index.htmlOr use a simple HTTP server:
python -m http.server 8000Then access at http://localhost:8000
POST /login- Admin loginPOST /register- Register new adminGET /profile- Get admin profilePUT /profile- Update admin profile
GET /- Get all books (paginated)GET /<id>- Get book by IDGET /search?q=<query>- Search booksPOST /- Add new book (requires auth)PUT /<id>- Update book (requires auth)DELETE /<id>- Delete book (requires auth)GET /most-read- Get most read booksGET /available- Get available books
GET /- Get all students (requires auth)GET /<id>- Get student by IDGET /email/<email>- Get student by emailPOST /register- Register new studentPUT /<id>- Update student profile (requires auth)DELETE /<id>- Deactivate student (requires auth)
POST /issue- Issue book to student (requires auth)POST /return/<id>- Return book (requires auth)GET /student/<id>/active- Get active books for studentGET /student/<id>/history- Get transaction historyGET /overdue- Get overdue books (requires auth)GET /<id>- Get transaction detailsPOST /fine/pay/<id>- Pay fine (requires auth)GET /fine/student/<id>- Get fines for student
POST /message- Send message to chatbotGET /chat-history/<id>- Get chat history for student
POST http://localhost:5000/api/admin/login
{
"username": "admin",
"password": "password123"
}POST http://localhost:5000/api/students/register
{
"name": "John Doe",
"email": "john@example.com",
"phone": "9876543210",
"enrollment_number": "CSE001",
"department": "CS",
"semester": 4
}POST http://localhost:5000/api/books
Headers: Authorization: Bearer <token>
{
"title": "Python Programming",
"author": "Guido van Rossum",
"isbn": "978-0-123456-78-9",
"publisher": "O'Reilly",
"publication_year": 2020,
"category": "Programming",
"total_copies": 5,
"available_copies": 3,
"location": "Section A",
"price": 450.00
}POST http://localhost:5000/api/transactions/issue
Headers: Authorization: Bearer <token>
{
"book_id": 1,
"student_id": 1
}POST http://localhost:5000/api/transactions/return/1
Headers: Authorization: Bearer <token>- Fine is calculated at ₹10 per day
- Fine is auto-calculated when a book is returned after the due date
- Due date is automatically set to 14 days from issue date
The chatbot can help with:
- Searching books by title/author
- Checking pending fines
- Viewing issued books
- Checking transaction history
- General library information
Create admin account by running:
cd backend
pythonThen:
from app import create_app, db
from app.models.admin import Admin
app = create_app()
with app.app_context():
admin = Admin(username='admin', email='admin@library.edu')
admin.set_password('admin123')
db.session.add(admin)
db.session.commit()
print("Admin created successfully")- Automatic QR code generation for each book
- QR code contains book ISBN/ID
- QR codes can be printed and attached to books
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- Email notifications for overdue books
- SMS alerts for fines
- Mobile app development
- Advanced analytics dashboard
- Payment gateway integration
- Book reservations system
- Multi-language support
- Advanced book recommendation engine
- Check MySQL is running
- Verify credentials in
.envfile - Ensure database is created
- Check backend server is running (
python run.py) - Verify API URL in frontend (
http://localhost:5000/api)
- Ensure backend is running on
localhost:5000 - Update CORS headers if needed in backend
For issues or questions, please create an issue in the repository or contact support@library.edu
This project is licensed under the MIT License - see LICENSE.md file for details.
Library Management System Development Team
Last Updated: March 2026