How harunates/ecommerce works
Main Components
• API Gateway: Acts as the front door, routing client requests to the backend services.
• Discovery Server: Provides service registration and discovery (likely implemented with Netflix Eureka as indicated).
• Order Service: Manages order processing and business logic, has both REST endpoints and event handling (publishing OrderCreatedEvent).
• Product Service: Handles product-related operations, inventory checks, and similar functions.
• Notification Service: Responsible for sending notifications based on events (e.g., OrderCreatedEvent).
• Infrastructure Elements: Include databases (MySQL), a messaging system (Apache Kafka), and observability tools (Prometheus, Grafana, Zipkin, Micrometer).
Relationships and Interactions
• The API Gateway receives external client calls and forwards them to the appropriate microservice.
• Microservices register with the Discovery Server, allowing dynamic discovery of service endpoints.
• Order Service and Product Service, as primary commerce operation handlers, likely interact both synchronously (via REST calls) and asynchronously (using event-driven messaging, e.g., through Kafka).
• Notification Service consumes events (such as an order creation event) published by Order Service.
• Observability tools are integrated into each service to collect metrics, logs, and traces, feeding into Prometheus (with Grafana for dashboards) and Zipkin for distributed tracing.
Architectural Patterns
• Microservices Architecture: Clear separation into independent services.
• API Gateway Pattern: Centralized entry point for clients.
• Service Discovery Pattern: Letting services find one another dynamically (via Eureka).
• Event-driven Communication: Asynchronous messaging (using Apache Kafka) for decoupled interactions between services, especially for notifications.
• Containerization: Each service is containerized (Dockerfiles exist within each project directory) and managed via Docker Compose.
• Resilience Patterns: Use of circuit breakers (Resilience4J) for robust error handling.
Including Relevant Technologies
• Languages & Frameworks: Java, Spring Boot, Spring Cloud, Spring Cloud Gateway, Netflix Eureka.
• Database: MySQL (as seen from the technical stack and default application properties in each service).
• Messaging: Apache Kafka (for event-driven communication).
• Observability: Micrometer, Zipkin, Prometheus, Grafana.
• Build Tools: Maven, with containerization using Docker and Jib.