Code Monkey home page Code Monkey logo

cleanarchitecture's Introduction

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 easiest way to get started is to install the .NET template:

dotnet new install Clean.Architecture.Solution.Template::8.0.5

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 is configured to use SQL Server by default. If you would prefer to use SQLite, create your solution using the following command:

dotnet new ca-sln --use-sqlite

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

Deploy

The template includes a full CI/CD pipeline. The pipeline is responsible for building, testing, publishing and deploying the solution to Azure. If you would like to learn more, read the deployment instructions.

Technologies

Versions

The main branch is now on .NET 8.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.

cleanarchitecture's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.