This project is a Spring Boot Microservice-based Library Management System designed to manage books, users, and borrowing operations in a scalable and modular way. The system uses API Gateway, Eureka Service Discovery, Config Server, and supports JWT-based authentication and distributed tracing with Zipkin.
The system is composed of the following services:
- API Gateway: Central entry point that handles routing and filtering.
- User Microservice: Manages user registration, authentication, and profile updates.
- Book Microservice: Handles books, authors, publishers, categories, and loan operations.
- Eureka Server: Service discovery for microservices.
- Config Server: Externalized configuration management.
- Zipkin: For distributed tracing across services.
-
User Service Tables:
auth: Stores email, hashed password, role, and status.users: Patron-specific data including name, phone, and address.
-
Book Service Tables:
books,authors,publishers,genres,categories,languages- Join tables like
book_authors,book_genres,book_categories book_copies: Physical book copies with barcode and statusloans: Borrowed books and return trackingloan_penalties: Tracks penalties for late returns
The system uses JWT-based authentication via the /api/v1/auth/login and /register endpoints. JWTs are passed in Authorization: Bearer <token> headers and verified in the API Gateway.
- Roles supported:
PATRON: End users who can borrow books.LIBRARIAN: Admin users with full access to book management.
Available in the repository as postman_collection.json. Main endpoints:
POST /api/v1/auth/register-librarianPOST /api/v1/auth/register-patronPOST /api/v1/auth/login
GET /api/v1/usersPUT /api/v1/users/{id}DELETE /api/v1/users/{id}
GET /api/v1/books,POST /books,PUT,DELETE/searchendpoint supports filters: author, genre, language, etc.
POST /book-copiesGET /book-copies/barcode/{barcode}/availablePATCH /book-copies/{id}/status
POST /loansPATCH /loans/return/{barcode}GET /loans/myGET /loans/penalties
- Java 21, Spring Boot 3+
- Spring Cloud Gateway, Eureka, Config Server
- PostgreSQL
- JWT for Auth
- Lombok, WebFlux
- Docker & Docker Compose
- Zipkin for tracing
- Postman
- Swagger & OpenAPI
-
Clone the repo:
git clone https://github.com/umytyenidil/SpringLibraryManagement.git cd SpringLibraryManagement -
Run the compose:
docker compose up
-
Run the services manually in the following order:
⚠ Make sure
PostgreSQLis running and database connection configurations inapplication.ymlare correctly set for each service.-
Config Server
RunConfigServerApplication.java -
Eureka Server
RunDiscoveryServerApplication.java -
User Microservice
RunUserServiceApplication.java -
Book Microservice
RunBookServiceApplication.java -
API Gateway
RunGatewayServiceApplication.java
-
-
Access the system:
- Swagger UI: http://localhost:8080/swagger-ui.html
- API Gateway: http://localhost:8080
- Eureka Dashboard: http://localhost:8761
- Zipkin UI (if enabled): http://localhost:9411

