Skip to content

Looking clean architecture, added signalR chart.

License

Notifications You must be signed in to change notification settings

Magniveo/MagniveoAngular

Repository files navigation

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

Technologies

Dependencies

The template depends on the latest versions of:

Getting Started

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

dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.5.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 SPA with Angular:

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

To create a Web API-only solution:

dotnet new ca-sln -cf None -o YourProjectName

The above commands will create a Single-Page Application (SPA) with Angular or React on top of ASP.NET Core, or a Web API-only solution.

Start the application by navigating to ./src/WebUI (SPA) or ./src/WebApi and running:

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

For user PostgreSql, you will need to update WebUI/appsettings.json as follows:

  "UseInMemoryDatabase": false,
  "DefaultConnection": "Server=127.0.0.1;Port=5432;Database=yourDB;User Id=postgres;Password=password;"

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.

Database Migrations

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

Versions

The main branch is now on .NET 8.0.

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.

About

Looking clean architecture, added signalR chart.

Resources

Code of conduct

Stars

Watchers

Forks