The purpose of this template is to offer a simple and effective solution for building enterprise applications by harnessing the capabilities of Clean Architecture and ASP.NET Core. With this template, you can easily set up a Web API following Clean Architecture and Domain Drive Design principles. Starting is quick and easy-just install the .NET template (detailed instructions provided below).
The following prerequisites are required to build and run the solution:
- .NET 8.0 SDK (latest version)
The easiest way to get started is to install the .NET template:
dotnet new install Clean.Architecture.Solution.Template::8.0.1
Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the -cf
or --client-framework
option, and provide the output directory where your project will be created. Here are some examples:
To create a ASP.NET Core Web API solution:
dotnet new fast-ca-sln -o YourProjectName
Launch the app:
cd src/API
dotnet run
To learn more, run the following command:
dotnet new fast-ca-sln --help
You can create use cases (commands or queries) by navigating to ./src/Application
and running dotnet new fast-ca-usecase
. Here are some examples:
To create a new command:
dotnet new fast-ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int
To create a query:
dotnet new fast-ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm
To learn more, run the following command:
dotnet new fast-ca-usecase --help
The template is configured to use SQL Server by default. If you would prefer to use SQLite, create your solution using the following command:
dotnet new fast-ca-sln --use-oracle
When you run the application the database will be automatically created (if necessary) and the latest migrations will be applied.
Running database migrations is easy. Ensure you add the following flags to your command (values assume you are executing from repository root)
--project src/Infrastructure
(optional if in this folder)--startup-project src/API
--output-dir Data/Migrations
For example, to add a new migration from the root folder:
dotnet ef migrations add "SampleMigration" --project src\Infrastructure --startup-project src\API --output-dir Data\Migrations
The template includes a full CI/CD pipeline. The pipeline is responsible for building, testing, publishing and deploying the solution to Azure.
- ASP.NET Core 8
- Entity Framework Core 8
- MediatR
- Maspter
- FluentResult
- FluentValidation
- NUnit, FluentAssertions, NetArchTest.Rules, TestContainer & Moq
The main branch is now on .NET 8.0.
If you are having problems, please let me know by create a new issue.
This project is licensed with the MIT license.