How josehelioaraujo/eshop works
Purpose and startup
eShop “AdventureWorks” is a .NET 9 reference e-commerce system built as independently runnable services, background processors, and multiple client experiences. The primary local entry point is the .NET Aspire orchestrator at src/eShop.AppHost/Program.cs; run it to provision service dependencies and expose the Aspire dashboard. Service executables use their own Program.cs, notably src/Catalog.API/Program.cs, src/Ordering.API/Program.cs, and src/WebApp/Program.cs.
Client and edge experiences
The main storefront is a Blazor web application with catalog, cart, checkout, account, and order-status UI. It maintains browser/session-facing basket state and calls backend services through its service layer.
• src/WebApp/Components/Pages/Checkout/Checkout.razor
• src/WebApp/Services/BasketService.cs
• src/WebApp/Services/OrderingService.cs
Two MAUI clients are included: a full native/XAML client with MVVM services and a Blazor Hybrid catalog client. They are alternative consumers rather than required server-side components.
• src/ClientApp/MauiProgram.cs
• src/ClientApp/ViewModels/CheckoutViewModel.cs
• src/HybridApp/MauiProgram.cs
Identity and service boundaries
Identity.API is the authentication/authorization authority; its account, consent, device, and profile surfaces support interactive client sign-in and downstream service identity propagation. Shared service-default extensions centralize cross-cutting service configuration, including authentication and HTTP client behavior.
• src/Identity.API/Program.cs
• src/Identity.API/Configuration/Config.cs
• src/eShop.ServiceDefaults/AuthenticationExtensions.cs
Catalog and basket
Catalog owns products, brands, types, inventory-related event handling, sample seeding, and catalog persistence. Its minimal API layer is separated from EF Core context/entity configuration and integration-event publication. Basket owns per-customer basket persistence in Redis and exposes a gRPC contract; clients and ordering consume basket-shaped models rather than its storage implementation.
• src/Catalog.API/Apis/CatalogApi.cs
• src/Catalog.API/Infrastructure/CatalogContext.cs
• src/Basket.API/Grpc/BasketService.cs
• src/Basket.API/Repositories/RedisBasketRepository.cs
Ordering workflow and persistence
Ordering is the core transactional domain. API commands enter an application layer with validation, logging, transaction, and idempotency behaviors; handlers update Order and Buyer aggregates through EF Core repositories. Query models are separated from command/domain processing. Order-state transitions emit domain and integration events.
• src/Ordering.API/Apis/OrdersApi.cs
• src/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs
• src/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs
• src/Ordering.Infrastructure/OrderingContext.cs
Asynchronous fulfillment pipeline
RabbitMQ-backed integration events decouple order, catalog, payment, basket, web UI notifications, and webhooks. Catalog validates/reserves stock in reaction to ordering events; payment and grace-period processors advance or reject the order lifecycle; ordering consumes their outcomes. EF-backed integration-event logs/outbox migrations support reliable publication alongside service database changes.
• src/EventBusRabbitMQ/RabbitMQEventBus.cs
• src/Ordering.API/Application/IntegrationEvents/OrderingIntegrationEventService.cs
• src/PaymentProcessor/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs
• src/OrderProcessor/Services/GracePeriodManagerService.cs
• src/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
Webhooks, AI, and infrastructure
The webhooks service stores subscriptions and forwards selected catalog/order events to external callback URLs; WebhookClient is a separate UI/receiver for registering and viewing them. Catalog optionally uses Azure OpenAI, enabled through the AppHost connection configuration. Local execution requires Docker and Aspire-managed infrastructure; deployment is designed for Azure Developer CLI.
• src/Webhooks.API/Apis/WebHooksApi.cs
• src/Webhooks.API/Services/WebhooksSender.cs
• src/WebhookClient/Endpoints/WebhookEndpoints.cs
• src/Catalog.API/Services/CatalogAI.cs
Main entry points: RabbitMQEventBus.cs RabbitMQ event bus · CatalogApi.cs Catalog API · OrdersApi.cs Orders API · Program.cs Aspire AppHost
Components 25
Hosting
- Aspire AppHost · Provisions local dependencies and service topology.
src/eShop.AppHost/Program.cs - Service defaults · Centralizes service authentication and HTTP behavior.
src/eShop.ServiceDefaults/AuthenticationExtensions.cs
Client experiences
- Blazor storefront · Storefront for catalog, cart, checkout, accounts, and order status.
src/WebApp/Components/Pages/Checkout/Checkout.razor - Basket service layer
src/WebApp/Services/BasketService.cs - Ordering service layer
src/WebApp/Services/OrderingService.cs - MAUI client · Alternative native/XAML consumer.
src/ClientApp/MauiProgram.cs - Blazor Hybrid client · Alternative catalog consumer.
src/HybridApp/MauiProgram.cs
Core services
- Identity API · Interactive sign-in and downstream identity authority.
src/Identity.API/Program.cs - Catalog API · Owns product catalog and inventory event handling.
src/Catalog.API/Apis/CatalogApi.cs - Catalog context
src/Catalog.API/Infrastructure/CatalogContext.cs - Catalog AI · Optional Azure OpenAI-backed catalog capability.
src/Catalog.API/Services/CatalogAI.cs - Basket API · Exposes per-customer basket contracts.
src/Basket.API/Grpc/BasketService.cs - Redis basket store
src/Basket.API/Repositories/RedisBasketRepository.cs
Ordering workflow
- Orders API · Accepts order commands and serves order operations.
src/Ordering.API/Apis/OrdersApi.cs - Create order handler · Runs transactional, validated, idempotent order creation.
src/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs - Order aggregate · Encapsulates order lifecycle transitions.
src/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs - Ordering context · Stores ordering aggregates and query data.
src/Ordering.Infrastructure/OrderingContext.cs
Async processors
- RabbitMQ event bus · Decouples services through integration events.
src/EventBusRabbitMQ/RabbitMQEventBus.cs - Ordering event service · Publishes ordering integration events reliably.
src/Ordering.API/Application/IntegrationEvents/OrderingIntegrationEventService.cs - Payment processor · Advances or rejects orders after stock confirmation.
src/PaymentProcessor/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs - Grace period processor · Manages timed order lifecycle transitions.
src/OrderProcessor/Services/GracePeriodManagerService.cs - Integration event log · Persists publish state alongside database changes.
src/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
Integration delivery
- Webhooks API · Stores subscriptions and selects events for delivery.
src/Webhooks.API/Apis/WebHooksApi.cs - Webhook sender · Forwards selected events to external URLs.
src/Webhooks.API/Services/WebhooksSender.cs - Webhook client · Registers and views webhook subscriptions.
src/WebhookClient/Endpoints/WebhookEndpoints.cs
Connections 31
- Aspire AppHost → Identity API: runs
- Aspire AppHost → Catalog API: runs
- Aspire AppHost → Orders API: runs
- Aspire AppHost → RabbitMQ event bus: provisions
- Service defaults → Identity API: auth configuration
- Blazor storefront → Basket service layer: uses
- Blazor storefront → Ordering service layer: uses
- Blazor storefront → Identity API: signs in
- Basket service layer → Basket API: gRPC
- Ordering service layer → Orders API: order requests
- MAUI client → Identity API: authenticates
- MAUI client → Orders API: orders
- Blazor Hybrid client → Catalog API: catalog requests
- Catalog API → Catalog context: persists catalog
- Catalog API → Catalog AI: optional AI
- Basket API → Redis basket store: persists baskets
- Orders API → Create order handler: dispatches command
- Create order handler → Order aggregate: updates
- Order aggregate → Ordering context: persisted by
- Create order handler → Ordering event service: emits events
- Ordering event service → Integration event log: records publication
- Ordering event service → RabbitMQ event bus: publishes
- RabbitMQ event bus → Catalog API: stock events
- RabbitMQ event bus → Payment processor: stock confirmed
- RabbitMQ event bus → Grace period processor: order events
- Payment processor → RabbitMQ event bus: payment outcome
- Grace period processor → RabbitMQ event bus: lifecycle outcome
- RabbitMQ event bus → Orders API: consumes outcomes
- Webhook client → Webhooks API: manages subscriptions
- RabbitMQ event bus → Webhooks API: selected events
- Webhooks API → Webhook sender: delivers callbacks