Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

Projects › Advanced

Microservices E-commerce Backend

Split an online store into product, order, inventory, payment and notification services that talk over REST and Kafka.

Level: Advanced · Time: 3–4 weeks · Tech stack: Spring Boot, Spring Cloud Gateway, Kafka, Docker, PostgreSQL

Features to build

What you will learn

Step-by-step guide

1. Draw the boundaries

Each service owns its own database. Order doesn't read the inventory table — it asks Inventory.

2. Gateway

Spring Cloud Gateway routes /api/products/** → product-service, etc., and validates the JWT once.

3. The order saga (choreography)

  1. Order service saves the order as PENDING and publishes OrderCreated.
  2. Inventory reserves stock → StockReserved (or StockFailed).
  3. Payment charges → PaymentDone (or PaymentFailed → Inventory releases stock).
  4. Order becomes CONFIRMED or CANCELLED; Notification emails the user.
@KafkaListener(topics = "order-created")
public void reserve(OrderCreated e) { /* idempotent: ignore if this orderId was already handled */ }

4. Reliable events

Use the transactional outbox: write the event to an outbox table in the same DB transaction, and publish it from there.

5. Resilience

Resilience4j circuit breaker + timeout on every REST call between services.

6. Run it all

One docker-compose.yml with Kafka, PostgreSQL per service and all apps. Add distributed tracing (Zipkin) to follow one order across services.

Level it up

On your resume

Learn on Codify