How dushi1/microservices-ecommerce works
This is a full-stack microservices e-commerce platform. A shopper registers or signs in, browses catalog and stock availability, manages a cart, then checks out through an order saga that reserves inventory and authorizes payment; orders can be listed, tracked, or cancelled. The storefront reaches backend services through a REST gateway, while order and product services use gRPC for inventory operations. The graph preserves the documented service capabilities; notification consumption is described as unbuilt, and some service wiring is based on the README because its source was not sampled.
Main entry points: src/handlers.ts Catalog and Search · src/handlers.ts Cart and Checkout Saga · routes.ts Gateway Routing · src/handlers.ts Accounts and Tokens
Components 25
Storefront
- Storefront UI
ecommerce-micro/apps/storefront/src/App.tsx - Session Context
ecommerce-micro/apps/storefront/src/auth/AuthContext.tsx - API Client
ecommerce-micro/apps/storefront/src/api/client.ts
Edge and Identity
- Gateway Routing
ecommerce-micro/apps/api-gateway/src/routes.ts - JWT Edge Auth
ecommerce-micro/apps/api-gateway/src/auth.ts - Accounts and Tokens
ecommerce-micro/apps/auth-service/src/handlers.ts - Auth Persistence
ecommerce-micro/apps/auth-service/src/db.ts
Commerce Services
- Catalog and Search
ecommerce-micro/apps/product-service/src/handlers.ts - Catalog Cache
ecommerce-micro/apps/product-service/src/cache.ts - Catalog Persistence
ecommerce-micro/apps/product-service/src/db.ts - Cart and Checkout Saga
ecommerce-micro/apps/order-service/src/handlers.ts - Order Persistence
ecommerce-micro/apps/order-service/src/db.ts - Stock Operations
ecommerce-micro/apps/inventory-service/src/inventory-handlers.ts - Inventory Persistence
ecommerce-micro/apps/inventory-service/src/db.ts - Payment and Refunds
ecommerce-micro/apps/payment-service/src/payment-handlers.ts - Payment Persistence
ecommerce-micro/apps/payment-service/src/db.ts
Contracts and Events
- gRPC Contracts
ecommerce-micro/packages/contracts/src/grpc.ts - Kafka Publisher
ecommerce-micro/packages/events/src/index.ts
Other components
- Shopper
- Auth Database
- Product Database
- Order Database
- Inventory Database
- Payment Database
- Kafka Broker
Connections 29
- Shopper → Storefront UI: uses
- Storefront UI → Session Context: provides session
- Storefront UI → API Client: requests data
- API Client → Gateway Routing: sends REST
- Gateway Routing → JWT Edge Auth: checks protected routes
- Gateway Routing → Accounts and Tokens: proxies auth
- Gateway Routing → Catalog and Search: proxies catalog
- Gateway Routing → Cart and Checkout Saga: proxies orders
- JWT Edge Auth → Accounts and Tokens: verifies JWT
- Accounts and Tokens → Auth Persistence: queries users and tokens
- Auth Persistence → Auth Database: reads and writes
- Catalog and Search → Catalog Cache: checks and invalidates
- Catalog and Search → Catalog Persistence: queries catalog
- Catalog Persistence → Product Database: reads and writes
- Catalog and Search → Stock Operations: gets stock via gRPC
- Cart and Checkout Saga → Order Persistence: stores carts and orders
- Order Persistence → Order Database: reads and writes
- Cart and Checkout Saga → Catalog and Search: fetches product details
- Cart and Checkout Saga → Stock Operations: reserves and releases stock
- Cart and Checkout Saga → Payment and Refunds: authorizes and refunds
- Stock Operations → Inventory Persistence: persists stock state
- Inventory Persistence → Inventory Database: reads and writes
- Payment and Refunds → Payment Persistence: persists payments
- Payment Persistence → Payment Database: reads and writes
- Cart and Checkout Saga → gRPC Contracts: uses RPC clients
- Catalog and Search → gRPC Contracts: uses stock RPC
- Accounts and Tokens → Kafka Publisher: publishes user events
- Catalog and Search → Kafka Publisher: publishes product events
- Kafka Publisher → Kafka Broker: publishes events