How hayko588/e-commerce works
CommerceCore is a microservice-based commerce backend. The principal workflow accepts an order, checks catalog pricing and stock, then coordinates payment and order state through messaging; catalog, payment, and notification APIs also expose reads. The tree documents the services and contracts, but the README provides no capability narrative, and the saga and most consumers were not sampled. Accordingly, cross-service event links are shown as unverified rather than asserting detailed choreography.
Main entry points: OrderSaga.cs Order saga · Program.cs Gateway routing · OrdersController.cs Orders API · CreateOrder.cs Order creation
Components 27
API Gateway
- Gateway routing
src/Gateway/CommerceCore.Gateway/Program.cs
Catalog and Stock
- Product API
src/Services/CommerceCore.Catalog.Api/Controllers/ProductsControllers.cs - Internal prices API
src/Services/CommerceCore.Catalog.Api/Controllers/InternalPricesController.cs - Product reads
src/Services/CommerceCore.Catalog.Infrastructure/Persistence/ProductReadService.cs - Catalog data
src/Services/CommerceCore.Catalog.Infrastructure/Persistence/CatalogDbContext.cs - Products and stock
src/Services/CommerceCore.Catalog.Domain/Product.cs - Stock reservation
src/Services/CommerceCore.Catalog.Application/Stock/StockReservationService.cs - Stock message consumers
src/Services/CommerceCore.Catalog.Infrastructure/Messaging/ReserveStockConsumer.cs
Order Management
- Orders API
src/Services/CommerceCore.Ordering.Api/Controllers/OrdersController.cs - Order creation
src/Services/CommerceCore.Ordering.Application/Commands/CreateOrder.cs - Catalog HTTP client
src/Services/CommerceCore.Ordering.Infrastructure/Catalog/HttpProductCatalogClient.cs - Order lifecycle
src/Services/CommerceCore.Ordering.Domain/Order.cs - Order queries
src/Services/CommerceCore.Ordering.Application/DTOs/GetOrderByIdQueryHandler.cs - Order data
src/Services/CommerceCore.Ordering.Infrastructure/OrderDbContext.cs - Order saga
src/Services/CommerceCore.Ordering.Infrastructure/Messaging/OrderSaga.cs
Payments
- Charge consumer
src/Services/CommerceCore.Payments.Infrastructure/Messaging/ChargePaymentConsumer.cs - Payment processing
src/Services/CommerceCore.Payments.Application/Payments.cs - Payment gateway
src/Services/CommerceCore.Payments.Infrastructure/Gateway/SimulatedPaymentGateway.cs - Payment data
src/Services/CommerceCore.Payments.Infrastructure/Persistence/PaymentsDbContext.cs - Payment read API
src/Services/CommerceCore.Payments.Api/Controllers/PaymentsController.cs
Notifications
- Event consumers
src/Services/CommerceCore.Notifications.Infrastructure/Messaging/NotificationConsumers.cs - Notification service
src/Services/CommerceCore.Notifications.Application/Notifications.cs - Notification sender
src/Services/CommerceCore.Notifications.Infrastructure/Sending/LoggingNotificationSender.cs - Notification data
src/Services/CommerceCore.Notifications.Infrastructure/Persistence/NotificationsDbContext.cs - Notification reads
src/Services/CommerceCore.Notifications.Api/Controllers/NotificationsController.cs
Other components
- Commerce client
- Message contracts
src/BuildingBlocks/CommerceCore.Contracts/Messages.cs
Connections 27
- Commerce client → Gateway routing: sends requests
- Gateway routing → Orders API: routes requests
- Gateway routing → Product API: routes requests
- Orders API → Order creation: dispatches commands
src/Services/CommerceCore.Ordering.Api/Controllers/OrdersController.cs - Orders API → Order queries: dispatches queries
src/Services/CommerceCore.Ordering.Api/Controllers/OrdersController.cs - Order creation → Catalog HTTP client: checks catalog
- Order creation → Order lifecycle: creates orders
- Product API → Product reads: reads products
- Internal prices API → Product reads: reads prices
- Product reads → Catalog data: queries data
src/Services/CommerceCore.Catalog.Infrastructure/Persistence/ProductReadService.cs - Products and stock → Catalog data: persists entities
src/Services/CommerceCore.Catalog.Infrastructure/Persistence/CatalogDbContext.cs - Stock reservation → Products and stock: uses stock entities
src/Services/CommerceCore.Catalog.Application/Stock/StockReservationService.cs - Stock reservation → Stock message consumers: handles reservations
- Stock message consumers → Message contracts: consumes messages
- Order lifecycle → Order data: persists orders
src/Services/CommerceCore.Ordering.Infrastructure/OrderDbContext.cs - Order queries → Order data: loads orders
- Order saga → Message contracts: coordinates messages
- Order saga → Charge consumer: requests charges
- Charge consumer → Payment processing: processes charges
- Payment processing → Payment gateway: charges payment
src/Services/CommerceCore.Payments.Application/Payments.cs - Payment processing → Payment data: saves payment
src/Services/CommerceCore.Payments.Infrastructure/Persistence/PaymentsDbContext.cs - Payment read API → Payment data: reads payment
- Order saga → Event consumers: publishes events
- Event consumers → Notification service: handles events
- Notification service → Notification sender: sends notices
src/Services/CommerceCore.Notifications.Application/Notifications.cs - Notification service → Notification data: records notices
src/Services/CommerceCore.Notifications.Infrastructure/Persistence/NotificationsDbContext.cs - Notification reads → Notification data: reads notices