Skip to content

JarrarShahid/Library-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Library-Management-System

Python Django JSON HTML5 CSS3 JavaScript Git GitHub

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.


πŸš€ Table of Contents

  1. About the Project
  2. Features
  3. Tech Stack
  4. Getting Started
  5. File Structure
  6. Usage
  7. Contributing
  8. License
  9. Acknowledgements

πŸ“– About the Project

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 members
    • Books β€” add/update/delete/search books
    • IssueBooks β€” issue & return logic, inherits from both

A Django backend wires these algorithms into HTML/CSS/JS views for a seamless librarian dashboard experience.


✨ Features

  • 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

πŸ›  Tech Stack

  • 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

πŸš€ Getting Started

Prerequisites

  • Python 3.8+
  • pip (package manager)
  • Git

Installation

  1. Clone the repo

    git clone https://github.com/JarrarShahid/Library-Management-System.git
    cd LibraryManagementSystem
    
  2. 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
    
  3. Initialize JSON data files Ensure the following files exist (empty list [] if fresh):

    members/members.json

    books/books.json

    issuebooks/issueBooks.json

  4. Run Django development server

    python manage.py migrate
    python manage.py runserver
    

πŸ—‚ File Structure

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

πŸ”§ Usage Examples

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"

🀝 Contributing

We welcome contributions!

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -m 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Open a Pull Request

Please adhere to the existing code style and include tests where applicable.

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

Acknowledgements

Maaz Rehan

Fawad Ahmed

Zahid Rasheed

Saym Bin Aziz

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published