This project was created for educational purposes. During development, AI tools were used in some parts to draft text and to fix critical bugs. AI was used for text drafts and bug-fixing suggestions; all architecture decisions, domain model, and final code were implemented and reviewed by me.
- Lanterna-based TUI with lists, selection, and guided prompts
- CRUD for books, members, and reservations; copy management for books
- Loan and return workflows with member-based loan policies
- Update loan dates and due dates
- Reservation queue with READY/QUEUED/FULFILLED/CANCELLED states
- Search for books and members using n-gram fuzzy matching (2-3 grams)
- Reports: overdue loans, member loans, popular books, CSV export
- SQLite storage with JSON file fallback and transactional operations
- Configurable storage mode, demo data toggle, and app logging
- JUnit tests for the service layer
- Book(bookId, isbn, title, author, year, genre, totalLoans)
- BookCopy(copyId, isbn, status)
- Member(memberId, name, email, type)
- Loan(loanId, copyId, memberId, loanDate, dueDate, returnDate)
- Reservation(reservationId, isbn, memberId, createdAt, status)
Statuses:
- CopyStatus: AVAILABLE, LOANED, RESERVED, LOST
- ReservationStatus: QUEUED, READY, FULFILLED, CANCELLED
- MemberType: STUDENT, ADULT
Loan:
- Validate member and book
- Check maxLoans via LoanPolicy
- If member has a READY reservation, use a RESERVED copy
- Otherwise pick an AVAILABLE copy; if none, inform the user to reserve
- Create Loan, set copy to LOANED, increment book totals, fulfill reservation if used
Return:
- Find active loan by copy ID
- Set returnDate on the loan
- Set copy to AVAILABLE
- If queued reservations exist, mark next as READY and set copy to RESERVED
Reserve:
- Validate member and book
- Ensure no active reservation for the same member and book
- Ensure no AVAILABLE copies
- Create a QUEUED reservation
- lms.ui: Lanterna windows (TUI)
- lms.model: entities and enums
- lms.service: business logic (loan/return/reserve, search)
- lms.storage: repositories and storage factory
- lms.storage.sqlite: SQLite/JDBC repositories
- lms.storage.file: JSON file repositories
- lms.report: reports and CSV export
- lms.policy: loan policies and fine policies
- lms.util: validation, ID generation, date providers, config, logging
- lms.exception: custom exceptions
- Classes/objects: lms.model.Book, lms.model.Loan, lms.model.Reservation, lms.model.Member
- Encapsulation & validation: lms.util.Validators, lms.exception.ValidationException
- Inheritance: lms.model.User -> lms.model.Member, lms.model.Librarian
- Polymorphism: LoanPolicy implementations, FinePolicy implementations, StorageFactory selects storage
- Interfaces & abstraction: Repository<T, ID>, LibraryStorage, LoanPolicy, FinePolicy
- Exceptions: lms.exception.* and UI handling in lms.ui.DialogUtils
- Collections: List/Set/Queue in LibraryService, Map/EnumMap in LoanPolicyResolver
- Generics: Repository<T, ID>, DialogUtils.Choice
- File I/O: JSON repositories in lms.storage.file, CSV export in lms.report.CsvExporter
- DB access: lms.storage.sqlite.* via JDBC
- Testing: JUnit 5 in src/test/java/lms/service/LibraryServiceTest.java
- SQLite database:
data/lms.db - JSON fallback:
data/books.json,data/copies.json, etc. - Config file:
config/app.propertiesstorage.mode=SQLITEorstorage.mode=FILEdemo.enabled=trueordemo.enabled=false
- If SQLite initialization fails (JDBC or connection errors), the app falls back to file storage
- Logs are written to
app.log
- LibraryStorage.runInTransaction keeps related updates atomic
- LibraryService.loanByIsbn: set copy LOANED, create loan, increment book totals, fulfill reservation
- LibraryService.returnByCopyId: set returnDate, update copy status, promote next reservation to READY
- LibraryService.removeBook: delete related copies and the book in one transaction
Requirements: Java 11, Maven.
Run the TUI:
mvn exec:java
Run tests:
mvn test
Build a runnable JAR:
mvn package
The shaded JAR is created under target/*-all.jar.
- Tab / Shift+Tab: move focus between controls
- Arrow keys: navigate tables and lists
- Enter: activate buttons or select rows
- F1: open help
- Selected rows are marked with
*
- Demo data is seeded only when storage is empty
- Disable it with
demo.enabled=falseinconfig/app.properties
- Add book and add copies
- Loan until maxLoans triggers an error
- Return triggers reservation READY
- Overdue report and export CSV
- Switch storage mode and restart
- Search books/members with short and long queries
General:
- Integrated Library System - overview (Wikipedia). Used for ILS terminology and scope.
- The Integrated Library System (ILS) Primer (Lucidea). Used for ILS concepts and workflows.
Architecture and real-world solutions (most important):
- Koha - official documentation (Koha). Used as reference for reservation queues and circulation flow.
- FOLIO documentation (overview) (FOLIO). Used for modular architecture and ILS vocabulary.
How to design your own LMS (applied):
- Library Management System - Software Engineering perspective (GeeksForGeeks). Used for feature checklist and use cases.
- Building a Library Management System (Python / OOP) (Medium). Used for OOP modeling ideas.