A Clean Architecture solution template for .NET projects.
This template includes all key layers to help you start building scalable applications faster:
API, Application, Domain, Infrastructure, and Persistence.
git clone https://github.com/mberrishdev/Net.Template.git mb.template
cd mb.templateRegister the template with the .NET CLI:
dotnet new install .After this, the template will appear in the list:
dotnet new listYou’ll see something like:
Template Name Short Name Language Tags
------------------------------------------------------- -------------- -------- --------------------
MB.Template - Celan Architexture for .NET mbtemplate [C#] webAPI/Solution/CleanArchitecture
Use the short name nettemplate to generate a new solution:
dotnet new mbtemplate -n YourProjectName -o YourProjectName
cd YourProjectName
rm -rf .gitThis will create a clean architecture solution with your specified name.
dotnet restore
dotnet build
dotnet run --project src/YourProjectName.ApiTo remove the template from your system:
dotnet new uninstall /full/path/to/mb.templateTo find installed template paths, run:
dotnet new --debug:reinitsrc/
├── YourProjectName.Api --> Entry point (Web API)
├── YourProjectName.Application --> Business logic (Use Cases, Interfaces)
├── YourProjectName.Domain --> Core domain models and rules
├── YourProjectName.Infrastructure--> Cross-cutting concerns
└── YourProjectName.Persistence --> EF Core and data access layerThis template uses symbol replacement. You can customize the solution name by passing --SolutionName:
dotnet new nettemplate -n MyApp -o MyApp --SolutionName "MyApp"
Mikheil Berishvili