Clean Architecture .NET 9 Web API Starter — CQRS, MediatR, JWT, Redis, RabbitMQ
$8
https://schema.org/InStock
usd
Elite Solutions
Ship enterprise-grade APIs fast—without reinventing the stack.
This .NET 9 Clean Architecture starter organizes your code into Domain / Application / Infrastructure / WebApi with CQRS + MediatR, JWT auth, Redis cache, RabbitMQ, Hangfire, and Polly baked in. It’s a battle-tested foundation that lets you focus on business features, not plumbing.
Why teams choose this template
- Clean Architecture → strict boundaries keep code maintainable at scale.
- CQRS + MediatR → predictable flows, easy testing, and vertical slice features.
- Architecture tests → prevent drift across entities, value objects, and handlers.
- FluentValidation → robust command/query validation.
- Security → JWT auth/authorization scaffolding and HTTPS patterns.
- Resilience → Polly policies for retries/timeouts/circuit breakers.
- Performance → Redis distributed cache (with in-memory fallback).
- Messaging → RabbitMQ integration (plus in-memory bus for dev).
- Background jobs → Hangfire dashboard & recurring jobs.
- Rate limiting → protect your API and control costs.
- EF Core (code-first) → migrations-ready data access.
- DevEx → Swagger/OpenAPI, structured logging, Docker, and compose.
Built-in Features (✅ implemented)
- Clean Architecture layers (Domain / Application / Infrastructure / WebApi)
- CQRS with MediatR
- Unit & architecture tests (xUnit, FluentAssertions, Moq)
- FluentValidation
- SMTP email integration
- JWT authentication & authorization
- Unit of Work + generic repositories + Specification pattern
- Custom middleware (error handling & rate limiting)
- EF Core code-first
- Polly resilience for HTTP clients
- Redis cache (fallback to memory)
- RabbitMQ messaging (fallback in-memory)
- Hangfire background jobs
- Dockerfile & docker-compose
- Structured logging (console)
Project Structure
CleanArchitectureApi/
├── src/
│ ├── Domain/
│ │ ├── Common/
│ │ ├── Entities/
│ │ ├── Events/
│ │ ├── Specifications/
│ │ └── ValueObjects/
│ ├── Application/
│ │ ├── Behaviors/
│ │ ├── DTOs/
│ │ ├── Features/
│ │ ├── Interfaces/
│ │ └── Mappings/
│ ├── Infrastructure/
│ │ ├── Data/
│ │ ├── Repositories/
│ │ └── Services/
│ └── WebApi/
│ ├── Controllers/
│ ├── Middleware/
│ └── Program.cs
├── tests/
│ ├── UnitTests/
│ └── IntegrationTests/
├── docker-compose.yml
├── Dockerfile
└── README.mdWho it’s for
- .NET developers & teams shipping features quickly with guardrails
- Solution architects enforcing standards across services
- Agencies/contractors starting client projects on a solid base
FAQ
Is it production-ready?
Yes—boundaries, validation, resilience, logging, rate limiting, Docker, tests. Add your cloud TLS, secrets, and observability and deploy.
Can I swap infrastructure pieces?
Absolutely. Redis/RabbitMQ are optional; in-memory fallbacks ease local dev.
How do I add a feature?
Create a vertical slice under Application/Features with command/query, handler, validators, tests, and minimal changes to controllers.
Does it include integration tests?
Yes—samples plus guidance to add more.
License?
MIT—commercial use allowed.
44 sales
Production-ready template with architecture tests, FluentValidation, Hangfire jobs, rate limiting, Docker, and resilient HTTP via Polly.
Size
14.8 MB
Add to wishlist
Ratings
(1 rating)
1
5
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%