Skip to content

mak1ss/e-library

Repository files navigation

πŸ“š E-Library πŸ“š

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. πŸ”

βš™οΈ Architecture βš™οΈ

The project consists of the following core microservices:

  1. Book Service (Spring Boot + MySQL) πŸ“˜

    • API for books, authors, publishers, genres, and categories.
    • Filtering via JPA Specification.
    • Secured and public endpoints (see "Security" section).
  2. Review Service (Spring Boot + MongoDB) πŸ“

    • API for book reviews.
    • Filtering reviews via query parameters.
    • Book review metrics.
  3. API Gateway (Spring Cloud API Gateway) πŸš€

    • Routes review-service/ and book-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.

πŸ› οΈ Setup & Configuration πŸ› οΈ

  • 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)

πŸ”’ Security πŸ”’

🏷️ User Roles 🏷️

  • USER β€” regular user.
  • ADMIN β€” administrator with add/edit privileges.

πŸ”‘ API Access πŸ”‘

Book Service

  • Requires authentication even for public GET requests due to Keycloak validation at the gateway level. For such requests, client credentials flow can 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/**

Review Service

  • Requires authentication even for public GET requests due to Keycloak validation at the gateway level. For such requests, client credentials flow can 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. πŸ”„

πŸ”— API & Integration πŸ”—

  • All microservices have OpenAPI/Swagger documentation. πŸ“œ
  • API Gateway aggregates the documentation from all services. πŸ“Œ
  • Only registered users can leave reviews. 🏷️

πŸ“Š Monitoring & Logging πŸ“Š

  • 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). 🚫

⚑ CI/CD & Deployment ⚑

  • GitHub Actions is used for CI: πŸ› οΈ
    • Each service has its own .github/workflows file. πŸ“
    • CI runs only when changes are made in the corresponding microservice. πŸ”„
    • Compilation, testing, and Docker image build are performed. πŸ—οΈ
  • No automatic deployment (handled by the DevOps team). πŸ”§

About

E-Library πŸ“š - A microservices-based application for managing books and reviews. Built with Spring Boot, secured with Keycloak, and orchestrated via API Gateway. Supports OAuth2 authentication, Prometheus monitoring, and Grafana dashboards. πŸš€

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors