Digital Library is a comprehensive Full Stack web application designed to simulate a real-world library management system. It features a robust Java Spring Boot backend, a modern React frontend, and a PostgreSQL database, all containerized for easy deployment.
The application manages the entire lifecycle of library operations: book inventory, user authentication, borrowing/returning workflows, and administrative oversight.
- Modern UI/UX: Responsive design that works perfectly on Desktop and Mobile.
- π Dark Mode Support: Built-in theme switcher (Light/Dark) for better accessibility.
- Visual Inventory: Books are displayed with cover images fetched from URLs.
- Authentication System: Secure Login and Registration pages with role-based redirection.
- Dynamic Dashboard:
- Public View: Browse the book catalog with search filters.
- User View: Borrow books and manage personal active loans.
- Admin View: Exclusive access to the Admin Dashboard with Sidebar navigation.
- Smart Stock Management: Automatically tracks
Total Copiesvs.Available Copies. - Transactional Integrity: Uses
@Transactionalto ensure data consistency. - Validation Rules: Prevents borrowing if stock is 0 or deleting books with active history.
- Secure API: REST endpoints protected by Basic Authentication and Role-Based Access Control (RBAC).
| Component | Technology | Description |
|---|---|---|
| Frontend | React (Vite) | Modern JavaScript library for building UI |
| Styling | Bootstrap 5 | Responsive CSS framework |
| Backend | Java 17 | Core programming language |
| Framework | Spring Boot 3 | Web, Data JPA, Security, Validation |
| Database | PostgreSQL 15 | Relational database management system |
| DevOps | Docker | Containerization for the database |
| Build Tools | Maven & npm | Dependency management and build automation |
The application relies on a PostgreSQL database running in a Docker container.
Run the following command to start the DB:
docker run --name digital-library-db -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=digitallibrary -p 5432:5432 -d postgres- Open the project in IntelliJ IDEA.
- Navigate to the backend folder.
- Run DigitalLibraryApplication.java.
- The API will start on http://localhost:8080.
- Open a terminal in the frontend folder.
- Install dependencies (first time only).
npm install- Start the development server.
npm run devThe API is secured using Basic Authentication. You must register users first to interact with the protected endpoints.
| Role | Access Level | Capabilities |
|---|---|---|
| Admin | Full Control | β’ Add, Edit, Delete Books β’ Manage Inventory & Stock β’ View All Loans |
| User | Restricted | β’ View Book Catalog β’ Borrow Books β’ Return Books β’ View Personal History |
How to create accounts: Use the Register page in the application.
- Select "Student(User)" for a standard account.
- Select "Librarian(Admin)" to access administrative features.
| Method | Endpoint | Description | Access |
|---|---|---|---|
POST |
/auth/register |
Register a new account. Body requiers: username, password and role. |
π Public |
Inventory endpoints for listing and managing books.
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/books |
List all books. Supports filters: ?author=X, ?year=2023, ?available=true. |
π Public |
GET |
/books/{id} |
Get details of a specific book. | π Public |
POST |
/books |
Add a new book to the inventory. | π Admin |
PUT |
/books/{id} |
Update book details or total stock. | π Admin |
DELETE |
/books/{id} |
Remove a book (Validates if currently borrowed). | π Admin |
Core business logic for loaning and returning items.
| Method | Endpoint | Description | Access |
|---|---|---|---|
POST |
/borrow/{bookId} |
Borrow a book. Decreases available stock. | π User/Admin |
PUT |
/borrow/return/{id} |
Return a book using the BorrowRecord ID. Increases stock. | π User/Admin |
GET |
/borrow/my-history |
View complete borrowing history for the logged-in user. | π User/Admin |
GET |
/borrow/my-active |
View currently active loans (books not yet returned). | π User/Admin |
The repository is organised as a Monorepo:
digital-library/
βββ backend/ # Spring Boot Application (Source Code, pom.xml)
βββ frontend/ # React Application (Source Code, package.json)
βββ README.md # DocumentationThis project was developed as a Final Project for the Java Development Course. It successfully implements all required specifications:
-
CRUD Operations
-
Authentication & Security
-
Database Integration
-
RESTful Architecture
Additionally, the project was expanded with a complete React Frontend, dynamic stock management logic, and an intuitive user interface.