01. Slices: every task has its place
Orders go in Orders, payments in Billing. The layer is the role of the code, the slice is the product task. The agent finds the part it needs and changes it within set boundaries.
This adapts ideas from Feature-Sliced Design to .NET: split by meaning, isolated slices and an explicit public API. The layers here are Clean Architecture ones, with the rule “a layer is an assembly”.
| Layer / role | Orders / ordering | Billing / payment |
|---|---|---|
| Api · HTTP entry | Api/Orders/Endpoints/ | Api/Billing/Endpoints/ |
| Application · use cases | Application/Orders/Placement/ | Application/Billing/Invoicing/ |
| Domain · business rules | Domain/Orders/ | Domain/Billing/ |
| Infrastructure · adapters | Infrastructure/Orders/Postgres/ | Infrastructure/Billing/Payments/ |
.csproj. Host composes the application; Consumers is the entry for queues. Slices sit directly in the layer, without an intermediate Features/.The usual entry into a slice
Outside code uses the declared API of the use case. The internals of Placement/ can change without touching every consumer.
A link to a neighbouring slice
Billing opens an API for Orders explicitly. A plain Contracts/ does not allow importing a neighbour on the same layer; it takes X/Orders, the counterpart of @x in FSD.
Layer directions and a few more rules
| From | May use |
|---|---|
| Host | All the others — it composes the application |
| Api, Consumers | Application, Domain |
| Infrastructure | Application, Domain |
| Application | Domain |
| Domain | No other layer |
- Every Application slice needs an entry in Api or Consumers. Domain slices are open to the upper layers regardless of the consuming slice's name.
- Directories inside a slice are named by purpose:
Placement,Pricing.HelpersandUtilsdo not explain a purpose. - The shared reserved places are
Domain/SharedandInfrastructure/Persistence. Application wiring lives in Host. - A layer with code has one assembly. Pulling other layers in through
Compile Includeis not allowed;ProjectReferencefollows the same table. - A standalone library marks the architecture as not applicable, with a reason.