A full-stack, JSON-backed Library Management System built to demonstrate core Data Structures & Algorithms concepts, clean OOP design, and a modern Django web stack.
- About the Project
- Features
- Tech Stack
- Getting Started
- File Structure
- Usage
- Contributing
- License
- Acknowledgements
This Library Management System allows librarians to manage members, books, and issue/return workflows with:
- Efficient storage in JSON files (one per domain: members, books, issueRecords).
- Binary-search lookups on IDs (O(log n) performance).
- Automatic ID generation & duplicate detection.
- Business rules: age-limit enforcement, 3-book borrow cap, and real-time copy counts.
- Modular OOP design with three Python classes:
Members
β add/update/delete/search membersBooks
β add/update/delete/search booksIssueBooks
β issue & return logic, inherits from both
A Django backend wires these algorithms into HTML/CSS/JS views for a seamless librarian dashboard experience.
- Member Management
- Add, update, and delete members
- Automatic
MXXX
ID generation - Duplicate-check by name, age & contact
- Book Management
- Add, update, and delete books
- Automatic
BXXX
ID generation - Track total, available & issued copies
- Issue & Return Workflow
- Auto-generated
IXXX
issue IDs - Enforce age limits & max 3 books per member
- Real-time copy count updates
- Stamp issue date & return date
- Auto-generated
- Backend: Python 3 β’ Django
- Data Storage: JSON files (
members/members.json
,books/books.json
,issuebooks/issueBooks.json
) - Frontend: HTML β’ CSS β’ JavaScript
- Version Control: Git & GitHub
- Python 3.8+
- pip (package manager)
- Git
-
Clone the repo
git clone https://github.com/JarrarShahid/Library-Management-System.git cd LibraryManagementSystem
-
Create a virtual environment & install dependencies
python3 -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows pip install -r requirements.txt
-
Initialize JSON data files Ensure the following files exist (empty list [] if fresh):
members/members.json
books/books.json
issuebooks/issueBooks.json
-
Run Django development server
python manage.py migrate python manage.py runserver
LIBRARYMANAGEMENT/
β
βββ authentication/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ apps.py
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ users.json
β βββ views.py
β
βββ books/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ books.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ issuebooks/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ issueBooks.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ libraryManagement/
β βββ __pycache__/
β βββ __init__.py
β βββ asgi.py
β βββ settings.py
β βββ urls.py
β βββ wsgi.py
β
βββ members/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ members.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ static/
β βββ css/
β βββ style.css
β
βββ templates/
β βββ issueTemplates/
β β βββ issueBook.html
β β βββ issueBooksPreview.html
β β βββ returnBook.html
β β
β βββ memberTemplates/
β β βββ addMember.html
β β βββ deleteMember.html
β β βββ membersPreview.html
β β βββ updateMember.html
β β
β βββ addBooksPage.html
β βββ base.html
β βββ booksPreview.html
β βββ deleteBook.html
β βββ login.html
β βββ updateBook.html
β
βββ db.sqlite3
βββ manage.py
LIBRARYMANAGEMENT/
β
βββ authentication/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ apps.py
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ users.json
β βββ views.py
β
βββ books/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ books.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ issuebooks/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ issueBooks.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ libraryManagement/
β βββ __pycache__/
β βββ __init__.py
β βββ asgi.py
β βββ settings.py
β βββ urls.py
β βββ wsgi.py
β
βββ members/
β βββ __pycache__/
β βββ migrations/
β βββ __init__.py
β βββ admin.py
β βββ algorithms.py
β βββ apps.py
β βββ members.json
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β
βββ static/
β βββ css/
β βββ style.css
β
βββ templates/
β βββ issueTemplates/
β β βββ issueBook.html
β β βββ issueBooksPreview.html
β β βββ returnBook.html
β β
β βββ memberTemplates/
β β βββ addMember.html
β β βββ deleteMember.html
β β βββ membersPreview.html
β β βββ updateMember.html
β β
β βββ addBooksPage.html
β βββ base.html
β βββ booksPreview.html
β βββ deleteBook.html
β βββ login.html
β βββ updateBook.html
β
βββ db.sqlite3
βββ manage.py
from members.algorithms import Members
from books.algorithms import Books
from issuebooks.algorithms import IssueBooks
import json
# Load current data
with open('members/members.json') as f: members = json.load(f)
with open('books/books.json') as f: books = json.load(f)
with open('issuebooks/issueBooks.json') as f: issues = json.load(f)
# Instantiate handlers
member_mgr = Members()
book_mgr = Books()
issue_mgr = IssueBooks()
# Add a new member
res = member_mgr.add_members(members, name="Alice", age=30, contact="555-1234", address="123 Maple St.")
print(res) # "Member Added Successfully"
# Add a new book
res = book_mgr.add_a_book(books, title="1984", author="George Orwell",
category=["Dystopian"], copies=5, ageLimit=15, releaseDate="1949-06-08")
print(res) # "Book Added Successfully"
# Issue a book
res = issue_mgr.issue_a_book(issues, memberID="M001", bookID="B001", expectedReturn="2025-05-15")
print(res) # "Book Issued Successfully"
We welcome contributions!
- Fork the project
- Create a feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -m 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Open a Pull Request
Please adhere to the existing code style and include tests where applicable.
This project is licensed under the MIT License β see the LICENSE file for details.