A production-ready, enterprise-grade .NET 9.0 Web API template built with Clean Architecture principles and comprehensive multitenancy support. This template provides a solid foundation for building scalable, maintainable web APIs with modern development practices and industry-standard patterns.
🏗️ Architecture & Design
- Clean Architecture implementation with clear separation of concerns
- Domain-Driven Design (DDD) patterns
- CQRS with MediatR for command/query separation
- Repository pattern with specifications
- Dependency injection throughout all layers
🏢 Multi-tenancy Support
- Built-in multitenancy using Finbuckle.MultiTenant
- Tenant isolation at database and application levels
- Flexible tenant resolution strategies
🔐 Authentication & Authorization
- JWT Bearer authentication
- Azure AD integration support
- Role-based and permission-based authorization
- Identity management with ASP.NET Core Identity
📊 Database & Persistence
- Entity Framework Core with PostgreSQL support
- Code-first migrations with dedicated migrator projects
- Database seeding and initialization
- Audit trails and soft delete functionality
🔧 Background Processing
- Hangfire integration for background jobs
- Job scheduling and monitoring dashboard
- Persistent job storage with PostgreSQL
📚 API Documentation
- Swagger/OpenAPI documentation with NSwag
- Comprehensive API versioning
- Interactive API explorer
🧪 Testing & Quality
- Unit test infrastructure setup
- Code style enforcement with StyleCop
- EditorConfig for consistent formatting
- GitHub Actions CI/CD pipeline
⚡ Performance & Scalability
- Redis caching support
- SignalR for real-time communication
- Health checks implementation
- Docker containerization ready
📧 Additional Features
- Email services with MailKit
- Excel export functionality with ClosedXML
- Comprehensive logging with Serilog
- Localization support
- .NET 9.0 SDK
- PostgreSQL 15+
- Docker (optional)
- Clone the repository
- Copy configuration templates from
Host.Configurations.Templates
toHost.Configurations
- Update database connection strings in
database.json
andhangfire.json
- Run migrations:
dotnet ef database update
- Start the application:
dotnet run
or use Docker:docker compose up
{
"email": "[email protected]",
"password": "123Pa$$word!"
}
├── src/
│ ├── Core/
│ │ ├── Application/ # Application layer (CQRS, DTOs, Services)
│ │ ├── Domain/ # Domain entities and business logic
│ │ └── Shared/ # Shared contracts and utilities
│ ├── Infrastructure/ # Infrastructure concerns (EF, Auth, etc.)
│ ├── Host/ # Web API host and controllers
│ └── Migrators/ # Database migration projects
├── tests/ # Test projects
└── docker-compose.yml # Docker configuration
- .NET 8.0 - Latest LTS framework
- ASP.NET Core - Web API framework
- Entity Framework Core - ORM and data access
- PostgreSQL - Primary database
- Redis - Caching and session storage
- Hangfire - Background job processing
- MediatR - CQRS implementation
- Mapster - Object mapping
- FluentValidation - Input validation
- Serilog - Structured logging
- JWT - Authentication tokens
- Swagger/NSwag - API documentation
The template includes sample CRUD operations for:
- Identity Management - Users, roles, and permissions
- Product Catalog - Products and brands with full CRUD
- Tenant Management - Multi-tenant operations
Full Docker support with:
- Multi-stage Dockerfile for optimized builds
- Docker Compose with PostgreSQL and Redis services
- Environment-based configuration
- Health checks and logging
GitHub Actions workflow included for:
- Automated testing
- Code quality checks
- Docker image building
- Deployment automation
This project is licensed under the MIT License - see the LICENSE file for details.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.