How dotnet-architecture/eshopondapr works
Main Components
• Frontend:
• Blazor web application (found under “src/Web/BlazorClient.Host” and “src/Web/BlazorClient”): This serves as the client interface.
• API Gateways and Aggregators:
• API gateway implemented via Envoy (located under “src/ApiGateways/Envoy”): Acts as a reverse proxy routing incoming external requests.
• Aggregator microservice for more complex workflows (located under “src/ApiGateways/Aggregators”): Consolidates data across multiple backend services.
• Core Microservices (each focusing on a distinct business capability):
• Basket Service (src/Services/Basket) – Manages shopping baskets.
• Catalog Service (src/Services/Catalog) – Manages product catalogs.
• Identity Service (src/Services/Identity) – Handles authentication and identity management.
• Ordering Service (src/Services/Ordering) – Manages order placement and processing.
• Payment Service (src/Services/Payment) – Handles payment transactions.
• Building Blocks and Cross-Cutting Concerns:
• Event Bus (in src/BuildingBlocks/EventBus): Implements asynchronous messaging (pub/sub) using Dapr’s supported messaging backends.
• Health Checks (in src/BuildingBlocks/Healthchecks): Monitors the health of Dapr sidecars and microservices.
• Infrastructural and Deployment Components:
• Dapr components (in the “dapr” folder): YAML definitions for pubsub, state store, secrets etc.
• Deployment scripts for Container Apps and Kubernetes (found in the “deploy” folder, including Bicep and Helm charts) which provide additional context on the environment.
Understanding Relationships and Interactions
• The Blazor frontend communicates with the API gateway (via Envoy) for both simple CRUD operations and more complex aggregated workflows.
• The API gateway directs requests to either:
• Directly interact with one of the core services (e.g., catalog service) or
• Route to the aggregator service which handles multi-step operations (by invoking one or more backend services).
• Core services (e.g., Basket, Catalog, Ordering, Payment) are built as independent microservices that communicate through direct synchronous calls (for simple tasks) and asynchronous events via the event bus. Dapr is used to facilitate this messaging and also provides side-car features like service invocation and state management.
• Dapr sidecars (configured via the dapr folder) are attached to each microservice instance, enabling them to abstract common patterns like pub/sub messaging.
• The infrastructure components (container apps, Kubernetes deployments) are configured using Bicep and Helm charts, ensuring that the deployment mirrors the microservices architecture and Dapr configuration.
Architectural Patterns and Design Principles
• Microservices decomposition: Each core service is self-contained and caters to a distinct business domain.
• API Gateway pattern: A gateway (via Envoy and aggregator microservice) abstracts the backend complexity from clients.
• Event-driven architecture: Asynchronous communication is supported using an event bus enabled by Dapr.
• Container-based deployment: Dockerfiles, container-app templates, and Kubernetes/Helm charts indicate a heavy reliance on containerization for deployment and scalability.
• Sidecar pattern: Usage of Dapr enables cross-cutting concerns without tightly coupling them into each service.
Instructing the Principal Software Engineer
• Clusters or grouping to indicate related functionalities (e.g., group all the identity, catalog, ordering, basket, and payment services together as core services).