A comprehensive database-driven application for managing a library's operations, including member management, book inventory, borrowing, and employee tracking.
This Library Management System provides a complete solution for libraries to:
- Manage book inventory and copies
- Track member information and borrowing history
- Handle employee records and assignments
- Process book issues and returns
- Manage publishers and suppliers
- Python 3.7+
- MySQL Server
- Web browser (for future frontend integration)
- Clone the repository
git clone https://github.com/aryanpola/library-management-system.git
cd library-management-system- Install required dependencies
pip install -r requirements.txt- Set up the database
Update the database credentials in create_database.py, populate_database.py, and sever.py if needed:
host="localhost"
user="root"
password="your-password"- Create database schema
python create_database.py- Populate the database with sample data
python populate_database.py- Start the Flask server
python sever.pyThe API server will start on http://localhost:5000
The system uses the following tables:
- Employee: Staff information and hierarchy
- Member: Library members and their details
- Books: Book catalog information
- book_copies: Individual copies of each book
- Publisher: Book publisher information
- Supplier: Book supplier details
- Issues: Book borrowing records
- Borrowed_by: Relationship between members and issued books
GET /members- List all membersPOST /members- Add a new memberGET /members/books/<member_id>- Get books issued to a member
GET /books- List all booksPOST /books- Add a new book
POST /issue_book- Issue a book to a member
- create_database.py: Creates the MySQL database and tables
- populate_database.py: Seeds the database with sample data using Faker
- sever.py: Flask API server with endpoints
- requirements.txt: Python package dependencies
The system implements:
- Stored procedures for common operations
- Triggers to:
- Check book availability before issuance
- Verify member has no outstanding fines
- Update book availability status automatically
curl -X POST http://localhost:5000/members \
-H "Content-Type: application/json" \
-d '{"member_ID":"MEM123456","first_name":"John","last_name":"Doe","city":"New York"}'curl -X POST http://localhost:5000/issue_book \
-H "Content-Type: application/json" \
-d '{"member_id":"MEM123456","copy_id":"CP123"}'- Frontend user interface
- Book return functionality
- Fine calculation and payment system
- Search functionality
- Reports and analytics dashboard