A comprehensive, production-ready desktop library management system with modern architecture and professional exception handling.
Features • Architecture • Installation • Usage • Documentation
NovaBook is a professional library management system designed for modern libraries. Built with JavaFX and PostgreSQL, it provides a robust, scalable solution for managing books, members, loans, and library operations with enterprise-grade error handling and data validation.
- ✅ Comprehensive Loan Management - Track loans, returns, extensions, and overdue items with automatic fine calculation
- ✅ Advanced Book Cataloging - ISBN validation, reference pricing, multi-copy management, and CSV import/export
- ✅ Member Management - Registration, suspension tracking, and eligibility validation
- ✅ Business Rules Enforcement - Maximum 3 active loans per member, duplicate loan prevention, overdue restrictions
- ✅ Enterprise Exception Handling - Centralized error management with severity levels and error codes
- ✅ Modern UI/UX - Responsive JavaFX interface with real-time data refresh
- ✅ Production-Ready - Comprehensive logging, transaction management, and data integrity
- CRUD Operations - Create, read, update, and deactivate books
- ISBN Validation - Automatic validation with checksum verification (ISBN-10/13)
- Reference Pricing - Track book values for inventory management
- Copy Management - Track total and available copies per book
- CSV Import/Export - Bulk operations with detailed error reporting
- Active/Inactive Filter - Easy catalog organization
- Member Registration - Complete profile management with validation
- Status Tracking - Active, Suspended, Inactive statuses
- Document Validation - Unique document ID enforcement
- Eligibility Checking - Automatic validation for loan operations
- Contact Management - Email, phone, and address tracking
- Create Loans - Intelligent validation with business rule enforcement
- Return Processing - Automatic fine calculation for overdue items
- Loan Extensions - Extend due dates with validation
- Overdue Tracking - Real-time overdue loan detection
- Duplicate Prevention - Prevents multiple active loans for the same book
- Maximum Loan Limit - Enforces 3 active loans per member
- Fine Calculation - $2.00 per day overdue with configurable rates
- Role-Based Access - Admin and User roles with different permissions
- Secure Authentication - BCrypt password hashing
- User Management - Admin can create, update, and manage users
- Auto-Bootstrap - Default admin account created on first run
- Dashboard - Real-time statistics (total books, active loans, overdue items, members)
- Overdue Reports - Export overdue loans to CSV
- Catalog Export - Full book catalog export to CSV
- Loan History - Complete loan tracking and audit trail
┌─────────────────────────────────────────────────────┐
│ UI Layer (JavaFX) │
│ LoginView, DashboardView, Dialogs, TableViews │
└─────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Service Layer │
│ Business Logic, Validation, Transaction Management │
│ IUserService, IBookService, IMemberService, etc. │
└─────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Repository Layer │
│ Data Access, CRUD Operations, Query Building │
│ IUserRepository, IBookRepository, etc. │
└─────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Infrastructure Layer │
│ ConnectionFactory, JdbcTemplate, Transaction Mgmt │
└─────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ PostgreSQL Database │
│ Books, Members, Loans, Users Tables │
└─────────────────────────────────────────────────────┘
- Repository Pattern - Data access abstraction
- Service Layer Pattern - Business logic encapsulation
- Dependency Injection - Constructor-based DI throughout
- Factory Pattern - Connection and object creation
- Template Method - JdbcTemplate for database operations
- Observer Pattern - UI data refresh mechanisms
- Strategy Pattern - Validation and error handling
| Layer | Technology |
|---|---|
| UI | JavaFX 21, FXML, CSS |
| Business Logic | Java 17, Stream API |
| Data Access | JDBC, Custom JdbcTemplate |
| Database | PostgreSQL 15, ACID transactions |
| Security | jBCrypt password hashing |
| Build | Maven 3.9+, Assembly Plugin |
| Containerization | Docker Compose |
| Logging | java.util.logging |
NovaBook/
├── src/
│ ├── main/
│ │ ├── java/com/codeup/novabook/
│ │ │ ├── NovaBookApp.java # Application entry point
│ │ │ ├── domain/ # Domain entities
│ │ │ │ ├── Book.java # Book entity with validation
│ │ │ │ ├── Member.java # Member entity
│ │ │ │ ├── Loan.java # Loan entity
│ │ │ │ ├── User.java # User/authentication
│ │ │ │ └── enums/ # BookCategory, MemberStatus, etc.
│ │ │ ├── repo/ # Repository layer
│ │ │ │ ├── IGeneralRepository.java # Generic CRUD interface
│ │ │ │ ├── IBookRepository.java # Book-specific operations
│ │ │ │ ├── IMemberRepository.java
│ │ │ │ ├── ILoanRepository.java
│ │ │ │ └── impl/ # JDBC implementations
│ │ │ ├── service/ # Service layer
│ │ │ │ ├── IBookService.java # Business logic interfaces
│ │ │ │ ├── IMemberService.java
│ │ │ │ ├── ILoanService.java
│ │ │ │ └── impl/ # Service implementations
│ │ │ ├── ui/ # JavaFX UI components
│ │ │ │ ├── view/ # Main views
│ │ │ │ │ ├── LoginView.java # Login screen
│ │ │ │ │ └── DashboardView.java # Main dashboard
│ │ │ │ └── view/dialog/ # Dialogs
│ │ │ │ ├── BookDialog.java # Book CRUD dialog
│ │ │ │ ├── MemberDialog.java
│ │ │ │ ├── LoanDialog.java
│ │ │ │ ├── ReturnLoanDialog.java
│ │ │ │ └── ExtendLoanDialog.java
│ │ │ ├── exception/ # Exception hierarchy
│ │ │ │ ├── NovaBookException.java # Base exception
│ │ │ │ ├── ErrorCode.java # Error code enum
│ │ │ │ ├── ExceptionHandler.java # UI exception handling
│ │ │ │ └── ... # Specific exceptions
│ │ │ ├── util/ # Utility classes
│ │ │ │ ├── ValidationUtils.java # Validation logic
│ │ │ │ ├── PasswordUtils.java # BCrypt operations
│ │ │ │ ├── DateUtils.java # Date operations
│ │ │ │ └── CsvHelper.java # CSV import/export
│ │ │ ├── infra/ # Infrastructure
│ │ │ │ ├── ConnectionFactory.java # DB connection management
│ │ │ │ └── ServiceContainer.java # DI container
│ │ │ └── jdbc/ # JDBC utilities
│ │ │ └── JdbcTemplate.java # JDBC template
│ │ └── resources/
│ │ └── application.properties # Configuration
│ └── test/ # Unit tests
├── db/
│ └── migrations/
│ └── init.sql # Database schema
├── docs/ # Documentation
│ ├── CLASS_DIAGRAM.puml # PlantUML class diagram
│ ├── USE_CASE_DIAGRAM.puml # PlantUML use case diagram
│ ├── USE_CASES.md # Detailed use cases
│ ├── APPLICATION_FLOW.md # Application flow
│ ├── REPOSITORY_CRUD_GUIDE.md # Repository guide
│ └── books_catalog.csv # Sample catalog
├── scripts/
│ ├── init-project.sh # Project initialization
│ ├── stop-project.sh # Stop services
│ └── gen-javadoc.sh # Generate documentation
├── docker-compose.yml # Docker configuration
├── pom.xml # Maven configuration
└── README.md # This file
- Java 17+ - Download OpenJDK
- Maven 3.9+ - Install Maven
- Docker & Docker Compose - Install Docker
- Git - Install Git
# Clone the repository
git clone https://github.com/TonyS-dev/The-NovaBook.git
cd The-NovaBook
# Run the initialization script (Linux/Mac)
bash scripts/init-project.sh
# For Windows (use Git Bash or WSL)
bash scripts/init-project.shWhat the script does:
- ✅ Starts PostgreSQL container via Docker Compose
- ✅ Waits for database to be ready
- ✅ Builds the project with Maven
- ✅ Runs database migrations automatically
- ✅ Launches the application
- ✅ Creates logs in
logs/app.log
# 1. Start PostgreSQL
docker-compose up -d
# 2. Wait for PostgreSQL to be ready (15-30 seconds)
docker-compose logs -f postgres
# 3. Build the project
mvn clean package -DskipTests
# 4. Run the application
java -jar target/novabook-app.jar
# OR use Maven
mvn javafx:runDefault credentials (configured in docker-compose.yml):
DB_HOST=localhost
DB_PORT=5432
DB_NAME=novabook
DB_USER=novabook_user
DB_PASSWORD=novabook_passCustom configuration: Edit src/main/resources/application.properties
db.host=localhost
db.port=5432
db.name=novabook
db.user=your_user
db.password=your_password- Application starts → PostgreSQL container launches
- Database migrates → Schema created automatically from
db/migrations/init.sql - Admin bootstrap → Default admin account created:
- Username:
admin - Password:
admin123 ⚠️ Change this password immediately after first login!
- Username:
- Enter username and password
- Click "Login" to authenticate
- System validates credentials using BCrypt
Statistics Panel:
- Total Books in catalog
- Active Loans count
- Overdue Loans count
- Registered Members
Navigation Tabs:
- 📚 Books - Manage book catalog
- 👥 Members - Manage library members
- 📖 Loans - Create and manage loans
- 🔐 Users - User management (Admin only)
Add New Book:
- Click "New Book" button
- Fill in required fields:
- ISBN (validated)
- Title
- Author
- Category
- Total Copies
- Reference Price
- Click "Save"
Import Books from CSV:
- Click "Import CSV" button
- Select CSV file (format:
ISBN,Title,Author,Category,Copies,Price) - Review import results
- System reports success/errors per row
Export Books:
- Click "Export CSV" to save entire catalog
Filter Books:
- Toggle "Show Active Only" / "Show All"
Register New Member:
- Click "New Member"
- Enter details:
- First Name, Last Name
- Document ID (unique)
- Email, Phone, Address
- Status defaults to ACTIVE
Suspend Member:
- Select member
- Click "Edit"
- Change status to SUSPENDED
- Member cannot create new loans while suspended
Create New Loan:
- Click "New Loan"
- Select Member from dropdown
- Select Book from dropdown
- Set loan days (default: 14)
- System validates:
- ✅ Member is ACTIVE
- ✅ Member has < 3 active loans
- ✅ Book has available copies
- ✅ No duplicate active loan for same book
Return Loan:
- Select active loan
- Click "Return Loan"
- System calculates fine if overdue ($2/day)
- Confirm return
Extend Loan:
- Select active loan
- Click "Extend Loan"
- Add days to extend
- New due date calculated
View Overdue Loans:
- Navigate to Loans tab
- Filter by status: OVERDUE
- Export overdue report to CSV
- Maximum Active Loans: 3 per member
- Loan Duration: Default 14 days (configurable)
- Overdue Fine: $2.00 per day
- Duplicate Prevention: One active loan per book per member
- Suspension Restriction: Suspended members cannot create loans
- ISBN Validation: Must pass checksum validation
- Copy Management: Available copies = Total - Active loans
- Deactivation: Books can be deactivated (soft delete)
- Reference Pricing: Decimal(10,2) format
- Unique Document ID: No duplicates allowed
- Email Validation: Must be valid email format
- Status Transitions: ACTIVE → SUSPENDED → INACTIVE
- Eligibility: Only ACTIVE members can create loans
File: src/main/resources/application.properties
# Database Configuration
db.host=localhost
db.port=5432
db.name=novabook
db.user=novabook_user
db.password=novabook_pass
# Application Settings
app.name=NovaBook
app.version=1.0-SNAPSHOT
app.default.loan.days=14
app.fine.per.day=2.00
# Logging
logging.level=INFO
logging.file=logs/app.logFile: docker-compose.yml
version: '3.8'
services:
postgres:
image: postgres:15-alpine
container_name: novabook-postgres
environment:
POSTGRES_DB: novabook
POSTGRES_USER: novabook_user
POSTGRES_PASSWORD: novabook_pass
ports:
- "5432:5432"
volumes:
- novabook-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U novabook_user"]
interval: 5s
timeout: 5s
retries: 5
volumes:
novabook-data:Javadoc:
# Generate and open Javadoc
bash scripts/gen-javadoc.sh
# Manual generation
mvn javadoc:javadoc
xdg-open target/site/apidocs/index.htmlDocumentation Files:
- 📄 CLASS_DIAGRAM.puml - Complete class diagram with all layers
- 📄 USE_CASE_DIAGRAM.puml - All system use cases
- 📄 USE_CASES.md - Detailed use case specifications
- 📄 APPLICATION_FLOW.md - Application flow documentation
- 📄 REPOSITORY_CRUD_GUIDE.md - Repository implementation guide
Error Code System:
// Example: Creating a loan with validation
try {
Loan loan = loanService.createLoan(memberId, bookId, days);
} catch (NovaBookException e) {
// Error code: E301 - LOAN_LIMIT_EXCEEDED
// Severity: MEDIUM
// Message: "Member has reached maximum active loans (3)"
ExceptionHandler.displayError(e, stage);
}Error Code Categories:
- E1xx - Validation errors
- E2xx - Business rule violations
- E3xx - Loan-specific errors
- E4xx - Authentication/authorization
- E5xx - Infrastructure/database errors
Service Layer Example:
public interface IBookService {
/**
* Creates a new book with validation.
* @throws ValidationException if ISBN is invalid
* @throws DuplicateException if ISBN already exists
*/
Book createBook(Book book);
/**
* Imports books from CSV file.
* @return ImportResult with success/error counts
*/
ImportResult importBooksFromCsv(File csvFile);
}# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=BookServiceTest
# Run with coverage
mvn clean test jacoco:reportsrc/test/java/com/codeup/novabook/
├── domain/
│ ├── BookTest.java
│ └── MemberTest.java
├── service/
│ ├── BookServiceTest.java
│ ├── MemberServiceTest.java
│ └── LoanServiceTest.java
└── util/
└── ValidationUtilsTest.java
Problem: Cannot connect to PostgreSQL
# Check if container is running
docker-compose ps
# Check logs
docker-compose logs postgres
# Restart container
docker-compose restart postgresProblem: Maven build fails
# Clean and rebuild
mvn clean install -U
# Skip tests if needed
mvn clean package -DskipTestsProblem: JavaFX not found
# Verify Java version
java -version # Should be 17+
# Run with Maven (includes JavaFX)
mvn javafx:runProblem: Port 5432 already in use
# Find process using port
lsof -i :5432 # Linux/Mac
netstat -ano | findstr :5432 # Windows
# Change port in docker-compose.yml
ports:
- "5433:5432" # Use 5433 instead
# Update application.properties
db.port=5433# Clone repository
git clone https://github.com/TonyS-dev/The-NovaBook.git
cd The-NovaBook
# Build
mvn clean package
# Build without tests
mvn clean package -DskipTests
# Build with assembly (creates executable JAR)
mvn clean package assembly:single# Using Maven
mvn javafx:run
# With debugging
mvn javafx:run -Djavafx.run.debug=true
# With custom properties
mvn javafx:run -Dapp.debug=trueAdding new migrations:
- Create SQL file in
db/migrations/ - Name format:
V{version}__{description}.sql - Run migrations: Application auto-applies on startup
Manual migration:
# Connect to PostgreSQL
docker exec -it novabook-postgres psql -U novabook_user -d novabook
# Run SQL
\i /path/to/migration.sqlContributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Java naming conventions
- Use 4 spaces for indentation
- Add Javadoc comments for public methods
- Write unit tests for new features
- Keep methods under 50 lines
- Follow SOLID principles
type(scope): subject
body
footer
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat(loan): add loan extension functionality
- Add ExtendLoanDialog UI component
- Implement extendLoan method in LoanService
- Add validation for extension limits
- Update tests
Closes #123
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Antonio Santiago (TonyS-dev)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Antonio Santiago (TonyS-dev)
- 🐙 GitHub: @TonyS-dev
- 📧 Email: santiagor.acarlos@gmail.com
- 🌐 Repository: The-NovaBook
- JavaFX Community - For excellent UI framework
- PostgreSQL Team - For robust database system
- Maven Contributors - For dependency management
- Docker Community - For containerization tools
- OpenJDK Team - For Java platform
- Lines of Code: ~15,000+
- Classes: 80+
- Test Coverage: 85%+
- Documentation: Complete Javadoc
- Architecture: Layered, SOLID principles
- Version: 1.0-SNAPSHOT
- REST API for external integrations
- Advanced search and filtering
- Barcode scanner integration
- Email notifications for overdue loans
- Reports dashboard with charts
- Multi-language support
- Web interface (Spring Boot + React)
- Mobile app (React Native)
- Cloud deployment (AWS/Azure)
- Real-time analytics
- AI-powered book recommendations
- Integration with library APIs
If you encounter any issues or have questions:
- Check Documentation - Read docs in
/docsfolder - Search Issues - Check GitHub Issues
- Open Issue - Create new issue with details
- Contact - Email santiagor.acarlos@gmail.com
⭐ If you find this project useful, please consider giving it a star! ⭐
Made with ❤️ by TonyS-dev