How ahmedsaad123456/e-commerce-microservices works
This repository is a Spring Boot e-commerce microservices backend. A customer request enters through Nginx and the API Gateway; order creation validates the customer and purchases product stock before persisting an order. Kafka events then drive payment, order confirmation or compensation, while notifications are recorded and email is queued for delivery. The README also documents customer/product APIs, service discovery and centralized configuration, security, and observability. Relationships below follow README-documented behavior; source excerpts were unavailable, so implementation-level call paths are not asserted.
Main entry points: OrderService.java Order workflow · gateway API Gateway · customer Customer API · main Product and stock
Components 22
Ingress and platform
- Nginx balancer
nginx/nginx.conf - API Gateway
gateway-service/src/main/java/com/example/gateway - Config Server
config-server/src/main/java/com/example/config_server/ConfigServerApplication.java - Eureka discovery
discovery-service/src/main/java/com/example/discovery/DiscoveryApplication.java - Redis
Commerce services
- Customer API
customer-service/src/main/java/com/example/customer - Product and stock
product-service/src/main - PostgreSQL
- MongoDB
Order and payment saga
- Order workflow
order-service/src/main/java/com/example/order_service/service/OrderService.java - Payment processing
payment-service/src/main/java/com/example/payment_service - Order outbox
order-service/src/main/java/com/example/order_service/outbox/OutboxRelay.java - Payment outbox
payment-service/src/main/java/com/example/payment_service/outbox/OutboxRelay.java - Payment event consumer
order-service/src/main/java/com/example/order_service/kafka/PaymentResultConsumer.java
Events and notifications
- Kafka
- RabbitMQ
- Notification service
notification-service/src/main/java/com/example/notification_service/service/NotificationService.java - Email worker
notification-service/src/main/java/com/example/notification_service/rabbitmq/EmailWorker.java - MailDev
Security and observability
- Keycloak
- Metrics and tracing
docker/prometheus/prometheus.yml
Other components
- Customer
Connections 32
- Customer → Nginx balancer: sends requests
README.md - Nginx balancer → API Gateway: balances traffic
README.md - API Gateway → Customer API: routes requests
README.md - API Gateway → Product and stock: routes requests
README.md - API Gateway → Order workflow: routes requests
README.md - Order workflow → Customer API: validates customer
README.md - Order workflow → Product and stock: purchases stock
README.md - Customer API → MongoDB: stores profiles
README.md - Product and stock → PostgreSQL: stores products
README.md - Product and stock → Redis: caches reads
README.md - Order workflow → PostgreSQL: stores orders
README.md - Payment processing → PostgreSQL: stores payments
README.md - Order workflow → Order outbox: records events
README.md - Order outbox → Kafka: publishes events
README.md - Payment processing → Kafka: consumes order events
README.md - Payment processing → Payment outbox: records results
README.md - Payment outbox → Kafka: publishes results
README.md - Kafka → Payment event consumer: delivers payment results
README.md - Payment event consumer → Order workflow: confirms or cancels
README.md - Order workflow → Product and stock: restores stock
README.md - Kafka → Notification service: delivers events
README.md - Notification service → MongoDB: stores notifications
README.md - Notification service → RabbitMQ: queues email jobs
README.md - RabbitMQ → Email worker: delivers jobs
README.md - Email worker → MailDev: sends email
README.md - Config Server → Customer API: provides configuration
README.md - Config Server → API Gateway: provides configuration
README.md - Eureka discovery → API Gateway: resolves services
README.md - API Gateway → Keycloak: validates identity
README.md - Customer API → Keycloak: secures APIs
README.md - API Gateway → Redis: limits requests
README.md - Order workflow → Metrics and tracing: exposes telemetry
README.md