Skip to main contentCapstone: E-Commerce Platform
Congratulations! You’ve learned the individual pieces. Now, let’s build the puzzle.
The Architecture
We will build a simplified Amazon clone.
Microservices
- Product Service: Catalog management (PostgreSQL).
- Order Service: Order placement (PostgreSQL).
- Inventory Service: Stock checks (MySQL).
- Notification Service: Sends emails (Simulated).
Infrastructure
- Discovery: Netflix Eureka.
- Gateway: Spring Cloud Gateway.
- Messaging: Kafka / RabbitMQ.
- Tracing: Zipkin.
The Flow
- User places an order (
POST /api/orders).
- Order Service receives request.
- Synchronous call (
WebClient) to Inventory Service to check stock.
- If out of stock -> Return 400.
- Order Service saves order to DB (Status:
PLACED).
- Order Service publishes
OrderPlacedEvent to Kafka.
- Notification Service listens to
OrderPlacedEvent and sends email.
- Inventory Service listens to
OrderPlacedEvent and reduces stock.
Requirements
- Service Discovery: All services must register with Eureka.
- Gateway: All external calls must go through port 8080 (Gateway).
- Circuit Breaker: If Inventory is down, Order Service should return a fallback (“System busy, try later”) instead of hanging.
- Distributed Tracing: I should be able to see the trace from Gateway -> Order -> Inventory.
Setup Instructions
- Create a parent maven project (pom type).
- Create modules for each service.
- Use
docker-compose to spin up the databases and brokers.
- Implement one service at a time.
- Test using Postman.
Bonus Challenges
- Security: Add Keycloak (OAuth2) to the Gateway.
- Config: Move all
application.yml to a Config Server.
- Resilience: Add Rate Limiting to the Order API.