Services and Responsibilities

Services Table

ServiceOwns (data)Main APIsPublishesConsumes
product-serviceProduct, CategoryGET /api/products, GET /api/products/{id}, admin CRUDProductUpdated—
user-serviceUser, AddressGET /api/users/me, addressesUserRegistered—
cart-serviceCartItem (Redis)GET/POST/DELETE /api/cart—ProductUpdated (price changes)
order-serviceOrder, OrderItem, saga_instance, outboxPOST /api/orders, GET /api/orders/{id}OrderCreated, OrderConfirmed, OrderCancelled, commandsStockReserved/Rejected, PaymentCompleted/Declined
inventory-serviceStock, Reservationinternal onlyStockReserved, StockRejected, StockReleasedReserveStock, ReleaseStock
payment-servicePayment, Refund, idempotency_recordPOST /api/payments/webhook (Razorpay)PaymentCompleted, PaymentDeclined, RefundedChargePayment, RefundPayment
notification-serviceNotification loginternal only—OrderConfirmed, OrderCancelled, Refunded

Note: Product.stock from the shared ShopEase model now lives in inventory-service as the source of truth; product-service only shows an "in stock" flag updated from inventory events.

Kafka Topics

TopicKeyProducerConsumersPartitions
order-eventsorderIdorder-service (outbox)notification, analytics, order-query12
inventory-commandsorderIdorder-service (saga)inventory-service12
inventory-eventsorderIdinventory-service (outbox)order-service (saga)12
payment-commandsorderIdorder-service (saga)payment-service12
payment-eventsorderIdpayment-service (outbox)order-service, notification12
*.DLTsameerror handlerson-call engineers / replay tool1

Repository Layout

shopease/                          (monorepo)
├── api-gateway/
├── web-bff/   mobile-bff/
├── product-service/   user-service/   cart-service/
├── order-service/
│   ├── src/main/java/com/shopease/order/
│   │   ├── api/           OrderController, DTOs
│   │   ├── domain/        Order, OrderItem, OrderStatus
│   │   ├── saga/          OrderSagaOrchestrator, OrderSaga, replies
│   │   ├── outbox/        OutboxEvent, OutboxRelay
│   │   └── client/        ProductClient (RestClient + Resilience4j)
│   ├── src/main/resources/db/migration/   V1__orders.sql, V2__outbox.sql
│   └── Dockerfile
├── inventory-service/   payment-service/   notification-service/
├── k8s/                     Kustomize base + overlays (staging, prod)
├── docker-compose.yml       local development
└── .github/workflows/       one workflow per service