This project is a web-based Library Management System developed using Python and Flask. The application is designed to help manage books, library members, and loan records using a relational database.
The system supports CRUD operations, relationship handling between tables, transaction logic for loans, server-side validation, and a dashboard displaying summary statistics.
- Add, update, and delete books
- Store book metadata such as ISBN, author, genre, and publication date
- Manage member records and contact details
- Maintain unique member entries
- Create and manage book loans
- Prevent unavailable books from being borrowed again
- Track return status and overdue records
- Display aggregate statistics using SQL functions
- Show total books, members, loans, and late return averages
- Server-side validation for required fields
- SQL constraints for data integrity
- Relational schema normalized to 3NF
- Python 3
- Flask
- SQLite
- SQLAlchemy
- HTML5
- CSS3
- Bootstrap
- Jinja2 Templates
- Git & GitHub
Library-Management-System/
โ
โโโ app.py
โโโ requirements.txt
โโโ final_schema.sql
โโโ AI_LOG.md
โโโ NORMALIZATION.md
โโโ README.md
โโโ run_project.bat
โ
โโโ templates/
โ โโโ base.html
โ โโโ dashboard.html
โ โโโ books.html
โ โโโ members.html
โ โโโ loans.html
โ โโโ forms/
โ
โโโ static/
โ โโโ css/
โ โโโ style.css
โ
โโโ screenshots/
Windows users can run the application directly using:
run_project.bat
This automatically:
- creates the virtual environment
- installs dependencies
- creates the database if needed
- starts the Flask server
- opens the application in the browser
Python 3 must be installed before running the project.
Download Python from:
https://www.python.org/downloads/
During installation, make sure to enable:
Add Python to PATH
git clone https://github.com/Gungn1r-G/Library-Management-System.git
cd Library-Management-SystemWindows:
python -m venv venvMac/Linux:
python3 -m venv venvWindows PowerShell:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\venv\Scripts\Activate.ps1Windows Command Prompt:
venv\Scripts\activate.batMac/Linux:
source venv/bin/activatepip install -r requirements.txtThe SQL schema file included in the project is:
final_schema.sql
If the library.db file already exists, the project can usually be started immediately after installing dependencies.
To create the database manually from the schema file:
Start Python:
pythonThen run:
import sqlite3
conn = sqlite3.connect("library.db")
with open("final_schema.sql") as f:
conn.executescript(f.read())
conn.commit()
conn.close()
exit()Start the Flask server:
python app.pyOpen the application in a browser:
http://127.0.0.1:5000
View summary statistics for books, members, and active loans.
Add, edit, update, and delete books.
Manage library member records.
Create and view book loan records.
- Empty fields are restricted through server-side validation.
- Loan transactions update book availability when a loan is created.
- Unavailable books cannot be loaned again until returned.
- SQL constraints help maintain relational data integrity.
NORMALIZATION.mdโ 3NF normalization reportAI_LOG.mdโ AI usage disclosurefinal_schema.sqlโ final relational database schema
Possible future enhancements include:
- Search and filtering functionality
- Authentication and login system
- Exporting reports to CSV or PDF
- REST API support
- Role-based access control
- Advanced analytics and reporting
The .gitignore file excludes unnecessary folders such as:
venv/
__pycache__/
.env
library.db
Developed as part of the CS665 Database Application Project.



