How adeshppp/shopit-a-microservices-based-online-shopping-platform works
Project Type and Purpose
• The project is an online shopping platform built using a microservices architecture.
• It includes several key functionalities such as user authentication/authorization (secured by Keycloak), product catalog management, shopping cart, order processing/tracking, and payment integration.
• The README mentions extensive use of synchronous/asynchronous communication patterns, circuit breakers (using Resilience4J), distributed tracing (via Spring Cloud Sleuth and Zipkin), and event-driven architecture with Apache Kafka.
File Structure
• The top-level directories each represent one microservice:
• api-gateway (single entry point using Spring Cloud Gateway)
• discovery-server (service registry using Netflix Eureka with basic authentication)
• inventory-service, order-service, product-service, and notification-service (each a Spring Boot project with their own controllers, services, models, repositories, and configurations).
• A docker-compose.yml file indicates container orchestration across the entire system.
• The presence of multiple Dockerfiles and Maven pom.xml files for each service reinforces the decoupled microservices paradigm.
Main Components to Capture
a. API Gateway:
• Acts as the single entry point for external consumers.
• Implements request filtering, load balancing, authentication (integrated with Keycloak), and SSL termination.
• Should be placed at the edge of the system.
b. Discovery Server:
• Uses Netflix Eureka to register service instances.
• Helps microservices to discover each other dynamically, and includes a local registry for failover if the discovery server itself fails.
c. Core Microservices:
• Inventory Service: Manages inventory database and product availability.
• Order Service: Processes orders and coordinates with other services.
• Product Service: Manages product catalog details.
• Notification Service: Sends notifications post order placement.
d. External Integrations and Supporting Components:
• Keycloak: Provides robust authentication and authorization.
• Databases: A mix of MySQL AWS RDS and NoSQL MongoDB.
• Kafka: Facilitates event-driven communication (asynchronously between Order and Notification services).
• Distributed Tracing: Implements Spring Cloud Sleuth and Zipkin to trace requests across services.
• Circuit Breaker: Implemented with Resilience4J to ensure resilient communication between Order Service and Inventory Service.
e. Docker & Deployment:
• Dockerfiles for containerization.
• A global docker-compose file to orchestrate service containers.
Relationships and Interactions
• The API Gateway then dispatches traffic to appropriate microservices based on REST API routes.
• The Discovery Server mediates lookup for service instances (key for handling multiple instances and dynamic IP addresses).
• Inter-service communications that also incorporate distributed tracing (show propagation of trace IDs/spans across API Gateway, Order, and Inventory Services) and circuit breaker flows.