Clean Architecture
A domain-centric approach to organizing dependencies

Clean Architecture Rules
- Model all business rules and entities in the Core project
- All dependencies flow toward the Core project
- Inner projects define interfaces; outer projects implement them
What belongs in the Core project
- Interfaces
- Aggregates
- Entities
- Value Objects
- Domain Services
- Domain Exceptions
- Domain Events
- Event Handlers
- Specifications
- Validators
- Enums
- Custom Guards
What belongs in the Infrastructure project
- Repositories
- DbContext classes
- Cached Repositories
- API Clients
- File System Accessors
- Azure Storage Accessors
- Emailing Implementations
- SMS Implementations
- System Clock
What belongs in the Web project
- API Endpoints
- Razor Pages
- Controllers
- Views
- API Models
- ViewModels
- Filters
- Model Binders
- Tag Helpers
The Shared Kernel
What about sharing code between applications?
Domain-Driven Design term
Holds common types shared between DDD apps
Typically reference by Core projects
Ideally distributed as NuGet Packages
- Base entity
- Base value object
- Base domain event
- Base specification
- Common interfaces
- Common exceptions
- Common auth
- Common guards
- Common libraries