Skip to content

MuhammadAusajaHussain/Reengineered-Library-Management-System

Repository files navigation

Library Management System (Reengineered)

A reengineering of a legacy console-based Java LMS into a layered Spring Boot backend and a modern React frontend, while preserving the core library domain workflows.


Repository Structure

.
├── api/          # Spring Boot backend (Java 8 target, embedded Apache Derby)
├── client/       # React + Vite frontend
├── Database/     # Auto-created Derby database (generated on first run)
├── Project/      # Original legacy NetBeans OOAD console implementation (reference only)
└── docs/         # Setup, strategy, and refactoring documentation

Prerequisites

Tool Version Notes
JDK 8 or 17 recommended Java 21+ may cause warnings with Spring Boot 2.7.x
Maven / mvnd Any recent mvnd 1.0.5 used in development
Node.js 18+ Required for the React frontend
npm 9+ Comes with Node.js

No database installation required. The backend uses an embedded Apache Derby database that is created automatically on first run inside the Database/ folder.


Getting Started

1. Clone the Repository

git clone https://github.com/MuhammadAusajaHussain/Reengineered-Library-Management-System.git
cd Reengineered-Library-Management-System

2. Start the Backend

Using mvnd:

cd api
mvnd spring-boot:run

Using standard Maven:

cd api
mvn spring-boot:run

The backend starts at: http://localhost:9000

On first startup, the system automatically creates the Derby database and bootstraps the default admin account.

3. Start the Frontend

cd client
npm install      # only needed on first run
npm run dev

The frontend starts at: http://localhost:8080


Running on a New System

This project is designed for maximum portability. When cloning to a new system:

  1. Zero Database Setup: You do not need to install any database server (MySQL/PostgreSQL). The system uses an embedded Apache Derby database.
  2. Self-Bootstrap: On the first run, the backend automatically creates the Database/ directory, initializes the schema, and generates the necessary log files (e.g., derby.log).
  3. Cross-Platform: The project includes a .gitattributes file to handle line-ending differences between Windows, macOS, and Linux automatically.

Simply ensure you have the Prerequisites installed, then follow the Getting Started steps.


Default Admin Credentials

Field Value
Username admin
Password admin

The admin account is automatically created/reset on every backend startup via bootstrap properties in api/src/main/resources/application.properties. This keeps demo access stable regardless of database state.


Implemented Features

  • Authentication with role-based access (ADMIN, LIBRARIAN, CLERK, BORROWER)
  • Admin user management — create, update, delete, and list users
  • Book catalog — list, search, create, update, delete
  • Borrower management — create, list, get profile
  • Circulation — checkout, check-in, renew
  • Fine tracking and fine payment
  • Hold lifecycle
    • Place hold
    • Cancel hold
    • Auto-mark oldest hold READY when a copy is returned
    • Staff checkout of a READY hold
  • Active loans and loan history endpoints
  • Dashboard statistics for staff roles

Runtime Ports

Service URL
Backend API http://localhost:9000
Frontend (Vite) http://localhost:8080

The frontend proxies all /api/* requests to the backend on port 9000.


Troubleshooting

Port already in use

If you see Port 9000 is already in use, a backend instance is already running. Find and stop it:

On Windows (PowerShell):

Get-NetTCPConnection -LocalPort 9000 | Select-Object OwningProcess, State
Stop-Process -Id <PID> -Force

On macOS/Linux:

lsof -i :9000
kill -9 <PID>

Apply the same approach for port 8080 if the frontend fails to start.


Derby database locked

If you see Another instance of Derby may have already booted the database, the database file is locked by a previous crashed process.

  1. Kill all Java processes:

    Windows: taskkill /F /IM java.exe
    macOS/Linux: pkill -f java

  2. Delete the lock file inside the Database/LMS_REENGINEERED/ folder:

    • db.lck
    • dbex.lck (if present)
  3. Restart the backend.


JAVA_HOME warning (mvnd)

This is non-fatal — the app still runs. To silence it, set JAVA_HOME to your JDK installation:

Windows (permanent):

setx JAVA_HOME "C:\path\to\your\jdk"

macOS/Linux:

export JAVA_HOME=/path/to/your/jdk
# Add the above line to ~/.bashrc or ~/.zshrc to make it permanent

Open a new terminal after setting this.


Documentation

See the docs/ folder for:

  • reengineering-strategy.md — overall reengineering approach and rationale
  • refactoring-log.md — detailed log of refactoring decisions
  • setup.md — environment setup and configuration notes

These documents map the implemented changes to reengineering and refactoring concepts from the course material.


User Interface

1. Login Page

Login Page

2. Admin Pages

i. Dashboard Page Admin Dashboard

ii. Books Page Admin Books Page

iii. Add Book Page Admin Add Book Page

iv. Edit Book Page Admin Edit Book

v. Circulation Page Admin Circulation Page

vi. Loan Page Admin Loan Page

vii. Holds Page Admin Holds Page

viii. Borrowers Page Admin Borrowers Page

ix. Register Borrowers Page Admin Register Borrowers

x. User Management Page Admin User Management Page

xi. Add User Page Admin Add User

xii. Edit User Page Admin Edit User

3. Librarian Pages

i. Dashboard Page Librarian Dashboard

ii. Books Page Librarian Books Page

iii. Add Book Page Librarian Add Book Page

iv. Edit Book Page Librarian Edit Book Page

v. Circulation Page Librarian Circulation Page

vi. Loans Page Librarian Loans Page

vii. Holds Page Librarian Holds Page

viii. Borrowers Page Librarian Borrowers Page

ix. Add Borrower Page Librarian Add Borrower Page

x. Edit Borrower Page Librarian Edit Borrower Page

4. Clerk Pages

i. Dashboard Page Clerk Dashboard

ii. Books Page Clerk Books Page

iii. Circulation Page Clerk Circulation Page

iv. Loans Page Clerk Loans Page

v. Holds Page Clerk Holds Page

vi. Borrowers Page Clerk Borrowers Page

vii. Add Borrower Page Clerk Add Borrower

viii. Edit Borrower Page Clerk Edit Borrower

5. Borrower Pages

i. Dashboard Page Borrower Dashboard

ii. Books Page Borrower Books Page

iii. Loans Page Borrower Loans Page

iv. Holds Page Borrower Holds Page

About

A reengineering of a legacy console-based Java LMS into a layered Spring Boot backend and a modern React frontend, while preserving the core library domain workflows.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages