A comprehensive .NET 10 project template that follows Clean Architecture principles and Domain-Driven Design (DDD). This template helps you rapidly scaffold microservices applications with built-in support for multiple databases, message brokers, and enterprise patterns.
- ποΈ Clean Architecture - Domain, Application, Infrastructure, and Presentation layers
- π― Domain-Driven Design - Rich domain models with proper separation of concerns
- π¨ CQRS Pattern - Command Query Responsibility Segregation with MediatR
- π Message Brokers - Support for RabbitMQ, Azure Service Bus, and more
- ποΈ Multiple Databases - SQL Server, MongoDB, Redis integration
- π Observability - OpenTelemetry tracing and monitoring
- π³ Containerization - Docker and Kubernetes ready
- β‘ Background Services - Worker services for async processing
- π§ͺ Comprehensive Testing - Unit, Integration, and Acceptance tests
- Features
- Prerequisites
- Quick Start
- Template Options
- Architecture Overview
- Development Workflow
- Examples
- Troubleshooting
- Community & Support
- Contributing
- License
- .NET 10 SDK (latest version)
- IDE (choose one):
- Visual Studio 2026 (recommended)
- Visual Studio Code with C# extension
- JetBrains Rider
- Optional for development:
- Docker Desktop for containerization
- MongoDB, SQL Server
# Install the latest version
dotnet new install Genocs.CleanArchitecture.Template
# Or install a specific version
dotnet new install Genocs.CleanArchitecture.Template::5.0.0
# View all available options
dotnet new cleanarchitecture --help
# Example with custom options
dotnet new cleanarchitecture \
--name "CompanyName.ServiceName" \
--database inmemory \
--service-bus rebus \
--use-cases fullThe template generates a solution with the following structure:
src/
βββ AcceptanceTests/ # Acceptance Tests
βββ Application/ # Use cases and application services
βββ Contracts/ # API and ServiceBus contracts and commansd, events and messages
βββ Contracts.NServiceBus/ # API and ServiceBus contracts and commansd, events and messages, used by NServiceBus
βββ Domain/ # Core business logic and entities
βββ Infrastructure/ # Data access and external services
βββ IntegrationTests/ # Integration Tests
βββ UnitTests/ # Unit Tests
βββ WebApi/ # REST API controllers and middleware
βββ Worker/ # Background services and message handlers
βββ Contracts/ # API contracts and events- Domain Layer: Entities, value objects, domain services
- Application Layer: CQRS handlers, interfaces, DTOs
- Infrastructure Layer: Repositories, message brokers, databases
- Presentation Layer: Controllers, middleware, API documentation
To build the package run the following commands:
# To clone the repository
git clone https://github.com/Genocs/clean-architecture-template
cd clean-architecture-template
# To pack and install the template
dotnet pack ./src/Package.Template.csproj -p:PackageVersion=5.0.0 --configuration Release --output ./out
dotnet new install ./out/Genocs.CleanArchitecture.Template.5.0.0.nupkg
# To verify the installation and see available options
dotnet new cleanarchitecture --help
# To uninstall the template
dotnet new uninstall Genocs.CleanArchitecture.Template
# Example of creating a new project with InMemory database and Rebus as service bus
dotnet new cleanarchitecture --name {CompanyName.ServiceName} -da inmemory -sb rebusOfficial Documentation:
Useful commands:
# How to get the list of installed templates
dotnet new -u
# How to get the list of templates
dotnet new list- π¬ Discord Community
- π Documentation
- π Report Issues
- π¦ Twitter @genocs
- πΊ YouTube Channel
- πΌ LinkedIn
- β Star this repository
- π Share with your team
For more details on getting started, read the documentation
Please check the documentation for more details.
View Complete Changelogs.
This project is licensed with the MIT license.
This project exists thanks to all the people who contribute. Submit your PR and join the team!
Become a financial contributor and help me sustain the project.
Support the Project on Opencollective
| Option | Description | Values | Default |
|---|---|---|---|
--name |
Project name | {Company.Project.Service} |
Required |
--database |
Database provider | inmemory, sqlserver, mongodb |
inmemory |
--servicebus |
Message broker | particular, masstransit, rebus |
masstransit |
--use-cases |
Use case complexity | basic, full, readonly |
basic |

