The goal of this template is to provide a straightforward and efficient approach to enterprise application development, leveraging the power of Clean Architecture and ASP.NET Core. Using this template, you can effortlessly create a Single Page App (SPA) with ASP.NET Core and Angular or React, while adhering to the principles of Clean Architecture. Getting started is easy - simply install the .NET template (see below for full details).
- ASP.NET Core 8
- Entity Framework Core 8
- Angular 15 or React 18
- MediatR
- AutoMapper
- FluentValidation
- NUnit, FluentAssertions, Moq & Respawn
The easiest way to get started is to install the .NET template and run dotnet new ca-sln
:
- Install the latest versions of .NET 8 SDK and Node.js LTS
- Run
dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.5.1
to install the .NET template - Run
dotnet new ca-sln -c <Angular|React> --output <YourProjectName>
to create a new project - Navigate to
YourProjectName/src/WebUI
and launch the project usingdotnet run
The template is configured to use an in-memory database by default. This ensures that all users will be able to run the solution without needing to set up additional infrastructure (e.g. SQL Server).
If you would like to use SQL Server, you will need to update WebUI/appsettings.json as follows:
"UseInMemoryDatabase": false,
Verify that the DefaultConnection connection string within appsettings.json points to a valid SQL Server instance.
When you run the application the database will be automatically created (if necessary) and the latest migrations will be applied.
To use dotnet-ef
for your migrations first ensure that "UseInMemoryDatabase" is disabled, as described within previous section.
Then, 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/WebUI
--output-dir Persistence/Migrations
For example, to add a new migration from the root folder:
dotnet ef migrations add "SampleMigration" --project src\Infrastructure --startup-project src\WebUI --output-dir Persistence\Migrations
The main branch is now on .NET 8.0. The following previous versions are available:
- Clean Architecture with ASP.NET Core 3.0 (GOTO 2019)
- Clean Architecture with .NET Core: Getting Started
If you are having problems, please let me know by raising a new issue.
This project is licensed with the MIT license.