A production-ready ASP.NET Core Web API template built using Clean Architecture, CQRS, MediatR, Entity Framework Core, FluentValidation, and SQL Server.
This template is designed to demonstrate how medium and large applications can be structured for maintainability, testability, and long-term growth while keeping the codebase easy to understand.
ASP.NET Core Clean Architecture with .NET 10 | Build Scalable & Maintainable Applications
git clone ...
dotnet restore
dotnet ef database update --project Infrastructure --startup-project Api
dotnet run
Open Swagger
- Clean Architecture
- CQRS with MediatR
- Entity Framework Core
- SQL Server
- FluentValidation
- AutoMapper
- Dependency Injection
- Repository Pattern
- Domain Events
- Global Exception Handling
- Unit Tests
- Integration Tests
- Swagger/OpenAPI
Most Clean Architecture examples show folder structures but spend very little time explaining why those boundaries exist.
This project focuses on both implementation and reasoning.
Every architectural decision is documented so you understand:
- why the decision was made
- when it is appropriate
- when it becomes unnecessary complexity
- how to extend the project safely
The goal is not to create the most complicated architecture possible.
The goal is to provide a production-quality starting point that can grow with your application.
This project is intended for developers who:
- already know basic ASP.NET Core
- have built CRUD APIs
- want to learn production architecture
- want a reusable starting point for new projects
This template is probably not the right choice if you're building:
- a prototype
- a small internal application
- a weekend project
- a simple CRUD API with only a few endpoints
In those cases, a traditional N-tier architecture is usually simpler and easier to maintain.
Dependencies always point inward.
The Domain layer never depends on any other project.
graph TD
Api --> Application
Api --> Infrastructure
Infrastructure --> Application
Infrastructure --> Domain
Application --> Domain
CleanArchitecture/
│
├── Api
│ ├── Controllers
│ ├── Middleware
│ ├── Program.cs
│ └── appsettings.json
│
├── Application
│ ├── Commands
│ ├── Queries
│ ├── Validators
│ ├── DTOs
│ └── Behaviors
│
├── Domain
│ ├── Entities
│ ├── Enums
│ ├── Events
│ ├── Exceptions
│ ├── Interfaces
│ ├── ValueObjects
│ └── Common
│
├── Infrastructure
│ ├── Persistence
│ ├── Migrations
│ └── DependencyInjection.cs
│
├── Tests.Unit
│
└── Tests.Integration
- ASP.NET Core
- C#
- SQL Server
- Entity Framework Core
- MediatR
- FluentValidation
- AutoMapper
- xUnit
- Swagger
- .NET 10 SDK
- SQL Server 2022+ or
- Postgresql
- Visual Studio 2022 17.14+
- Git
git clone <repository>Edit
appsettings.json
dotnet ef database updatedotnet run --project src/ApiSwagger
https://localhost:5001/swagger
``
---
# License
CleanArchitecture License
Read License for this.