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 Pattern —
Result<T>for exception-free error handling - Response Wrapper —
ApiResponse<T>for standardized API responses - Typed Exceptions —
NotFoundException,ForbiddenException,BadRequestException,ConflictException
Pipeline Behaviors (MediatR)
- Logging — Automatic request/response logging with slow query warnings (>500ms)
- Validation — FluentValidation integrated into pipeline
- Caching —
ICacheableinterface 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
- Pagination —
PagedResult<T>withPaginatedQuerybase class - Audit Logging —
CreatedBy/UpdatedByauto-populated viaSaveChangesAsync
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.mdwith 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.