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 and event-driven workflows via
Genocs.Common.CQRS - 🚌 Message Brokers - Azure Service Bus, MassTransit, NServiceBus, and Rebus options
- 🗃️ Multiple Databases - MongoDB, EF Core (SQL Server), and InMemory options
- 🔍 Telemetry and Logging - Built-in telemetry/logging integration with monitoring stack assets
- 🐳 Containerization - Docker and Kubernetes ready
- ☁️ Infrastructure as Code - Bicep, Terraform, Helm, and Kubernetes manifests included
- ⚡ Background Services - Worker services for async processing
- 🧪 Comprehensive Testing - Unit, Integration, and Acceptance tests
- 📘 API Versioning and OpenAPI - Versioned endpoints and OpenAPI support out of the box
- Features
- Prerequisites
- Quick Start
- Template Options
- Architecture Overview
- Development Workflow
- Troubleshooting
- Community & Support
- Contributing
- License
- .NET 10 SDK
- IDE (choose one):
- Visual Studio with .NET 10 support
- Visual Studio Code with C# tooling
- JetBrains Rider
- Optional for local infrastructure (depends on selected template options):
- Docker Desktop
- MongoDB for
--database mongodb - SQL Server for
--database sqlserver(default) - RabbitMQ for
--service-bus masstransit|rebus|nservicebus - Azure Service Bus namespace for
--service-bus azureservicebus
# Install the latest version
dotnet new install Genocs.CleanArchitecture.Template
# Or install a specific version
dotnet new install Genocs.CleanArchitecture.Template::5.1.0
# View all available options
dotnet new gnx-cleanarchitecture --help
# Create a project using template defaults
dotnet new gnx-cleanarchitecture --name "CompanyName.ServiceName"
# Create a project with explicit options
dotnet new gnx-cleanarchitecture \
--name "CompanyName.ServiceName" \
--database inmemory \
--service-bus nservicebus \
--use-cases basicThe template generates a solution with the following structure:
src/
├── AcceptanceTests/ # Acceptance Tests
├── Application/ # Use cases and application services
├── Contracts/ # API and message contracts (commands, events, messages)
├── Contracts.NServiceBus/ # Included when --service-bus nservicebus is selected
├── 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
└── ...- 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.1.0 --configuration Release --output ./out
dotnet new install ./out/Genocs.CleanArchitecture.Template.5.1.0.nupkg
# To verify the installation and see available options
dotnet new gnx-cleanarchitecture --help
# To uninstall the template
dotnet new uninstall Genocs.CleanArchitecture.Template
# Example of creating a new project with InMemory database and Masstransit as service bus
dotnet new gnx-cleanarchitecture --name CompanyName.ServiceName --database inmemory --service-bus masstransitOfficial Documentation:
Useful commands:
# How to get the list of installed templates
dotnet new -u
# How to get the list of templates
dotnet new list- ⭐ Star this repository
- 🔄 Share with your team
For more details on getting started, read the documentation
Please check the documentation for more details.
Contributions are welcome. See CONTRIBUTING.md for guidelines and development workflow.
View complete Changelog.
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 | mongodb, sqlserver, inmemory |
sqlserver |
--service-bus |
Message broker | azureservicebus, masstransit, nservicebus, rebus |
rebus |
--use-cases |
Use case complexity | full, basic, readonly |
full |

