A web-based application for managing library operations across EduLib Schools Consortium.
- Book Management: Add, edit, delete books with ISBN, title, author, genre, and quantity tracking.
- Student Management: Register students with personal and school information.
- Borrowing & Returning: Track book loans with automatic due dates and overdue detection.
- Reporting: Generate reports on most borrowed books, overdue items, and books per school.
- User Interface: Clean, Bootstrap-based web interface suitable for non-technical users.
- REST API (for testing): A lightweight JSON API is available under
/apifor books, students, borrowings and statistics.
- Backend: Python Flask
- Database: SQLite (easily switchable to PostgreSQL)
- Frontend: HTML, CSS (Bootstrap), Jinja2 templates
- Forms: Flask-WTF
- Migrations: Flask-Migrate
-
Clone the repository:
git clone <repository-url> cd library_management_system
-
Create virtual environment:
python -m venv venv
-
Activate virtual environment:
- Windows:
venv\Scripts\activate - Linux/Mac:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Initialize database (run migrations):
set FLASK_APP=run.py; flask db init; flask db migrate -m "initial"; flask db upgrade
-
Run the application:
python run.py
Access the app at
http://localhost:5000
For development/testing there is a simple JSON API registered under the blueprint api and available at /api.
Important: The API was made public (no authentication) for testing purposes — do not leave it public in production.
Available endpoints (examples):
-
Books
GET /api/books— list books (query params:available_only=true,genre=...)GET /api/books/<id>— get book detailsPOST /api/books— create book (JSON body:isbn,title,author,quantity, optionalgenre)PUT /api/books/<id>— update bookDELETE /api/books/<id>— delete book
-
Students
GET /api/students— list studentsGET /api/students/<id>— student detailsPOST /api/students— create student (email,full_name,class_name,school)PUT /api/students/<id>— updateDELETE /api/students/<id>— delete
-
Borrowings
GET /api/borrowings— list borrowings (query params:status,student_id,book_id)POST /api/borrowings— create borrowing (student_id,book_id)POST /api/borrowings/<id>/return— mark borrowing returned
-
Statistics
GET /api/statistics— library stats (total books, copies, active borrowings, overdue, etc.)
Invoke-RestMethod -Uri "http://localhost:5000/api/books" -Method GET
$body = @{
isbn = '978-0-123456-78-9'
title = 'Test Book'
author = 'Test Author'
quantity = 5
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:5000/api/books" -Method POST -Body $body -ContentType 'application/json'- Postman: create requests to
http://localhost:5000/api/...and inspect responses. - Thunder Client (VS Code extension): test endpoints directly inside VS Code.
- Navigate to the home page and use the menu to manage books, students, borrowings, and view reports.
- Add books by providing ISBN, title, author, etc.
- Register students with their details.
- Borrow books by selecting student and available book.
- Return books from the borrowings list.
- View reports for insights into library usage.
Run unit tests:
python -m unittest tests/test_app.pyFor testing the admin panel and protected features, use the default admin account below:
- Email: admin@edulib.com
- Password: admin123
Note: These credentials are for development and testing purposes only. Make sure to change or remove default credentials before deploying the system to production.
- The API endpoints are currently public for testing. Before deploying to production, re-enable authentication on the API (restore
@login_required/ admin checks) and secure the app. - The API blueprint is defined in
app/api.pyand registered inapp/__init__.py.
- Functional requirements: Book CRUD, Student CRUD, Borrowing/Returning, Reporting
- Non-functional: Easy UI, SQLite database, Python/Flask backend
- Database schema: Books, Students, Borrowings tables
- Architecture: Flask MVC with templates
- Code structure:
app/withmodels.py,routes.py,forms.py,templates/andapi.py
- Unit tests for models and key functions
- Manual testing via web UI, admin panel, and API
- Switch to PostgreSQL for production, secure API, and configure proper secret keys and deploy behind HTTPS
- Google Books API integration for auto-filling book details
- Email notifications for overdue books
- Barcode scanning for books