How cero-t/spring-store-2022 works
This project is a Spring Boot–based microservices application, built as an example of a distributed, full-stack system using multiple bounded contexts. The README and file structure clearly indicate that it is organized into several services (BFF, Cart, Delivery, Item, Messaging, Order, Payment, and Stock) that interact with each other, following a microservices architecture. It also integrates monitoring (using Prometheus, Loki, Tempo and Grafana) as well as middleware (RabbitMQ for messaging) and deployment configurations for both Docker and Kubernetes.
Main Components
• BFF (Backend For Frontend): Acts as a gateway. It provides the Swagger UI for API interactions and communicates with other microservices.
• Microservices Domains:
• Cart Service: Includes its domain, client, and service implementations.
• Item Service: Contains client, domain, and service code for managing catalog items.
• Order Service: Handles processing orders and order-related operations.
• Payment Service: Processes payments via a client and service setup.
• Stock Service: Checks and maintains inventory levels.
• Delivery Service: Manages delivery operations.
• Messaging Service: Provides an abstraction layer for message handling and integration with RabbitMQ.
• Infrastructure and External Integrations:
• RabbitMQ for message queuing.
• Monitoring tools: Prometheus, Loki, Tempo for collecting metrics, logs, and traces, with Grafana as the visualization layer.
• Deployment components for Docker (docker-compose stack) and Kubernetes (YAML manifests and Helm charts).
Relationships and Interactions
• BFF → Item Service (for catalog viewing)
• BFF → Cart Service (for managing carts)
• BFF → Order Service (to place orders)
• Within services, illustrate additional interactions:
• Cart Service → Item Service (to fetch item details)
• Cart Service → Stock Service (to verify inventory)
• Order Service → Stock Service (for stock deductions)
• Order Service → Messaging Service (for asynchronous order processing and integration with payment and delivery)
• Messaging Service → Payment Service (to settle payments)
• Messaging Service → Delivery Service (to initiate delivery)
• Microservices to external middleware (show messaging with RabbitMQ as the underlying mechanism).
Architectural Patterns and Design Principles
• Emphasis on microservices and domain-driven design: Each service is encapsulated (with its own client, domain, and service layers).
• Clear separation of concerns: The BFF is separated from the core business logic that lives in individual services.
• Use of asynchronous messaging: The Messaging service and RabbitMQ ensure reliable event-driven communication.
• Observable design: Integration with Prometheus, Loki, Tempo, and Grafana emphasizes monitoring from the start.
• Deployment readiness: Support for containerization (via Docker) and orchestrated deployment (via Kubernetes) is evidenced by the provided configurations.
Relevant Technologies and Tools
• Spring Boot 3.0 and Spring Cloud Stream for developing microservices.
• Maven for build and dependency management.
• Docker and Kubernetes (with Helm charts) as deployment platforms.
• RabbitMQ for messaging infrastructure.
• Monitoring components: Prometheus, Loki, Tempo, Grafana.
Essential Elements
• Annotations to briefly explain roles where necessary (e.g., “Messaging Service: Provides asynchronous communication via RabbitMQ”).