CleanArch.Generator 1.0.125

dotnet tool install --global CleanArch.Generator --version 1.0.125
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local CleanArch.Generator --version 1.0.125
                    
This package contains a .NET tool you can call from the shell/command line.
#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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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