Cloud Shop is a sample online shop application built to demonstrate modern microservices patterns using Spring Boot, Spring Cloud, Kafka, Centralized Swagger docs and an observability stack. The project focuses on reliability, security, scalability, and visibility while keeping each service small and well-defined.
The system implements:
- Centralized configuration
- Distributed tracing
- Event-driven architecture
- Centralized logging
- Circuit breakers and retries
- Secure microservices using Keycloak
flowchart LR
Client[Client / Frontend]
subgraph Docker["Docker Compose Environment"]
Gateway[API Gateway]
Product[Product Service]
ProductDB[(MongoDB)]
Order[Order Service]
OrderDB[(MySQL)]
Inventory[Inventory Service]
InventoryDB[(MySQL)]
Kafka[(Kafka Broker)]
Notification[Notification Service]
Email["Email Provider<br/>Mailtrap"]
end
Client --> Gateway
Gateway --> Product
Product --> ProductDB
Gateway --> Order
Order --> OrderDB
Order -- "Sync HTTP + Resilience4j" --> Inventory
Inventory --> InventoryDB
Order -- "Async Event Kafka" --> Kafka
Kafka --> Notification
Notification --> Email
- Java 21
- Spring Boot 4
- Spring Web MVC
- Spring Data JPA / MongoDB
- Spring Cloud Gateway (MVC)
- Spring Security OAuth2 Resource Server
- Spring HTTP Interface (RestClient)
- Resilience4j
- Apache Kafka
- Schema Registry
- Avro serialization
- MongoDB (Product Service)
- MySQL (Order & Inventory Services)
- Flyway for database migrations
- Spring Boot Actuator
- Micrometer
- Prometheus
- Grafana
- Loki
- Tempo
- Docker & Docker Compose
- Testcontainers
- WireMock
- RestAssured
- Springdoc OpenAPI
- Centralized Swagger documentation via API Gateway
- Angular
- Keycloak
- API Gateway with circuit breakers and fallbacks
- Keycloak for authentication and authorization
- Kafka + Schema Registry for asynchronous messaging
- Prometheus for metrics
- Loki for centralized logging
- Tempo for distributed tracing
- Grafana for visualization
- Acts as the product catalog
- Create and view products
- MongoDB persistence
- REST API with OpenAPI documentation
- Centralized logging, metrics, and tracing enabled
- Handles order creation
- Persists orders in MySQL
- Synchronous inventory check using HTTP interface client
- Resilience4j circuit breaker and retry
- Publishes
order-placedevents to Kafka
- Checks product availability
- MySQL persistence
- Used synchronously by Order Service
- Protected with circuit breaker
- Consumes order events from Kafka
- Uses Avro schemas via Schema Registry
- Sends order confirmation emails using Java Mail Sender
- Kafka observation enabled for tracing
- Single entry point for all clients
- Route configuration for backend services
- Aggregated OpenAPI / Swagger documentation
- Circuit breaker and fallback handling
- Security enforcement via Keycloak
- Order Service → Inventory Service
- Implemented using Spring HTTP Interfaces
- Protected by Resilience4j (timeouts, retries, circuit breakers)
- Order Service → Notification Service
- Implemented using Kafka
- Avro schemas managed via Schema Registry
- Keycloak used as Authorization Server
- OAuth2 Resource Server configuration in services
- Gateway validates JWT tokens
- Realm configuration exported to avoid data loss
- Centralized logging using Loki
- Logback Loki appender configuration
- Spring Boot Actuator
- Micrometer with Prometheus registry
- Micrometer Tracing with Brave
- Tempo as tracing backend
- HTTP and Kafka observation enabled
- Integration tests with Testcontainers
- MongoDB, MySQL, and Kafka containers
- REST API testing using RestAssured
- WireMock used for contract testing
- Product Service with MongoDB and integration tests
- Order Service with MySQL, Flyway, and tests
- Inventory Service with MySQL and availability checks
- Synchronous communication with circuit breakers
- API Gateway with routing, security, and Swagger aggregation
- Kafka-based event-driven communication
- Notification Service with email delivery
- Observability stack integration (logs, metrics, tracing)
- Frontend integration using Angular and Keycloak
-
Start infrastructure using Docker Compose
-
Start backend services
-
Start API Gateway
-
Start frontend service
-
Access:
- Gateway API
- Swagger UI via Gateway
- Grafana dashboards
- Kafka UI