F.CleanArchitecture.Template 1.3.1

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

Clean Architecture Solution Template

A dotnet new template that scaffolds a full Clean Architecture solution with Domain, Application, Infrastructure, WebAPI and Tests layers.

Quick Start

# Install the template
dotnet new install F.CleanArchitecture.Template

# Create a new project
dotnet new cleanarch -n MyProject

# Build & run
cd MyProject
dotnet build
dotnet run --project src/MyProject.WebAPI

# Run tests
dotnet test

Project Structure

MyProject/
├── MyProject.sln
├── CLAUDE.md                        # AI assistant rules & conventions
├── .claude/commands/                # Slash commands (/new-feature, /add-entity, /add-endpoint)
└── src/
    ├── MyProject.Domain/            # Entities, Enums, Interfaces, Common types
    ├── MyProject.Application/       # Use cases, DTOs, Behaviors, MediatR handlers
    ├── MyProject.Infrastructure/    # EF Core, Identity, External services
    ├── MyProject.WebAPI/            # Controllers, Filters, Middleware, Program.cs
    └── MyProject.Tests/             # xUnit + Moq + FluentAssertions

Features

Architecture & Patterns

  • Clean Architecture — 4 layer separation (Domain, Application, Infrastructure, WebAPI)
  • CQRS — Command/Query separation with MediatR
  • Repository + Unit of Work — Generic data access abstraction
  • Result PatternResult<T> for exception-free error handling
  • Response WrapperApiResponse<T> for standardized API responses
  • Typed ExceptionsNotFoundException, ForbiddenException, BadRequestException, ConflictException

Pipeline Behaviors (MediatR)

  • Logging — Automatic request/response logging with slow query warnings (>500ms)
  • Validation — FluentValidation integrated into pipeline
  • CachingICacheable interface for automatic in-memory caching

API Features

  • Scalar UI — Interactive API documentation (/scalar/v1)
  • Rate Limiting — Fixed window (100 req/min)
  • Health Checks — PostgreSQL connectivity (/health)
  • Global Validation Filter — Automatic ModelState validation
  • PaginationPagedResult<T> with PaginatedQuery base class
  • Audit LoggingCreatedBy/UpdatedBy auto-populated via SaveChangesAsync

Authentication

  • JWT Bearer token authentication
  • Google OAuth integration
  • Apple Sign-In integration
  • Refresh token support

Testing

  • xUnit test framework
  • Moq for mocking
  • FluentAssertions for readable assertions
  • Validator, Behavior, and Common type tests included (34 tests)

AI Integration

  • CLAUDE.md with project rules and conventions
  • .claude/commands/ with slash commands for scaffolding

Tech Stack

Package Purpose
MediatR CQRS & command/query dispatching
FluentValidation Request validation via pipeline behavior
AutoMapper Object mapping
EF Core + Identity Data access & authentication
PostgreSQL (Npgsql) Database
JWT Bearer Token-based authentication
Scalar.AspNetCore API documentation UI
xUnit + Moq + FluentAssertions Unit testing

License

MIT

  • net10.0

    • 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.3.1 244 3/8/2026
1.3.0 234 3/8/2026
1.2.2 233 3/8/2026
1.2.1 224 3/8/2026
1.2.0 228 3/8/2026
1.1.0 228 3/8/2026
1.0.2 233 3/8/2026
1.0.1 228 3/8/2026
1.0.0 237 3/8/2026