Overview
E-Commerce
A distributed e-commerce backend made of Spring Boot microservices. It uses PostgreSQL per service, Redis for caching and auth token handling, Apache Kafka for asynchronous order and payment flows, and Zipkin-compatible tracing. Everything needed for local development is orchestrated with Docker Compose.
Architecture
Traffic enters through the API Gateway (:8080), which routes /api/** requests to the appropriate service by path. Each service owns its PostgreSQL database (created on first Postgres startup). Order placement publishes an order-placed event; the payment service consumes it, records a payment, and publishes payment-processed; the order service updates order status from that topic, and the notification service persists user-facing notifications from both topics.
flowchart LR
Client --> Gateway
Gateway --> UserSvc[User Service]
Gateway --> ProductSvc[Product Service]
Gateway --> OrderSvc[Order Service]
Gateway --> PaymentSvc[Payment Service]
Gateway --> NotifSvc[Notification Service]
OrderSvc --> Kafka[Kafka]
PaymentSvc --> Kafka
NotifSvc --> Kafka
OrderSvc --> ProductSvc
UserSvc --> PG[(PostgreSQL)]
ProductSvc --> PG
OrderSvc --> PG
PaymentSvc --> PG
NotifSvc --> PG
UserSvc --> Redis[(Redis)]
ProductSvc --> Redis
Tech stack
| Area | Technology |
|---|---|
| Language & runtime | Java 17 |
| Framework | Spring Boot 3.2 (Web, Data JPA, Security, Kafka, Actuator, Validation) |
| API gateway | Spring Cloud Gateway (WebFlux) |
| Databases | PostgreSQL 15 (one database per service via init script) |
| Migrations | Flyway |
| Messaging | Apache Kafka (Confluent 7.5 images) + Zookeeper |
| Cache | Redis 7 |
| API docs | springdoc-openapi (Swagger UI on each REST service) |