A comprehensive, full-stack library management solution featuring a Spring Boot REST API and a modern React frontend. This system handles book inventory, member registrations, borrowing workflows, and automated profile and cover image management.
- JWT-based stateless authentication with token refresh mechanisms
- OAuth2 Social Login integration for third-party providers
- Role-Based Access Control (RBAC) with distinct permissions for Librarians and Members
- Secure password hashing and validation
- Full CRUD operations for Books, Authors, and Genres
- Dynamic categorization and tagging system
- Stock level tracking and availability management
- Author profile management with biographical information
- Comprehensive tracking of borrowed books with due dates
- Borrowing history for members and audit trails
- Available stock level monitoring and reservations
- Member-initiated requests for new titles
- Librarian dashboard for managing and fulfilling requests
- Request status tracking and approval workflows
- Structured local storage for Author photographs
- Book cover image management with optimization
- Member avatar and profile image uploads
- Dynamic directory organization by entity type and ID
- Server-side pagination with configurable page sizes
- Multi-criteria sorting capabilities
- Advanced filtering by genre, author, availability, and publication date
- Search functionality with partial matching and relevance scoring
- Wishlist management for members
- Borrowing history with analytics
- Personalized recommendations based on borrowing patterns
- Reading progress tracking
| Component | Technology | Purpose |
|---|---|---|
| Framework | Java 21, Spring Boot 3.4.3 | Core application framework |
| Security | Spring Security, JJWT, OAuth2 Client | Authentication and authorization |
| Data Access | Spring Data JPA, PostgreSQL | Object-relational mapping and database |
| Object Mapping | ModelMapper | Entity to DTO conversion |
| Additional Libraries | Lombok, Spring AOP, Spring Validation | Boilerplate reduction and cross-cutting concerns |
| Component | Technology | Purpose |
|---|---|---|
| Framework | React 18 with Vite | Modern UI development |
| State Management | Redux Toolkit (authSlice, bookSlice) | Centralized application state |
| Styling | Tailwind CSS | Utility-first CSS framework |
| Routing | React Router DOM | Client-side navigation |
| HTTP Client | Axios | API communication |
library-management-system/
βββ backend/ # Spring Boot Maven Project
β βββ images/ # Local storage for file uploads
β β βββ authors/
β β βββ books/
β β βββ members/
β βββ sql-scripts/ # Database initialization and seed data
β βββ src/main/java/
β β βββ com/lms/
β β β βββ config/ # Spring configuration classes
β β β βββ controller/ # REST API endpoints
β β β βββ service/ # Business logic layer
β β β βββ repository/ # Data access layer (Spring Data JPA)
β β β βββ entity/ # JPA entities
β β β βββ dto/ # Data Transfer Objects
β β β βββ security/ # JWT and OAuth2 configuration
β β β βββ exception/ # Custom exception classes
β β β βββ util/ # Utility classes
β β βββ resources/
β β βββ application.yaml # Spring Boot configuration
β β βββ application-*.yaml # Environment-specific configs
β βββ pom.xml # Maven dependencies
β
βββ frontend/ # React + Vite Project
βββ public/ # Static assets
βββ src/
β βββ app/
β β βββ features/ # Redux slices and reducers
β β β βββ authSlice.js
β β β βββ bookSlice.js
β β β βββ ...
β β βββ store.js # Redux store configuration
β β βββ hooks/ # Custom Redux hooks
β βββ components/ # Reusable React components
β β βββ common/ # Common UI components (Nav, Footer)
β β βββ modals/ # Modal dialogs
β β βββ cards/ # Data display cards
β βββ pages/ # Page-level components
β βββ services/ # API service layer with Axios
β β βββ api.js # Centralized API configuration
β βββ styles/ # Global styles and Tailwind config
β βββ App.jsx # Root application component
β βββ main.jsx # Vite entry point
βββ index.html # HTML template
βββ vite.config.js # Vite configuration
βββ package.json # npm dependencies
βββ tailwind.config.js # Tailwind CSS configuration
Before setting up the project, ensure you have the following installed on your system:
- JDK 21 or higher
- Node.js v18 or higher with npm package manager
- PostgreSQL 12 or higher for database management
- Git for version control
Follow these steps to configure and run the Spring Boot backend application:
-
Navigate to the backend directory:
cd backend -
Update the database configuration in
src/main/resources/application.yamlwith your PostgreSQL credentials and connection details:spring: datasource: url: jdbc:postgresql://localhost:5432/lms_db username: your_postgres_user password: your_postgres_password
-
Create the PostgreSQL database and initialize the schema using the provided SQL scripts:
psql -U your_postgres_user -d postgres -f sql-scripts/init-db.sql
-
Start the Spring Boot application using Maven:
./mvnw spring-boot:run
The backend will be accessible at
http://localhost:8080
Follow these steps to set up and run the React frontend application:
-
Navigate to the frontend directory:
cd frontend -
Install all Node.js dependencies as specified in package.json:
npm install
-
Configure the API endpoint in your environment variables. Create a
.envfile in the frontend root directory:VITE_API_URL=http://localhost:8080/api -
Start the Vite development server:
npm run dev
The frontend will be available at
http://localhost:5173
| HTTP Method | Endpoint | Access Level | Description |
|---|---|---|---|
POST |
/api/auth/register |
Public | Create a new member account with email and password |
POST |
/api/auth/login |
Public | Authenticate user and obtain JWT token for session |
GET |
/api/books |
Member/Librarian | Retrieve books with filtering, pagination, and sorting options |
GET |
/api/books/{id} |
Member/Librarian | Retrieve detailed information for a specific book |
POST |
/api/books |
Librarian | Create new book entry with cover image upload |
PUT |
/api/books/{id} |
Librarian | Update existing book information and metadata |
DELETE |
/api/books/{id} |
Librarian | Remove book from inventory |
POST |
/api/borrow |
Member/Librarian | Create a borrowing record with due date calculation |
GET |
/api/borrow/history |
Member/Librarian | Retrieve borrowing history with status filtering |
PATCH |
/api/borrow/{id}/return |
Member/Librarian | Mark borrowed book as returned |
POST |
/api/bookRequest |
Member | Submit request for new book addition |
GET |
/api/bookRequest |
Librarian | Retrieve pending book requests |
PATCH |
/api/bookRequest/{id} |
Librarian | Update book request status and mark as completed |
GET |
/api/authors |
Member/Librarian | List all authors with pagination |
POST |
/api/authors |
Librarian | Add new author with profile photo |
GET |
/api/genres |
Member/Librarian | Retrieve all available genres |
POST |
/api/genres |
Librarian | Create new genre category |
POST |
/api/wishlist/{bookId} |
Member | Add book to personal wishlist |
GET |
/api/wishlist |
Member | Retrieve member's wishlist items |
All protected endpoints require a valid JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
The system employs a dynamic directory structure for organizing uploaded images to prevent filename collisions and maintain clean filesystem organization across different entity types.
The media storage follows this organizational pattern:
images/
βββ authors/
β βββ {authorId}/
β βββ profile.jpg
β βββ profile-thumbnail.jpg
βββ books/
β βββ {bookId}/
β βββ cover.jpg
β βββ cover-thumbnail.jpg
βββ members/
βββ {memberId}/
βββ avatar.jpg
βββ avatar-thumbnail.jpg
- File Upload: Images are processed server-side to generate thumbnails for optimized loading
- Storage Location: All uploads are stored in the
/imagesdirectory relative to the application root - File Naming: Files are organized by entity type and ID to ensure unique paths
- Cleanup: Implement scheduled tasks to remove orphaned images when entities are deleted
- Validation: Image uploads are validated for file type (JPEG, PNG) and size constraints
The system uses PostgreSQL with the following primary entities:
- Users: Member and Librarian accounts with authentication details
- Authors: Author information with biographical details and profile images
- Books: Book inventory with genre associations and availability tracking
- Genres: Book categorization system
- Borrowing Records: Transaction history with dates and status tracking
- Book Requests: Member requests for new titles with approval workflow
- Wishlist: User's saved books for future borrowing
- Passwords are hashed using Spring Security's bcrypt encoder
- JWT tokens include expiration time and refresh token mechanism
- OAuth2 integration supports secure third-party authentication
- Role-based access control ensures proper permission enforcement
- CORS configuration is implemented for frontend-backend communication
- SQL injection prevention through parameterized queries (Spring Data JPA)
- CSRF protection for state-changing operations
This project is distributed under the MIT License. See the LICENSE file for complete licensing information and terms of use.
Contributions are welcome. Please ensure adherence to existing code style and add appropriate documentation for new features.
For issues, questions, or suggestions, please open an issue in the project repository or contact the development team (Me π).


