CleanArchitecture.Blazor.Solution.Template
1.1.0
dotnet new install CleanArchitecture.Blazor.Solution.Template::1.1.0
Clean Architecture Blazor Server
A comprehensive Blazor Server application template built with Clean Architecture principles, featuring advanced code generation, AI-powered development support, and enterprise-grade functionality.
π― Overview
This project is a production-ready Blazor Server application template that demonstrates Clean Architecture implementation with .NET 9. It provides a solid foundation for building scalable, maintainable enterprise applications with modern development practices and AI-enhanced productivity features.
Key Features
- ποΈ Clean Architecture: Strict layer separation with dependency inversion
- π€ AI-Powered Development: Integrated Cursor/Copilot support with comprehensive rules
- π¨ Modern UI: Beautiful, responsive interface built with MudBlazor
- β‘ Real-time Communication: SignalR integration for live updates
- π Enterprise Security: Multi-factor authentication, role-based access control
- π Multi-tenancy: Built-in tenant isolation and management
- π Advanced Data Grid: Sorting, filtering, pagination, and export capabilities
- π¨ Code Generation: Visual Studio extension for rapid development
- π³ Docker Ready: Complete containerization support
- π± Progressive Web App: PWA capabilities for mobile experience
π Live Showcase
Experience the application in action:
Live Demo: architecture.blazorserver.com
Featured Projects Built with This Template
HSE Management System - GitHub | Live Demo
EU Digital Product Passport - Live Demo
π οΈ Technology Stack
Layer | Technologies |
---|---|
Frontend | Blazor Server, MudBlazor, SignalR |
Backend | .NET 9, ASP.NET Core, MediatR, FluentValidation |
Database | Entity Framework Core, MSSQL/PostgreSQL/SQLite |
Authentication | ASP.NET Core Identity, OAuth 2.0, JWT |
Caching | FusionCache, Redis |
Background Jobs | Hangfire |
Testing | xUnit, FluentAssertions, Moq |
DevOps | Docker, GitHub Actions |
ποΈ Architecture Overview
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Server.UI β β Application β β Domain β
β (Blazor) βββββΆβ (Business) βββββΆβ (Entities) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β
β βββββββββββββββββββ
βββββββββββββββΆβ Infrastructure β
β (Data/IO) β
βββββββββββββββββββ
Layer Responsibilities
- Domain: Core business entities and rules (no dependencies)
- Application: Business logic, interfaces, and DTOs
- Infrastructure: External concerns (database, email, file system)
- Server.UI: Blazor components and user interface
π€ AI-Powered Development
This project is optimized for AI-assisted development with comprehensive support for modern AI coding tools.
π― Cursor AI Integration
The project includes extensive Cursor Rules that provide:
- Architecture Guidelines: Enforce Clean Architecture principles
- Coding Standards: Consistent patterns and best practices
- Component Templates: Pre-configured Blazor component structures
- Security Patterns: Built-in security implementation guides
π Development Workflow
Enhanced productivity through AI-powered development:
- Intelligent Code Generation: Context-aware suggestions following project patterns
- Automatic Layer Compliance: AI ensures proper dependency flow
- Pattern Recognition: Consistent implementation across features
- Smart Refactoring: Architecture-aware code improvements
π‘ Getting Started with AI Development
- Install Cursor: Download from cursor.sh
- Load the Project: Open the repository in Cursor
- Enable Rules: The AI will automatically use the configured rules
- Start Coding: Use natural language to describe features
Example AI Prompts:
"Create a new Product entity with CRUD operations following Clean Architecture"
"Add user authentication to the Orders page"
"Implement caching for the CustomerService"
π Development Workflow
The project includes a comprehensive Development Workflow with:
- Task Management: Structured approach to feature development
- Code Review Guidelines: Quality assurance processes
- Testing Strategies: Unit and integration testing patterns
- Deployment Procedures: CI/CD pipeline configurations
π Quick Start
Prerequisites
- .NET 9 SDK
- Visual Studio 2022 or Rider
- Docker Desktop (optional)
Installation
Install the Template
dotnet new install CleanArchitecture.Blazor.Solution.Template
Create New Project
dotnet new ca-blazorserver-sln -n YourProjectName cd YourProjectName
Setup Database
dotnet ef database update --project src/Migrators/Migrators.MSSQL
Run the Application
dotnet run --project src/Server.UI
Access the Application
- Navigate to
https://localhost:7152
- Login with default credentials (see documentation)
- Navigate to
π³ Docker Deployment
Quick Start with In-Memory Database:
docker run -p 8443:443 -e UseInMemoryDatabase=true \
blazordevlab/cleanarchitectureblazorserver:latest
Production Setup:
docker-compose up -d
See Docker Setup Documentation for detailed configuration.
π Documentation
- Architecture Guide: Detailed architecture explanation
- Development Workflow: Step-by-step development process
- API Documentation: Complete API reference
- Deployment Guide: Production deployment instructions
- Contributing Guidelines: How to contribute to the project
π§ Code Generation
Accelerate development with the Visual Studio extension:
- CleanArchitecture CodeGenerator
- Automatically generates layers for new entities
- Maintains architectural consistency
- Reduces boilerplate code by 80%
<div><video controls src="https://user-images.githubusercontent.com/1549611/197116874-f28414ca-7fc1-463a-b887-0754a5bb3e01.mp4" muted="false"></video></div>
ποΈ Database Support
Database | Provider Name | Status |
---|---|---|
SQL Server | mssql |
β Fully Supported |
PostgreSQL | postgresql |
β Fully Supported |
SQLite | sqlite |
β Fully Supported |
Configure in appsettings.json
:
{
"DatabaseSettings": {
"DBProvider": "mssql",
"ConnectionString": "Server=localhost;Database=YourDb;Trusted_Connection=true;"
}
}
π Authentication Providers
Configure OAuth providers in appsettings.json
:
- Microsoft: Setup Guide
- Google: Setup Guide
- Facebook: Setup Guide
- Twitter: Setup Guide
π Docker Setup for Blazor Server Application
Pull the Docker Image
docker pull blazordevlab/cleanarchitectureblazorserver:latest
Run the Docker Container
For Development (In-Memory Database):
docker run -p 8443:443 -e UseInMemoryDatabase=true -e ASPNETCORE_ENVIRONMENT=Development -e ASPNETCORE_HTTPS_PORTS=443 blazordevlab/cleanarchitectureblazorserver:latest
For Production (Persistent Database and SMTP Configuration):
docker run -d -p 8443:443 \
-e UseInMemoryDatabase=false \
-e ASPNETCORE_ENVIRONMENT=Development \
-e ASPNETCORE_HTTP_PORTS=80 \
-e ASPNETCORE_HTTPS_PORTS=443 \
-e DatabaseSettings__DBProvider=mssql \
-e DatabaseSettings__ConnectionString="Server=127.0.0.1;Database=BlazorDashboardDb;User Id=sa;Password=<YourPassword>;MultipleActiveResultSets=true;Encrypt=false;TrustServerCertificate=false" \
-e SmtpClientOptions__User=<YourSMTPUser> \
-e SmtpClientOptions__Port=25 \
-e SmtpClientOptions__Server=<YourSMTPServer> \
-e SmtpClientOptions__Password=<YourSMTPPassword> \
-e Authentication__Microsoft__ClientId=<YourMicrosoftClientId> \
-e Authentication__Microsoft__ClientSecret=<YourMicrosoftClientSecret> \
-e Authentication__Google__ClientId=<YourGoogleClientId> \
-e Authentication__Google__ClientSecret=<YourGoogleClientSecret> \
-e Authentication__Facebook__AppId=<YourFacebookAppId> \
-e Authentication__Facebook__AppSecret=<YourFacebookAppSecret> \
blazordevlab/cleanarchitectureblazorserver:latest
Docker Compose Setup
For easier management, use a docker-compose.yml file:
version: '3.8'
services:
blazorserverapp:
image: blazordevlab/cleanarchitectureblazorserver:latest
environment:
- UseInMemoryDatabase=false
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80;https://+:443
- ASPNETCORE_HTTP_PORTS=80
- ASPNETCORE_HTTPS_PORTS=443
- DatabaseSettings__DBProvider=mssql
- DatabaseSettings__ConnectionString=Server=127.0.0.1;Database=BlazorDashboardDb;User Id=sa;Password=***;MultipleActiveResultSets=true;Encrypt=false;TrustServerCertificate=false
- SmtpClientOptions__User=<YourSMTPUser>
- SmtpClientOptions__Port=25
- SmtpClientOptions__Server=<YourSMTPServer>
- SmtpClientOptions__Password=<YourSMTPPassword>
- Authentication__Microsoft__ClientId=<YourMicrosoftClientId>
- Authentication__Microsoft__ClientSecret=<YourMicrosoftClientSecret>
- Authentication__Google__ClientId=<YourGoogleClientId>
- Authentication__Google__ClientSecret=<YourGoogleClientSecret>
- Authentication__Facebook__AppId=<YourFacebookAppId>
- Authentication__Facebook__AppSecret=<YourFacebookAppSecret>
ports:
- "8443:443"
volumes:
- files_volume:/app/Files
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=YourStrongPassword!
ports:
- "1433:1433"
volumes:
- mssql_data:/var/opt/mssql
volumes:
files_volume:
mssql_data:
π€ Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
π Learning Resources
Video Tutorials
Tutorial: Adding a Contact Entity
Tutorial: Removing a Customer Object
Related Projects
- CleanAspire: Blazor WebAssembly version with .NET Aspire
- CleanArchitecture CodeGenerator: Visual Studio extension
π About the Creator
Visit my website for more Blazor resources and professional services:
BlazorServer.com - Blazor Development Services & Resources
β€οΈ Support This Project
If this project helps you, please consider supporting its development:
- β Star this repository
- π Report issues
- π‘ Suggest features
- π° Sponsor: GitHub Sponsors | PayPal
Your support helps maintain and improve this project. Thank you! π
π License
This project is licensed under the MIT License - see the LICENSE file for details.
<div align="center">
Built with β€οΈ using Clean Architecture principles
β Star this repo | π Report Bug | π‘ Request Feature
</div>
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.1.0 | 163 | 7/31/2025 |
1.0.2 | 288 | 1/20/2025 |
1.0.0-preview.26 | 176 | 8/9/2024 |
1.0.0-preview.21 | 126 | 4/18/2024 |
1.0.0-preview.20 | 831 | 2/21/2024 |
1.0.0-preview.19 | 292 | 2/13/2024 |
1.0.0-preview.18 | 348 | 2/2/2024 |
1.0.0-preview.17 | 1,534 | 12/6/2023 |
1.0.0-preview.16 | 1,433 | 10/14/2023 |
1.0.0-preview.15 | 119 | 9/22/2023 |
1.0.0-preview.14 | 137 | 8/28/2023 |
1.0.0-preview.12 | 145 | 8/15/2023 |
1.0.0-preview.11 | 130 | 8/10/2023 |
1.0.0-preview.10 | 133 | 8/9/2023 |
1.0.0-preview.9 | 183 | 8/9/2023 |
1.0.0-preview.8 | 123 | 8/8/2023 |
1.0.0-preview.7 | 118 | 8/8/2023 |
1.0.0-preview.6 | 155 | 7/21/2023 |
1.0.0-preview.5 | 136 | 7/16/2023 |
1.0.0-preview.4 | 141 | 7/11/2023 |
1.0.0-preview.3 | 148 | 7/5/2023 |
1.0.0-preview.2 | 150 | 7/5/2023 |
1.0.0-preview.1 | 183 | 7/3/2023 |
1.1.0
- 🌈 Integrate Stl.Fusion for real-time updates
- 🐛 fixed ocr process issue
- 🌈 Implement Google and Microsoft External Provider Authentication