# packtpublishing/ai-augmented-domain-driven-design architecture

> Architecture diagram of the GitHub repository packtpublishing/ai-augmented-domain-driven-design, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/packtpublishing/ai-augmented-domain-driven-design
- Repository: https://github.com/packtpublishing/ai-augmented-domain-driven-design

## Overview

BrewUp is the brewery-domain demo in a repository about making domain decisions explicit for AI-assisted development. Its documented business story is sales-order confirmation: Sales relies on payment authorization and warehouse availability while those contexts retain decision ownership. The source excerpts show the REST composition root and selected read/query services, but not endpoint dispatch or the full order saga, so those runtime connections are omitted. The graph preserves the major domain capabilities visible in the tree; uninspected implementation links are not asserted.

Main entry points: [`src/BrewUp.Rest/Program.cs`](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Rest/Program.cs) (REST host), [`src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs`](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs) (Sales orders), [`src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs`](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs) (Warehouse stock), [`src/BrewUp.Shared/ReadModel/IQueries.cs`](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Shared/ReadModel/IQueries.cs) (Read model contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["REST entry"]
  node_rest["REST host<br/>[Program.cs]"]
end

subgraph group_commerce["Commerce domains"]
  node_masterdata["Master data"]
  node_masterqueries["Master data queries<br/>[Services]"]
  node_purchases["Purchases"]
  node_sales["Sales orders"]
  node_salesread["Sales read model"]
end

subgraph group_fulfillment["Order fulfillment"]
  node_sagas["Order saga"]
  node_warehouse["Warehouse stock"]
  node_payment["Payment authority"]
end

subgraph group_insights["Reporting"]
  node_dashboards["Sales dashboards"]
end

subgraph group_shared["Shared contracts"]
  node_readcontracts["Read model contracts<br/>[IQueries.cs]"]
  node_ordercontracts["Order messages"]
  node_events["Domain events<br/>[Events]"]
end

node_client(("API client"))

node_client -.->|"requests"| node_rest
node_rest -->|"registers"| node_masterdata
node_rest -->|"registers"| node_purchases
node_rest -->|"registers"| node_sales
node_rest -->|"registers"| node_warehouse
node_rest -->|"registers"| node_dashboards
node_rest -->|"registers"| node_sagas
node_masterqueries -->|"queries via"| node_readcontracts
node_salesread -->|"queries via"| node_readcontracts
node_sales -->|"handles commands"| node_ordercontracts
node_salesread -->|"uses order command"| node_ordercontracts
node_warehouse -->|"queries via"| node_readcontracts
node_sales -.->|"depends on decision"| node_payment
node_sales -.->|"depends on decision"| node_warehouse

click node_rest "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Rest/Program.cs"
click node_masterdata "https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/MasterData/BrewUp.MasterData.Facade"
click node_masterqueries "https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/MasterData/BrewUp.MasterData.ReadModel/Services"
click node_purchases "https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/Purchases/BrewUp.Purchases.Facade"
click node_sales "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs"
click node_salesread "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.ReadModel/Services/SalesOrderService.cs"
click node_sagas "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sagas/BrewUp.Sagas.Domain/Orchestrators/SalesOrderSagaOrchestrator.cs"
click node_warehouse "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs"
click node_dashboards "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Dashboards/BrewUp.Dashboards.Domain/DashboardsDomainService.cs"
click node_readcontracts "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Shared/ReadModel/IQueries.cs"
click node_ordercontracts "https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.SharedKernel/Messages/Commands/CreateSalesOrder.cs"
click node_events "https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/BrewUp.Shared/Messages/Events"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rest,node_client toneBlue
class node_masterdata,node_masterqueries,node_purchases,node_sales,node_salesread toneAmber
class node_sagas,node_warehouse,node_payment toneMint
class node_dashboards toneRose
class node_readcontracts,node_ordercontracts,node_events toneIndigo
```

## Components

### REST entry

- [REST host](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Rest/Program.cs): `src/BrewUp.Rest/Program.cs`

### Commerce domains

- [Master data](https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/MasterData/BrewUp.MasterData.Facade): `src/MasterData/BrewUp.MasterData.Facade`
- [Master data queries](https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/MasterData/BrewUp.MasterData.ReadModel/Services): `src/MasterData/BrewUp.MasterData.ReadModel/Services`
- [Purchases](https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/Purchases/BrewUp.Purchases.Facade): `src/Purchases/BrewUp.Purchases.Facade`
- [Sales orders](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs): `src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs`
- [Sales read model](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.ReadModel/Services/SalesOrderService.cs): `src/Sales/BrewUp.Sales.ReadModel/Services/SalesOrderService.cs`

### Order fulfillment

- [Order saga](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sagas/BrewUp.Sagas.Domain/Orchestrators/SalesOrderSagaOrchestrator.cs): `src/Sagas/BrewUp.Sagas.Domain/Orchestrators/SalesOrderSagaOrchestrator.cs`
- [Warehouse stock](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs): `src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs`
- **Payment authority**

### Reporting

- [Sales dashboards](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Dashboards/BrewUp.Dashboards.Domain/DashboardsDomainService.cs): `src/Dashboards/BrewUp.Dashboards.Domain/DashboardsDomainService.cs`

### Shared contracts

- [Read model contracts](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/BrewUp.Shared/ReadModel/IQueries.cs): `src/BrewUp.Shared/ReadModel/IQueries.cs`
- [Order messages](https://github.com/packtpublishing/ai-augmented-domain-driven-design/blob/main/src/Sales/BrewUp.Sales.SharedKernel/Messages/Commands/CreateSalesOrder.cs): `src/Sales/BrewUp.Sales.SharedKernel/Messages/Commands/CreateSalesOrder.cs`
- [Domain events](https://github.com/packtpublishing/ai-augmented-domain-driven-design/tree/main/src/BrewUp.Shared/Messages/Events): `src/BrewUp.Shared/Messages/Events`

### Other components

- **API client**

## Connections

- API client → REST host: requests
- REST host → Master data: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- REST host → Purchases: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- REST host → Sales orders: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- REST host → Warehouse stock: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- REST host → Sales dashboards: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- REST host → Order saga: registers (evidence: `src/BrewUp.Rest/Program.cs`)
- Master data queries → Read model contracts: queries via (evidence: `src/MasterData/BrewUp.MasterData.ReadModel/Services/CustomerQueryService.cs`)
- Sales read model → Read model contracts: queries via (evidence: `src/Sales/BrewUp.Sales.ReadModel/Services/SalesOrderService.cs`)
- Sales orders → Order messages: handles commands (evidence: `src/Sales/BrewUp.Sales.Domain/SalesDomainService.cs`)
- Sales read model → Order messages: uses order command (evidence: `src/Sales/BrewUp.Sales.ReadModel/Services/SalesOrderService.cs`)
- Warehouse stock → Read model contracts: queries via (evidence: `src/Warehouse/BrewUp.Warehouse.ReadModel/Services/AvailabilityService.cs`)
- Sales orders → Payment authority: depends on decision
- Sales orders → Warehouse stock: depends on decision
