Light Clean Architecture — part 1
These days we see many projects that are implemented with clean architecture, but if you want to implement it for the first time, it could be a little complex and it could take time.
I saw many people who have a misunderstanding about the layers and the correct location of applications elements , for example:
Where should be Service Layer?
Where Should be Dtos?
Is it necessary to use CQRS?
Where should be ApplicationDbContext?
in the other hand, creating 4 layers, build layers relation, add dependency, create abstracts classes Will take time.
In general, the way to solve this problem is to use templates, most famous and practical template in GitHub is Jason Taylor CleanArchitecture Repository, I Used it in my projects, but there was a problem for me ,I had to spent a time to delete the additions. because It was Implemented with CQRS and ASP.NET Identity, that are useless for me, I do not use those in my project.
What did I do? I created one project of my own and started to create a custom template, I removed MediatR (CQRS) and ASP.NET Identity and another dependency that I Don’t need, it only includes Clean pattern, EF, Logging, Validation, and Auto mapper.
Maybe you ask, Why I removed Identity because I used Identity Server 4 that assumed the task of managing users. like this :
In this type of project, you only need to create services in clean architecture in a simple style, token validation or getting user information could be handled by reusable code as packages.
I created this repo to reduce project time creation and create the same style for all projects, My purpose is to create a simple and light template, that you can use In SaaS, Micro Services, and monolithic applications.
How To use it?
Getting Started
The easiest way to get started is to install the .NET template:
dotnet new install Light.Clean.Architecture.Solution.Template::8.0.0
To create an ASP.NET Core Web API solution:
dotnet new lca-sln -o YourProjectName
Now if you check your project folder you will see this structure.
Nuget link: nuget.org/packages/Light.Clean.Architecture.Solution.Template
Github link: https://github.com/Sabermotamedi/LightCleanArchitecture
In a next article I will talk about other parts of this template.