explaingit

ardalis/cleanarchitecture

📈 Trending18,190C#Audience · developerComplexity · 3/5ActiveLicenseSetup · moderate

TLDR

A starter template for building ASP.NET Core web apps using Clean Architecture, which separates business logic from databases and UI for easier testing and maintenance.

Mindmap

mindmap
  root((repo))
    What it does
      Organizes code layers
      Separates business logic
      Enables easy testing
    Architecture patterns
      Clean Architecture
      Domain-Driven Design
      Hexagonal architecture
    Project structure
      Core layer
      Use Cases layer
      Infrastructure layer
      Web layer
    Tech stack
      ASP.NET Core
      .NET 9
      NuGet packages
    Use cases
      Build maintainable apps
      Isolate business rules
      Swap databases easily

Things people build with this

USE CASE 1

Build a new ASP.NET Core web application with a proven, layered architecture from day one.

USE CASE 2

Swap out your database or external service without rewriting business logic.

USE CASE 3

Write unit tests that focus on domain rules without mocking the entire infrastructure.

USE CASE 4

Organize a team project so different developers can work on layers independently.

Tech stack

C#ASP.NET Core.NET 9NuGet

Getting it running

Difficulty · moderate Time to first run · 30min

.NET 9 SDK must be installed; template scaffolding and initial build takes time.

Use freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

CleanArchitecture is a starter template for building web applications with ASP.NET Core (Microsoft's open-source web framework for .NET) following the Clean Architecture pattern. Clean Architecture is a way of organizing software so that the core business logic sits at the center, independent of databases, user interfaces, or external services, this makes it easier to test, maintain, and change individual parts without breaking others. The same approach goes by other names like hexagonal architecture, ports-and-adapters, and onion architecture. The template structures a project into distinct layers: a Core project holding domain entities and business rules, a Use Cases project for application-specific logic, an Infrastructure project for database access and external integrations, and a Web project for the user-facing API or web interface. It incorporates patterns such as domain events (notifications when something important happens inside the domain), and follows Domain-Driven Design (DDD) principles for organizing complex business logic. The template is installable as a .NET CLI tool via NuGet, the package manager for .NET, and comes in two variants: a full version and a minimal version. It targets .NET 9. The main branch corresponds to NuGet package version 10.x. It is created by Steve Smith (known online as "ardalis") and is open source.

Copy-paste prompts

Prompt 1
Show me how to install the Clean Architecture template via NuGet and create a new project with it.
Prompt 2
Explain the difference between the Core, Use Cases, Infrastructure, and Web layers in this template.
Prompt 3
How do I add a new domain entity and business rule to the Core layer following this template?
Prompt 4
Walk me through how domain events work in this Clean Architecture template and when to use them.
Prompt 5
What's the minimal version of this template, and when should I use it instead of the full version?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.