Genocs.CleanArchitecture.Template
5.0.0
dotnet new install Genocs.CleanArchitecture.Template::5.0.0
Genocs Clean Architecture Template
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.
โจ Features
- ๐๏ธ 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
๐ Table of Contents
- Features
- Prerequisites
- Quick Start
- Template Options
- Architecture Overview
- Development Workflow
- Examples
- Troubleshooting
- Community & Support
- Contributing
- License
๐ Prerequisites
- .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
๐ Quick Start
Install the Template
# 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 full
๐๏ธ Architecture Overview
The 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
Key Components
- 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
How to build and install the template locally
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 rebus
Official Documentation:
Miscellaneous
Useful commands:
# How to get the list of installed templates
dotnet new -u
# How to get the list of templates
dotnet new list
๐ง Development Workflow
Local Development
# Start infrastructure services
docker-compose -f ./infrastructure/docker/docker-compose-infrastructure.yml up -d
# Run the API
dotnet run --project src/WebApi/Host.csproj
# Run the Worker
dotnet run --project src/Worker/Host.csproj
# Run all tests
dotnet test
# Run specific test projects
dotnet test src/UnitTests
dotnet test src/IntegrationTests
dotnet test src/AcceptanceTests
# Stop infrastructure services
docker-compose -f ./infrastructure/docker/docker-compose-infrastructure.yml down
# Build Docker WebApi image
docker build -t genocs/clean-architecture-template -f ./src/WebApi/Dockerfile .
# Run Docker WebApi container
docker run -d -p 8080:80 --name clean-architecture-template genocs/clean-architecture-template
# Stop and remove Docker WebApi container
docker stop clean-architecture-template
docker rm clean-architecture-template
๐ฌ Community & Support
Get Help
- ๐ฌ Discord Community
- ๐ Documentation
- ๐ Report Issues
Stay Connected
- ๐ฆ Twitter @genocs
- ๐บ YouTube Channel
- ๐ผ LinkedIn
Show Your Support
- โญ Star this repository
- ๐ Share with your team
๐ง Troubleshooting
Common Issues
For more details on getting started, read the documentation
Please check the documentation for more details.
Changelogs
View Complete Changelogs.
License
This project is licensed with the MIT license.
Community
Financial Contributors
Become a financial contributor and help me sustain the project.
Support the Project on Opencollective
<a href="https://opencollective.com/genocs"><img src="https://opencollective.com/genocs/individuals.svg?width=890"></a>
Acknowledgements
โ๏ธ Template Options
| 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 |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release notes:
- Release 5.0.0:
- Updated to .NET 10
- Improved Docker support
- Added new templates for CQRS and Event Sourcing

