Choosing a Template

This repository publishes two templates. They share the same principles (dependencies point inward toward the domain, infrastructure sits behind abstractions, and business logic is testable without the web or the database) but package them differently.

  1. Clean Architecture (clean-arch): a multi-project solution with separate Core, UseCases, Infrastructure, and Web projects, plus unit, integration, and functional test projects.
  2. Minimal Clean Architecture (min-clean): a single Web project organized into vertical slices (features), with namespace boundaries checked at build time.
dotnet new install Ardalis.CleanArchitecture.Template   # clean-arch
dotnet new install Ardalis.MinimalClean.Template        # min-clean

Comparison

Clean ArchitectureMinimal Clean Architecture
Commanddotnet new clean-archdotnet new min-clean
NuGet packageArdalis.CleanArchitecture.TemplateArdalis.MinimalClean.Template
Package versioning12.x targets .NET 11 (see Versions)Same version as the full template since 12.0.0 (1.x targeted .NET 10)
Application projectsCore, UseCases, Infrastructure, WebWeb
Aspire projectsAspireHost, ServiceDefaultsAspireHost, ServiceDefaults
Test projectsUnitTests, IntegrationTests, FunctionalTests, AspireTests (placeholder)None
OrganizationBy layer (horizontal)By feature (vertical slices)
Boundary enforcementProject references (the compiler)Namespace rules via the NsDepCop analyzer (build errors); see Enforcing Dependency Rules
DDD patternsAggregates, strongly typed IDs, value objects, smart enums, domain events, domain services, specificationsAggregates, strongly typed IDs, value objects, specifications; domain events optional
Use cases / CQRSCommands and queries with Mediator handlers in a separate UseCases projectMediator commands and queries colocated with endpoints in each feature folder; optional
Data accessRepository + specifications; query services for readsRepository + specifications where helpful; query services for reads
DatabaseSQL Server (Aspire container or LocalDB on Windows) with SQLite fallbackSQL Server (Aspire container or LocalDB)
Example domainContributorsProducts, carts, guest users, orders
ComplexityHigher: more projects and abstractionsLower: one project to navigate
Best forLarge or long-lived apps, multiple teams, complex domainsMVPs, smaller apps, rapid iteration
Growth pathCan be simplified to minimalCan grow into the full template

Which template should I use?

Choose Clean Architecture (clean-arch) if:

  • You’re building a large or complex application that will be maintained for years
  • Multiple teams or developers need strict, compiler-enforced boundaries
  • The domain is complex enough to benefit from the full set of DDD patterns
  • You want a ready-made test suite structure (unit, integration, functional)

Choose Minimal Clean Architecture (min-clean) if:

  • You’re building an MVP or a smaller application
  • You want architectural guidance without multi-project overhead
  • You prefer vertical slice (feature-folder) organization
  • Your team values simplicity and fast iteration
  • You might grow into the full template later

Not sure? Start with Minimal Clean and move to the full Clean Architecture template if your application grows in complexity. Minimal Clean Architecture describes how to make that move, and the reverse.

What both templates include

  • ASP.NET Core API using FastEndpoints and the REPR pattern, with FluentValidation request validators
  • OpenAPI documents with Scalar and Swagger UI in Development
  • EF Core with migrations, a generic EfRepository<T>, and Ardalis.Specification
  • Mediator (a source-generated mediator) for commands, queries, domain events, and pipeline behaviors such as logging
  • Vogen strongly typed IDs and value objects
  • Ardalis.Result for returning success, not-found, and validation outcomes without exceptions, and Ardalis.GuardClauses
  • Serilog logging and OpenTelemetry via the Aspire service defaults
  • .NET Aspire host that runs SQL Server and a Papercut SMTP server in containers
  • Central Package Management (Directory.Packages.props), nullable reference types, and warnings treated as errors