This project is a full-featured Library Management System (LMS) built as a Command-Line Interface (CLI) application using Java, JDBC, and PostgreSQL.
The LMS supports multiple user roles, including:
Admin
Librarian
Staff
Borrower
The system manages books, loans, requests, fines, holds, and user accounts with a clean DAO → Service → UI architecture.
- Manage staff & librarians
- View system reports
- Full control over library operations
- Add / Update / Delete books
- Search by title, author, subject, ISBN
- Track availability
- Register borrower
- Update borrower info
- View borrower history
- Issue books
- Return books
- Auto-calculate late fees
- Track overdue items
- Borrower can request books
- Staff processes holds
- Automated hold queue
- Daily fine calculation
- Track fine history
- Fine payment handling
- Issued books
- Loan summaries
- Java 17+
- PostgreSQL
- JDBC
- Maven / Gradle / IDE Build Tools
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.2</version>
</dependency>dependencies {
implementation 'org.postgresql:postgresql:42.7.2'
}Download the JDBC driver manually:
🔗 https://jdbc.postgresql.org/download/
Add the .jar file to your project:
File → Project Structure → Modules → Dependencies → + Add JAR
- Java 17+
- PostgreSQL
- JDBC
- Maven / IDE Build Tools
graph TD;
A[User CLI] --> B[Controller Layer]
B --> C[Service Layer]
C --> D[DAO Layer]
D --> E[(PostgreSQL DB)]
C --> F[Utility Classes]
src/
│
├── entity/
│ ├── Book.java
│ ├── Loan.java
│ ├── Borrower.java
│ ├── Staff.java
│ ├── Person.java
│ └── HoldRequest.java
│
├── dao/
│ ├── BookDAO.java
│ ├── LoanDAO.java
│ ├── UserDAO.java
│ ├── StaffDAO.java
│ └── AdminDAO.java
│
├── service/
│ ├── BookService.java
│ ├── LoanService.java
│ ├── UserService.java
│ └── StaffService.java
│
├── controller/
│ ├── AdminInterface.java
│ ├── LibrarianInterface.java
│ ├── StaffInterface.java
│ └── UserInterface.java
│
└── util/
| ├── DBConnection.java
| ├── InputValidation.java
| └── ConsoleHelper.java
└── Main.java
Full SQL seed data provided here:
| Table Name | Description |
|---|---|
| admin | Stores admin accounts and privileges |
| staff | Holds staff records (common parent for clerks and librarians) |
| clerk | Clerk-specific details (desk assignments, linked to staff) |
| librarian | Librarian-specific details (office assignments, linked to staff) |
| borrowers | Contains borrower information, login credentials, and contact details |
| books | Stores book details (title, author, subject, ISBN) |
| book_copies | Tracks individual copies of books, their condition, and issue status |
| loans | Tracks issued books, due dates, returns, and borrower associations |
| hold_requests | Manages book requests and the hold queue |
git clone https://github.com/joel-003/Library-Management-System.git
cd Library-Management-SystemRun the SQL seed file
psql -U postgres -d Library-Management-System -f LMS-SQL-seed.txt
private static final String URL = "jdbc:postgresql://localhost:5432/Library-Management-System";
private static final String USER = "postgres";
private static final String PASSWORD = "root";
Update DB credentials in DBConnection.java.
Compile and run Main.java.
- User selects role (Admin/Librarian/Staff/Borrower)
- Enter credentials
- Application validates
- UI layer loads appropriate dashboard
-
Each loan records issue date & due date
-
Fine auto-calculated using service layer formula
-
Staff/librarian can collect fine
-
Borrower requests book
-
Request added to hold-queue
-
Staff processes requests
-
Book assigned when available
Provides a single shared database connection.
Clears screen and formats CLI output.
Reusable validation functions for email, phone, numbers, etc.
-
Add notifications (email/SMS)
-
Add librarian shift scheduling
-
Add analytics dashboard
-
Add PDF report generation
-
Add automated overdue reminders
This project is licensed under the MIT License.
See the LICENSE file for full details.
Below is a short demo of the CLI in action:
Click below to view all screenshots:
Below is the complete class diagram representing the system architecture.
erDiagram
admin {
serial id PK
text name
text user_id
text password
}
staff {
serial id PK
varchar name
varchar password
varchar email
varchar phno
numeric salary
varchar role
}
clerk {
int id PK, FK
varchar deskid
}
librarian {
int id PK, FK
varchar officeid
}
borrowers {
serial borrower_id PK
varchar name
varchar email
varchar password
varchar phone_number
}
books {
serial book_id PK
varchar title
varchar author
varchar subject
varchar isbn
}
book_copies {
serial copy_id PK
int book_id FK
boolean is_issued
varchar condition
}
hold_requests {
serial hold_id PK
int book_id FK
int borrower_id FK
date request_date
}
loans {
serial loan_id PK
int book_id FK
int copy_id FK
int borrower_id FK
date issue_date
date due_date
date return_date
}
%% Relationships based on your diagram
staff ||--|| clerk : "is a"
staff ||--|| librarian : "is a"
borrowers ||--o{ hold_requests : "places"
books ||--o{ hold_requests : "requested for"
books ||--o{ book_copies : "has"
borrowers ||--o{ loans : "borrows"
books ||--o{ loans : "loaned"
book_copies ||--o{ loans : "copy used"


