Clean.Architecture.Solution.Template 10.2.0

dotnet new install Clean.Architecture.Solution.Template::10.2.0
                    
This package contains a .NET Template Package you can call from the shell/command line.

Clean Architecture Solution Template

Build CodeQL Nuget Nuget Twitter Follow

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).

If you find this project useful, please give it a star. Thanks! ⭐

Getting Started

The following prerequisites are required to build and run the solution:

  • .NET 10.0 SDK (latest version)
  • Node.js (latest LTS, only required if you are using Angular or React)

The easiest way to get started is to install the .NET template:

dotnet new install Clean.Architecture.Solution.Template

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 Single-Page Application (SPA) with Angular and ASP.NET Core:

dotnet new ca-sln --client-framework Angular --output YourProjectName

To create a SPA with React and ASP.NET Core:

dotnet new ca-sln -cf React -o YourProjectName

To create a ASP.NET Core Web API-only solution:

dotnet new ca-sln -cf None -o YourProjectName

Launch the app:

cd src/Web
dotnet run

To learn more, run the following command:

dotnet new ca-sln --help

You can create use cases (commands or queries) by navigating to ./src/Application and running dotnet new ca-usecase. Here are some examples:

To create a new command:

dotnet new ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int

To create a query:

dotnet new ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm

To learn more, run the following command:

dotnet new ca-usecase --help

Database

The template supports PostgreSQL, SQLite, and SQL Server (default option). Specify the database to use with the --database option:

dotnet new ca-sln --database [postgresql|sqlite|sqlserver]

On application startup, the database is automatically deleted, recreated, and seeded using ApplicationDbContextInitialiser. This is a practical strategy for early development, avoiding the overhead of maintaining migrations while keeping the schema and sample data in sync with the domain model.

This process includes:

  • Deleting the existing database
  • Recreating the schema from the current model
  • Seeding default roles, users, and data

For production environments, consider using EF Core migrations or migration bundles during deployment.
For more information, see Database Initialisation Strategies for EF Core.

Deploy

This template is structured to follow the Azure Developer CLI (azd). You can learn more about azd in the official documentation. To get started:

# Log in to Azure
azd auth login

# Provision and deploy to Azure
azd up

To set up a CI/CD pipeline (GitHub Actions or Azure DevOps):

azd pipeline config

API Documentation

This template includes built-in API documentation using ASP.NET Core OpenAPI and Scalar. Once the application is running, navigate to /scalar to explore the API using the Scalar UI.

The OpenAPI specification is generated at build time and written to wwwroot/openapi/v1.json.

Technologies

Versions

The main branch is now on .NET 10.0. The following previous versions are available:

Learn More

Support

If you are having problems, please let me know by raising a new issue.

License

This project is licensed with the MIT license.

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.

Version Downloads Last Updated
10.2.0 0 3/1/2026
10.1.0 43 2/28/2026
10.0.0 4,453 11/11/2025
9.0.12 3,933 7/28/2025
9.0.11 1,025 7/22/2025
9.0.10 2,723 5/23/2025
9.0.9 506 5/21/2025
9.0.8 7,354 12/6/2024
9.0.7 361 12/6/2024
9.0.6 540 12/2/2024
9.0.5 485 11/30/2024
9.0.4 442 11/29/2024
9.0.3 371 11/29/2024
9.0.2 379 11/28/2024
9.0.1 1,019 11/18/2024
9.0.0 707 11/15/2024
9.0.0-preview.6.1 876 9/5/2024
9.0.0-preview.6 393 9/1/2024
8.0.6 5,838 8/31/2024
8.0.5 10,164 3/7/2024
Loading failed

## What's Changed
* chore(deps): update actions/upload-artifact action to v7 by @renovate[bot] in https://github.com/jasontaylordev/CleanArchitecture/pull/1509
* fix: update nuspec to exclude release.yml instead of package.yml by @jasontaylordev in https://github.com/jasontaylordev/CleanArchitecture/pull/1510
* feat: replace NSwag with ASP.NET Core OpenAPI and Scalar by @jasontaylordev in https://github.com/jasontaylordev/CleanArchitecture/pull/1511

### feat: replace NSwag with ASP.NET Core OpenAPI and Scalar

This release replaces NSwag's runtime API introspection with the built-in [ASP.NET Core OpenAPI](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/overview) support and [Scalar](https://scalar.com/) as the API explorer UI.

**What changed:**
- Added `Microsoft.AspNetCore.OpenApi` and `Scalar.AspNetCore`; removed NSwag middleware registration
- The OpenAPI specification is now generated to wwwroot/openapi/v1.json
- The Scalar UI is available at /scalar in all environments
- TypeScript API clients (`web-api-client.ts`) are now auto-generated via a `prebuild` npm script in both the Angular and React clients, and are excluded from source control
- ASP.NET Core Identity endpoints appear in the Scalar UI but without rich metadata such as descriptions, tags, or response schemas; explicit annotation is required to improve their documentation

**Full Changelog**: https://github.com/jasontaylordev/CleanArchitecture/compare/v10.1.0...v10.2.0