E-Library is a microservice-based application for managing books and their reviews. π The project is built with Spring Boot, uses an API Gateway for request routing, and ensures security through Keycloak. π
The project consists of the following core microservices:
-
Book Service (Spring Boot + MySQL) π
- API for books, authors, publishers, genres, and categories.
- Filtering via JPA Specification.
- Secured and public endpoints (see "Security" section).
-
Review Service (Spring Boot + MongoDB) π
- API for book reviews.
- Filtering reviews via query parameters.
- Book review metrics.
-
API Gateway (Spring Cloud API Gateway) π
- Routes
review-service/andbook-service/requests to corresponding services. - Uses OAuth2 (Keycloak) for authentication and authorization.
- Passes JWT tokens between services for role validation.
- Supports integration via registered Keycloak clients.
- Routes
- The local environment runs with
docker-compose.yml. - The production environment uses
docker-compose.prod.yml, which extends and overrides base configurations. - Each microservice has separate configuration files:
application-dev.yml(local development)application-prod.yml(production)
- USER β regular user.
- ADMIN β administrator with add/edit privileges.
- Requires authentication even for public
GETrequests due to Keycloak validation at the gateway level. For such requests,client credentials flowcan be used if registered clients with this flow exist in Keycloak. - Public access:
GET /api/books/**GET /api/authors/**GET /api/publishers/**GET /api/genres/**GET /api/categories/**
- ADMIN-only access:
POST/PUT/DELETE /api/books/**POST/PUT/DELETE /api/authors/**POST/PUT/DELETE /api/publishers/**POST/PUT/DELETE /api/genres/**POST/PUT/DELETE /api/categories/**
-
Requires authentication even for public
GETrequests due to Keycloak validation at the gateway level. For such requests,client credentials flowcan be used if registered clients with this flow exist in Keycloak. -
Public access:
GET /api/reviews/**GET /api/review-metrics/**
-
USER & ADMIN access:
POST/PUT/DELETE /api/reviews/**
-
Tokens are verified through Keycloak. Refresh and revocation are handled via the Keycloak API. π
- All microservices have OpenAPI/Swagger documentation. π
- API Gateway aggregates the documentation from all services. π
- Only registered users can leave reviews. π·οΈ
- Uses Spring Boot Actuator & Prometheus for metrics collection. π
- Prometheus gathers and stores microservice metrics. ποΈ
- Grafana automatically loads dashboards from pre-configured settings. π
- No centralized logging (ELK, Loki). π«
- GitHub Actions is used for CI: π οΈ
- Each service has its own
.github/workflowsfile. π - CI runs only when changes are made in the corresponding microservice. π
- Compilation, testing, and Docker image build are performed. ποΈ
- Each service has its own
- No automatic deployment (handled by the DevOps team). π§