Ardalis Clean Architecture

Ardalis.CleanArchitecture.Template on NuGet Ardalis.MinimalClean.Template on NuGet GitHub stars

A starting point for Clean Architecture with ASP.NET Core. Clean Architecture is just the latest in a series of names for the same loosely-coupled, dependency-inverted architecture. You will also find it named hexagonal, ports-and-adapters, or onion architecture.

This repository ships two dotnet new templates that give you a working, tested, well-factored ASP.NET Core API to build on, with a little real code in place (instead of an empty Class1.cs) so you can see where things belong.

Two templates

Clean ArchitectureMinimal Clean Architecture
Short nameclean-archmin-clean
NuGet packageArdalis.CleanArchitecture.TemplateArdalis.MinimalClean.Template
ShapeMulti-project solution: Core, UseCases, Infrastructure, WebOne Web project organized into vertical slices
Organized byLayer (horizontal)Feature (vertical)
Boundaries enforced byProject referencesNamespace rules (NsDepCop)
Tests includedUnit, integration, functionalNone (add your own)
Best forLarger, long-lived apps and teams that want strict boundariesMVPs, smaller apps, and teams that want guidance without ceremony

Both templates include FastEndpoints (REPR), EF Core, the Mediator source generator, Ardalis.Specification, Serilog, and an optional .NET Aspire host. See Choosing a Template for a detailed comparison.

Quick start

# Install (once)
dotnet new install Ardalis.CleanArchitecture.Template
dotnet new install Ardalis.MinimalClean.Template

# Create a solution
dotnet new clean-arch -o Your.ProjectName
# ...or the minimal version
dotnet new min-clean -o Your.ProjectName

Then follow Getting Started to build and run it.

Template versions are not .NET versions. For example, template v11.x targets .NET 10 and template v12.x targets .NET 11. See Versions for the full mapping before you upgrade or follow a migration guide.

Where to go next

Learn more

Learn about Clean Architecture and this template in the NimblePros Learn Clean Architecture course, taught by Sarah “sadukie” Dutkiewicz and Steve “ardalis” Smith. Use code ARDALIS to save 20%.

This architecture is used in the DDD Fundamentals course by Steve Smith and Julie Lerman.

Contact Steve’s company, NimblePros, for Clean Architecture or DDD training and/or implementation assistance for your team.

Give a star

If you like or are using this project to learn or start your solution, please give it a star on GitHub. Thanks!

Or if you’re feeling really generous, the project accepts GitHub sponsorships.

Sponsors

Amazon AWS’s FOSS fund has awarded a 12-month sponsorship to this project. Thank you, and thanks to all past and current sponsors!