Skip to content

Clean Architecture

A starter template for building ASP.NET Core apps using the Clean Architecture pattern.

Stars
18.5k
Forks
3.1k
Licence
MIT
Language
C#
Last update
2 months ago
Type
Framework

What it is

This is a Visual Studio and dotnet CLI project template that gives you a pre-organized ASP.NET Core solution split into layers such as Core, Use Cases, Infrastructure and Web. It is meant as a starting point so you do not have to design that structure from scratch. The README describes it as a template for Clean Architecture, which is also called hexagonal, ports-and-adapters, or onion architecture.

  • Generate a new ASP.NET Core solution with the dotnet CLI template
  • Use the included layers as a base for a web API or web app
  • Study how the project separates domain, use cases, and infrastructure code

Great for

  • C# developers starting a new ASP.NET Core project who want a structured layout
  • Developers learning Clean Architecture or domain-driven design with a working example
  • Teams that want a shared starting structure for backend services
  • Developers who want to choose between a full and a minimal template

Not ideal for

  • Developers who are new to C# or .NET, since the template assumes familiarity with the stack
  • Projects that must use a different language or framework, since this is specific to ASP.NET Core
  • Anyone looking for a finished application rather than a starting point to build on
Step-by-step guide: how to use Clean ArchitectureInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: .NET SDK

    Clone the repository

    git clone https://github.com/ardalis/CleanArchitecture
  2. 2

    Run it

    • Install the .NET SDK
    • Install the template or clone the repository as described in the documentation
    • Create a new solution from the template using the dotnet CLI
    • Run the web project and open it in a browser, accepting the self-signed developer certificate if prompted
  3. 3

    Get the most out of it

    • Read the official documentation site for Getting Started steps and architectural decisions
    • Review the Migration Guides when upgrading from an older template version
    • Choose between Controllers, Razor Pages, or Ardalis.ApiEndpoints as described in the README
    • Explore the Domain Events section to see how events are used in the design

Downloads

Strengths

  • Widely starred and actively maintained, with recent pushes and a current .NET version
  • Offers both a full and a minimal template so you can pick the level of structure you need
  • Comes with an MIT license and documentation site with migration guides

Trade-offs

  • The README is truncated here, so detailed setup steps could not be fully verified
  • Clean Architecture adds layers that may be more structure than a small project needs
  • The README notes the main branch targets .NET 9 while the description references ASP.NET Core 10, so check which version matches your needs

How it compares

ProjectStarsTypeLevelUpdatedBest for
CleanArchitecture (this)18.5kFrameworkintermediate2 months agoC# developers starting a new ASP.NET Core project who want a structured layout
CleanArchitecture20.7kFrameworkintermediate4 days agoDevelopers starting a new ASP.NET Core web app or Web API who want a structured layout
eShopOnWeb10.7kAppintermediate1.8 years agoDevelopers learning ASP.NET Core MVC and clean architecture
modular-monolith-with-ddd14.1kLearning resourceadvanced2.4 years agoDevelopers learning Domain-Driven Design tactical patterns in C#
aspnetboilerplate12kFrameworkadvanced11 days agoC# developers already working in the ASP.NET Core ecosystem
domain-driven-hexagon15kLearning resourceintermediate2.4 years agoDevelopers who want to understand Domain-Driven Design and hexagonal architecture through examples

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.