Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.9k
Clean Architecture Solution Template for ASP.NET Core
License
jasontaylordev/CleanArchitecture
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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! ⭐
The following prerequisites are required to build and run the solution:
- .NET 9.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/Webdotnet 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 runningdotnet new ca-usecase
. Here are some examples:
To create a new command:
dotnet new ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-typecommand --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
The template supportsPostgresSQL,SQLite, andSQL Server (default option). Specify the database to use with the--database
option:
dotnet new ca-sln --database [postgresql|sqlite|sqlserver]
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/Web
--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\Web --output-dir Data\Migrations
This template is structured to follow the Azure Developer CLI (azd). You can learn more aboutazd
in theofficial documentation. To get started:
# Log in to Azureazd auth login# Provision and deploy to Azureazd up
- ASP.NET Core 9
- Entity Framework Core 9
- Angular 18 orReact 18
- MediatR
- AutoMapper
- FluentValidation
- NUnit,FluentAssertions,Moq &Respawn
The main branch is now on .NET 9.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 byraising a new issue.
This project is licensed with theMIT license.
About
Clean Architecture Solution Template for ASP.NET Core
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.