How belsaied/e-commercemicroservice works
This is a .NET e-commerce microservices backend. The primary flow is client traffic through Ocelot to catalog and basket APIs; basket pricing synchronously consults Discount, while checkout publishes a versioned event that Ordering consumes asynchronously and persists as an order. IdentityServer issues JWTs for protected requests. The graph preserves catalog browsing, basket management, discounts, checkout, order history, and the documented database boundaries. README descriptions support several links whose implementation was not sampled; those are shown as documented, not inferred from imports.
Main entry points: Ocelot.APIGateway/Program.cs Ocelot gateway · BasketController.cs Basket API · Handlers Order handlers · eShop.Identity/Program.cs IdentityServer
Components 22
Access and identity
- Ocelot gateway
APIGateway/Ocelot.APIGateway/Program.cs - IdentityServer
Infrastructure/eShop.Identity/Program.cs
Product catalog
- Catalog API
services/catalog/Catalog.API/Controllers/CatalogController.cs - Catalog query handlers
services/catalog/Catalog.Application/Handlers/Queries - Catalog repository
services/catalog/Catalog.Infrastructure/Repositories/ProductRepository.cs - MongoDB
Basket and discounts
- Basket API
services/Basket/Basket.API/Controllers/BasketController.cs - Basket handlers
services/Basket/Basket.Application/Handlers - Redis cart store
- Discount gRPC client
services/Basket/Basket.Application/GrpcServices/DiscountGrpcService.cs - Discount gRPC API
services/Discount/Discount.API/Services/DiscountService.cs - Discount handlers
services/Discount/Discount.Application/Handlers/Queries/GetDiscountQueryHandler.cs - Discount repository
services/Discount/Discount.Infrastructure/Repositories/DiscountRepository.cs - PostgreSQL
Checkout and orders
- Checkout consumers
services/Ordering/Ordering.API/EventBusConsumer/BasketOrderingConsumer.cs - Ordering API
services/Ordering/Ordering.API/Controllers/OrdersController.cs - Order handlers
services/Ordering/Ordering.Application/Handlers - Order repository
services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs - SQL Server
Event integration
- Checkout event contracts
Infrastructure/EventBus.Messages/Events/BasketCheckoutEvent.cs - RabbitMQ
Other components
- Client
Connections 23
- Client → Ocelot gateway: sends requests
- Ocelot gateway → Catalog API: routes catalog
- Ocelot gateway → Basket API: routes basket
- Ocelot gateway → Ordering API: routes orders
- IdentityServer → Client: issues JWTs
- Ocelot gateway → IdentityServer: enforces auth
- Catalog API → Catalog query handlers: dispatches queries
- Catalog query handlers → Catalog repository: reads products
- Catalog repository → MongoDB: reads and writes
- Basket API → Basket handlers: dispatches commands
- Basket handlers → Redis cart store: reads and writes
- Basket API → Discount gRPC client: requests pricing
- Discount gRPC client → Discount gRPC API: calls gRPC
- Discount gRPC API → Discount handlers: dispatches query
- Discount handlers → Discount repository: reads coupon
- Discount repository → PostgreSQL: reads and writes
- Basket API → Checkout event contracts: creates checkout event
- Basket API → RabbitMQ: publishes event
- RabbitMQ → Checkout consumers: delivers event
- Checkout consumers → Order handlers: dispatches checkout
- Ordering API → Order handlers: dispatches requests
- Order handlers → Order repository: reads and writes
- Order repository → SQL Server: persists orders