A modern, production-ready .NET Clean Architecture boilerplate built with ASP.NET Core, following Clean Architecture, Domain-Driven Design (DDD), and SOLID principles.
DotNetCleanArchitecture provides a clean, scalable, and maintainable foundation for building enterprise-grade .NET applications, RESTful Web APIs, and cloud-ready systems.
- Learn More
- Overview
- Key Features
- Architecture
- Technology Stack
- Use Cases
- Getting Started
- Resources & Documentation
- Testing Strategy
- Clean Architecture Principles
- When to Use This Template
- Keywords & Topics
- Contributing
- License
- Support
Overall: Clean Architecture in .NET Overall
Realworld Example: Clean Architecture in .NET: A Practical Guide with Real-World Product Example
Building scalable .NET applications requires a strong architectural foundation. DotNetCleanArchitecture helps developers implement Clean Architecture in .NET from the start, reducing technical debt and improving long-term maintainability.
This repository is designed for developers who want:
- A real-world ASP.NET Core Clean Architecture example
- Clear separation of concerns
- Highly testable and extensible code
- Enterprise-ready project structure
- ✅ Clean Architecture implementation for .NET
- ✅ ASP.NET Core Web API with Swagger/OpenAPI
- ✅ Domain-Driven Design (DDD) with real Product entity example
- ✅ SOLID principles applied throughout
- ✅ CQRS pattern (Commands & Queries)
- ✅ Repository and Unit of Work patterns
- ✅ Clear separation of concerns
- ✅ High testability and maintainability
- ✅ Infrastructure-independent business logic
- ✅ Comprehensive documentation and blog posts
- ✅ Production-ready test infrastructure
- ✅ Open-source and extensible
📖 Read the full Clean Architecture guide →
This project follows Uncle Bob’s Clean Architecture, ensuring that core business rules are independent of frameworks, databases, and external services.
src/
├── DotNetCleanArchitecture.Domain
│ ├── Entities
│ ├── ValueObjects
│ └── DomainEvents
│
├── DotNetCleanArchitecture.Application
│ ├── UseCases
│ ├── Interfaces
│ ├── DTOs
│ └── BusinessLogic
│
├── DotNetCleanArchitecture.Infrastructure
│ ├── Persistence
│ ├── ExternalServices
│ └── Implementations
│
└── DotNetCleanArchitecture.WebAPI
├── Controllers
├── Middleware
└── Configuration
WebAPI → Application → Domain
Infrastructure → Application
The Domain layer has no dependencies on any other layer.
- .NET (Latest LTS)
- ASP.NET Core
- Clean Architecture
- Domain-Driven Design (DDD)
- SOLID Principles
- RESTful APIs
- Dependency Injection
- Entity Framework Core (optional)
- CQRS pattern (optional)
This .NET Clean Architecture boilerplate is suitable for:
- Enterprise applications
- SaaS platforms
- Microservices
- Cloud-native systems
- RESTful Web APIs
- Long-term maintainable systems
- .NET SDK (latest LTS recommended)
- Visual Studio, Rider, or VS Code
git clone https://github.com/LinhNC/DotNetCleanArchitecture.git
cd DotNetCleanArchitecturedotnet restore
dotnet builddotnet run --project src/DotNetCleanArchitecture.WebAPIThe API will be available at:
https://localhost:5001
📝 Clean Architecture in .NET: A Practical Guide with Real-World Product Example
- Complete explanation of Clean Architecture principles
- Step-by-step implementation guide
- Real Product entity example with code
- Architecture diagrams and best practices
- When to use Clean Architecture vs alternatives
The architecture promotes high testability by design.
You can easily implement:
- Unit tests for Domain and Application layers
- Integration tests for Infrastructure
- API tests for the WebAPI layer
- Independence of frameworks
- Business logic isolation
- Testable core logic
- Dependency Inversion Principle
- Single Responsibility Principle
- Separation of concerns
Use DotNetCleanArchitecture if you want to:
- Implement Clean Architecture in .NET correctly
- Build maintainable ASP.NET Core Web APIs
- Start projects with best practices
- Reduce technical debt
- Create scalable enterprise solutions
Primary Keywords:
- dotnet clean architecture
- asp.net core clean architecture
- clean architecture boilerplate .net
- .net clean architecture example
- clean architecture template asp.net core
Related Topics:
- domain driven design asp.net core
- cqrs pattern .net
- repository pattern entity framework
- unit of work pattern c#
- solid principles .net
- enterprise architecture .net core
- microservices clean architecture
- onion architecture .net
- hexagonal architecture asp.net
Learn More: Clean Architecture in .NET: A Practical Guide with Real-World Product Example
Contributions are welcome and encouraged.
You can contribute by:
- Reporting issues
- Submitting pull requests
- Improving documentation
- Suggesting architectural enhancements
This project is licensed under the MIT License. You are free to use, modify, and distribute this software for personal or commercial purposes.
If this project helps you:
- ⭐ Star the repository
- 🔁 Share it with the community
- 💬 Provide feedback or suggestions
dotnet · aspnet-core · clean-architecture · ddd · solid-principles · web-api · boilerplate