HammadMaqbool.CleanArchitecture.Template 1.0.0

dotnet new install HammadMaqbool.CleanArchitecture.Template@1.0.0
                    
This package contains a .NET Template Package you can call from the shell/command line.

Clean Architecture Web API Template

A simple and practical Clean Architecture starter template for building .NET Web APIs.

The template provides a clean separation between API, application logic, domain models, and infrastructure while intentionally avoiding unnecessary framework and architectural complexity.

Architecture

The generated solution contains four projects:

MyApplication
├── MyApplication.API
├── MyApplication.Application
├── MyApplication.Core
└── MyApplication.Infrastructure

MyApplication.API

Contains the Web API layer.

Responsibilities include:

  • Minimal API endpoints
  • HTTP request and response handling
  • Endpoint registration
  • Swagger configuration

Endpoints are organized inside the Endpoints folder and registered centrally through MapAllEndpoints.cs.

MyApplication.Application

Contains application and business logic.

Main folders:

BLL/
Interfaces/

Responsibilities include:

  • Business logic
  • Business rules
  • BLL interfaces
  • DAL interfaces
  • External service interfaces

MyApplication.Core

Contains the core models and enums used by the application.

Main folders:

Models/
Enums/

This project has no dependency on the other application projects.

MyApplication.Infrastructure

Contains implementations for infrastructure concerns.

Main folders:

DAL/
Services/

Responsibilities include:

  • Data access implementations
  • Email services
  • File/storage services
  • External API integrations
  • Other infrastructure concerns

Dependency Flow

API
 ↓
Application
 ↓
Core

Infrastructure
 ↓
Application
 ↓
Core

The API also references Infrastructure for dependency registration.

Example Feature

The template includes a small Product example demonstrating the intended structure:

ProductEndpoints
      ↓
IProductBLL
      ↓
ProductBLL
      ↓
IProductDAL
      ↓
ProductDAL

An example IEmailService / EmailService is also included to demonstrate how external or technical services should be organized.

The example uses in-memory data and is intended only to demonstrate the architecture.

Install

Install the template from NuGet:

dotnet new install HammadMaqbool.CleanArchitecture.Template

Create a Project

Create a new application:

dotnet new cleanarch -n MyProject

This generates:

MyProject/
├── MyProject.slnx
├── AGENTS.md
├── MyProject.API/
├── MyProject.Application/
├── MyProject.Core/
└── MyProject.Infrastructure/

Open MyProject.slnx in Visual Studio and run the API project.

AI Coding Agent Instructions

The generated solution includes an AGENTS.md file.

It provides architectural guidance for compatible AI coding agents and instructs them to understand and clarify requirements before implementing features.

The instructions also describe where BLL, DAL, services, models, enums, endpoints, and dependency registrations belong.

AGENTS.md is development guidance only and has no effect on application runtime.

Intentionally Not Included

The template does not automatically introduce:

  • CQRS
  • MediatR
  • AutoMapper
  • FluentValidation
  • Unit of Work
  • Result patterns

These can be added later when a project's requirements justify them.

The goal is to provide a clean starting architecture without forcing additional patterns or libraries on every application.

Requirements

  • .NET 10 SDK
  • Visual Studio 2026 or another .NET 10 compatible development environment

License

This project is licensed under the MIT License.

Source Code

Source code and development are available on GitHub:

https://github.com/HammadMaqbool/CleanArchitectureTemplate

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 44 9/27/2026

Initial release of the Clean Architecture Web API template for .NET 10.
 Includes Minimal APIs, BLL/DAL separation, centralized endpoint registration,
 Swagger, a Product reference implementation, and AGENTS.md guidance.