File: README.md
Clean Architecture Solution Template
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 new app with Angular, React, or Web API only, powered by ASP.NET Core and Aspire. Getting started is easy - simply install the .NET template (see below for full details).
For full documentation, visit cleanarchitecture.jasontaylor.dev.
If you find this project useful, please give it a star. Thanks! โญ
Getting started
Prerequisites
- .NET 10.0 SDK or later
- Node.js (LTS) โ only required if you plan to use the Angular or React frontend
- Docker Desktop or Podman (or any OCI-compliant container runtime) โ only required when using SQL Server or PostgreSQL. Not required when using SQLite (the default).
Install the template
dotnet new install Clean.Architecture.Solution.TemplateCreate a new solution
Create a new solution using the template. Specify the client framework using --client-framework (-cf) and the database provider using --database (-db):
dotnet new ca-sln --client-framework [angular|react|none] --database [postgresql|sqlite|sqlserver] --output YourProjectName| Option | Values | Default |
|---|---|---|
--client-framework |
angular, react, none |
angular |
--database |
postgresql, sqlite, sqlserver |
sqlite |
Examples:
๐ ฐ๏ธ Angular SPA with ASP.NET Core Web API and PostgreSQL:
dotnet new ca-sln -cf angular -db postgresql -o YourProjectNameโ๏ธ React SPA with ASP.NET Core Web API and SQL Server:
dotnet new ca-sln -cf react -db sqlserver -o YourProjectName๐ ASP.NET Core Web API only with SQLite:
dotnet new ca-sln -cf none -db sqlite -o YourProjectName๐ก Tip: Run
dotnet new ca-sln --helpto see all available template options.
Run the app
dotnet run --project .\src\AppHostThe Aspire dashboard will open automatically, showing the application URLs and logs.
To learn more, see the Getting started guide and Architecture overview.
Technologies
- ASP.NET Core 10
- Aspire
- Entity Framework Core 10
- Angular 21 or React 19
- MediatR
- AutoMapper
- FluentValidation
- NUnit, Shouldly, Moq & Respawn
- Scalar
Versions
The main branch is on .NET 10.0. Previous versions are available:
| Version | Branch |
|---|---|
| .NET 9.0 | net9.0 |
| .NET 8.0 | net8.0 |
| .NET 7.0 | net7.0 |
| .NET 6.0 | net6.0 |
| .NET 5.0 | net5.0 |
| .NET Core 3.1 | netcore3.1 |
Architectural decisions
Key design decisions are documented as Architecture Decision Records.
Learn more
Support
If you are having problems, please let me know by raising a new issue.
License
This project is licensed under the MIT License.
File: src/Web/ClientApp/README.md
CleanArchitecture.Web
This project was generated with Angular CLI version 21.1.5.
Development server
Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.
Code scaffolding
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
Build
Run ng build to build the project. The build artifacts will be stored in the dist/ directory.
Running unit tests
Run ng test to execute the unit tests via Karma.
Running end-to-end tests
Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
Further help
To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.
File: src/Web/ClientApp-React/README.md
CleanArchitecture React Client
This project uses Vite with React 19 and TypeScript.
Available Scripts
`npm start`
Runs the app in development mode with hot module replacement.
Opens at https://localhost:44447.
The development server proxies API requests to the ASP.NET Core backend.
`npm run build`
Builds the app for production to the build folder.
Optimizes the build for best performance.
`npm run preview`
Previews the production build locally.
`npm run lint`
Runs ESLint on the src directory.
Project Structure
src/- React source codesrc/main.jsx- Application entry pointsrc/App.js- Root componentsrc/components/- React componentspublic/- Static assets (favicon, manifest)vite.config.ts- Vite configuration with proxy settingsindex.html- HTML template
Environment Variables
Vite environment variables must be prefixed with VITE_ to be exposed to client code.
Example:
VITE_API_URL=https://api.example.comAccess in code:
const apiUrl = import.meta.env.VITE_API_URL;HTTPS Configuration
The development server uses ASP.NET Core development certificates for HTTPS.
Run npm start to automatically set up certificates via aspnetcore-https.js.
Learn More
File: README-template.md
CleanArchitecture
The project was generated using the Clean.Architecture.Solution.Template version caPackageVersion.
Build
Run dotnet build to build the solution.
Run
To run the application:
dotnet run --project .\src\AppHostThe Aspire dashboard will open automatically, showing the application URLs and logs.
Code Styles & Formatting
The template includes EditorConfig support to help maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The .editorconfig file defines the coding styles applicable to this solution.
Code Scaffolding
The template includes support to scaffold new commands and queries.
Start in the .\src\Application\ folder.
Create a new command:
dotnet new ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type intCreate a new query:
dotnet new ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVmIf you encounter the error "No templates or subcommands found matching: 'ca-usecase'.", install the template and try again:
dotnet new install Clean.Architecture.Solution.Template::caPackageVersionTest
The solution contains unit, integration, and functional tests.
To run the tests:
dotnet testArchitectural Decisions
Key design decisions are documented as Architecture Decision Records.
Help
To learn more about the template go to the project website. Here you can find additional guidance, request new features, report a bug, and discuss the template with other users.