CleanArch.Generator
1.0.125
dotnet tool install --global CleanArch.Generator --version 1.0.125
dotnet new tool-manifest
dotnet tool install --local CleanArch.Generator --version 1.0.125
#tool dotnet:?package=CleanArch.Generator&version=1.0.125
nuke :add-package CleanArch.Generator --version 1.0.125
๐งฑ Clean Architecture Template for .NET
This template generates a project based on Clean Architecture using .NET, with a clear separation of concerns. It simplifies development, testing, and long-term maintenance.
๐ Features
- โ
Well-structured layered architecture:
API
,Application
,Domain
,Infrastructure
- ๐ฆ Professional folder structure with logical separation of responsibilities
- ๐งช High testability and support for unit testing
- โ๏ธ Built with the latest .NET version (
net8.0
) - ๐งฐ Easily extensible and customizable for various application types (Web API, Microservices, etc.)
โ๏ธ Installation & Usage (PowerShell)
๐ฅ๏ธ All commands below should be run using PowerShell
๐ ๏ธ The generator tool is installed once globally on your machine.
1. Install the Generator Tool (one-time setup)
dotnet tool install --global CleanArch.Generator --version 1.0.118 --add-source "C:\Your\Path"
2. Create a New Project for Any .NET Version
First, create a new folder for your project and navigate into it using PowerShell:
mkdir MyNewProject
cd MyNewProject
Then generate the project using:
cleanarch-gen new --name MyNewProject --framework net8.0
๐ก If
--framework
is not specified, the latest available .NET version will be used by default.
๐๏ธ Project Structure
MyNewProject/
โโโ src/
โโโ MyNewProject.API/ # ุทุจูุฉ ุงูุนุฑุถ (Controllers + Middleware)
โ โโโ Controllers/
โ โ โโโ BaseController.cs
โ โโโ Middleware/
โ โ โโโ ExceptionMiddleware.cs
โ โโโ MyNewProject.API.csproj
โ
โโโ MyNewProject.Domain/ # ุงูููุงูุงุช ููุงุฌูุงุช ุงูุชุฌุฑูุฏ
โ โโโ Entites/
โ โ โโโ BaseEntity.cs
โ โโโ Interface/
โ โ โโโ IRepository.cs
โ โ โโโ IUnitOfWork.cs
โ โโโ MyNewProject.Domain.csproj
โ
โโโ MyNewProject.Application/ # ู
ูุทู ุงูุฃุนู
ุงูุ ุงูุฎุฏู
ุงุชุ DTOs
โ โโโ Base/
โ โ โโโ BaseService.cs
โ โโโ Interface/
โ โ โโโ IService.cs
โ โโโ Implement/
โ โ โโโ Service.cs
โ โโโ DTOs/
โ โ โโโ RequestDTO.cs
โ โ โโโ ResponseDTO.cs
โ โโโ MyNewProject.Application.csproj
โ
โโโ MyNewProject.Infrastructure/ # ุชูููุฐ ุงูู
ุณุชูุฏุนุงุชุ DbContext
โ โโโ Data/
โ โ โโโ AppDbContext.cs
โ โโโ Repository/
โ โ โโโ Repository.cs
โ โ โโโ UnitOfWork.cs
โ โโโ MyNewProject.Infrastructure.csproj
โ
โโโ MyNewProject.sln # ู
ูู ุงูุญู ุงูุฃุณุงุณู
๐งฉ Layer Explanation
Layer | Description |
---|---|
API | Handles HTTP requests (controllers and middleware) |
Domain | Defines core entities and repository/unit-of-work interfaces |
Application | Application logic (services, DTOs, and interface implementations) |
Infrastructure | Implements database access, repositories, and DbContext setup |
โถ๏ธ Run the Project
cd MyNewProject
dotnet run
Then navigate to: https://localhost:7025
๐งช Extensibility & Testing
You can add a test project (e.g., MyNewProject.Tests
) to cover business logic and infrastructure.
Recommended tools:
๐ Notes
- Suitable for teams adopting Separation of Concerns
- Fully customizable to fit your team's style or environment
- Designed with best practices for enterprise-grade software development
๐ฌ Contributing
Contributions are welcome! Whether itโs a suggestion, improvement, or bug fix โ feel free to submit a pull request.
๐ License
This project is licensed under the MIT License. You are free to use, modify, and distribute it with attribution.
๐ NuGet Package:
https://www.nuget.org/packages/CleanArch.Generator
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last Updated |
---|---|---|
1.0.125 | 165 | 5/18/2025 |
1.0.124 | 142 | 5/18/2025 |
1.0.123 | 142 | 5/18/2025 |
1.0.122 | 142 | 5/18/2025 |
1.0.121 | 162 | 5/16/2025 |
1.0.120 | 155 | 5/16/2025 |
1.0.119 | 163 | 5/16/2025 |
1.0.118 | 173 | 5/16/2025 |
1.0.117 | 162 | 5/16/2025 |
1.0.116 | 171 | 5/16/2025 |
1.0.114 | 173 | 5/16/2025 |
1.0.113 | 171 | 5/16/2025 |
1.0.112 | 171 | 5/16/2025 |
1.0.111 | 176 | 5/16/2025 |