Event-Driven E-Commerce Architecture
Microservices e-commerce platform with asynchronous order processing using Redis Streams, FastAPI gateway, and React frontend with real-time Server-Sent Events
Overview
This project demonstrates event-driven microservices architecture for e-commerce order processing. Instead of synchronous calls between services, three independent microservices (Inventory, Payment, Shipment) communicate asynchronously through a Redis Streams message broker. A React TypeScript frontend shows the event chain in real time using Server-Sent Events (SSE).
Architecture
Event Flow:
- Client submits order via the React UI
- FastAPI Gateway publishes
order.createdto Redis Streams - Inventory Service reads the order, reserves stock, publishes
inventory.reserved - Payment Service reads the reservation, processes charge, publishes
payment.processed - Shipment Service reads the payment, creates a shipping label, publishes
shipment.created - Gateway streams all events back to the client in real time via SSE
Each service runs independently, processes one event at a time using Redis consumer groups, and publishes results back to the stream. If a service goes down, messages wait in Redis until it recovers.
Why Event-Driven Matters
Resilience: If Shipment crashes, payment events wait in Redis until it restarts. No lost messages, no broken orders.
Scalability: Services scale independently. Run 3 Payment containers and 1 Inventory container based on actual bottlenecks.
Deployment: Independent CI/CD per service. A buggy Inventory release does not affect Payment or Shipment. Zero-downtime updates since new containers pick up pending events.
Technologies & Skills
| Component | Technology |
|---|---|
| Gateway | FastAPI + uvicorn (async Python) |
| Message Broker | Redis 7 Streams with consumer groups |
| Frontend | React + TypeScript + Vite |
| Real-time | Server-Sent Events (SSE via sse-starlette) |
| Orchestration | Docker Compose (6 containers with health checks) |
| Services | Python + redis-py (Inventory, Payment, Shipment) |
Resilience Demo
The project includes a practical demonstration:
- Start the full system with
docker-compose up --build - Submit an order, watch events flow through the pipeline in real time
- Stop the Shipment service:
docker-compose stop shipment - Submit another order: events proceed up to
payment.processedbut no shipment - Restart Shipment:
docker-compose start shipment - The pending
shipment.createdevent appears automatically
Team & My Role
Solo Project: Andres Felipe Camacho, DevOps course presentation, University of Chicago
Source Code
Repository: anfelipecb/ecommerce_event_driven