CleanArchitecture.Blazor.Solution.Template 1.30.3

dotnet new install CleanArchitecture.Blazor.Solution.Template::1.30.3
                    
This package contains a .NET Template Package you can call from the shell/command line.

Clean Architecture Blazor Server

Build CodeQL Nuget Docker Image CI Downloads

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 10 and follows Blazor Clean Architecture best practices. It provides a solid foundation for building scalable, maintainable enterprise applications with modern spec-driven development practices.

Key Features

  • πŸ—οΈ Clean Architecture: Strict layer separation with dependency inversion
  • 🎨 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:

Application Demo

Live Demo: architecture.blazorserver.com

HSE Management System HSE Management System - GitHub | Live Demo

Digital Product Passport EU Digital Product Passport - Live Demo

πŸ› οΈ Technology Stack

Layer Technologies
Frontend Blazor Server, MudBlazor, SignalR
Backend .NET 10, 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

πŸ“‹ 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

Installation

  1. Install the Template

    dotnet new install CleanArchitecture.Blazor.Solution.Template
    
  2. Create New Project

    dotnet new ca-blazorserver-sln -n YourProjectName
    cd YourProjectName
    
  3. Setup Database

    dotnet ef database update --project src/Migrators/Migrators.MSSQL
    
  4. Run the Application

    dotnet run --project src/Server.UI
    
  5. Access the Application

    • Navigate to https://localhost:7152
    • Login with default credentials (see documentation)

🐳 Docker Deployment

Run with configured database provider (In-Memory removed):

docker run -p 8443: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" \
  blazordevlab/cleanarchitectureblazorserver:latest

Production Setup (docker compose):

docker-compose up -d

See Docker Setup Documentation for detailed configuration.

πŸ“š Documentation

πŸ“ Using OpenSpec for Feature Development

OpenSpec enables spec-driven, reviewable changes with clear proposals, deltas, and tasks. This repo includes guidance in openspec/AGENTS.md and a project context in openspec/project.md.

  • Read the quickstart: openspec/AGENTS.md
  • Project conventions and patterns: openspec/project.md (see "New Entity/Feature Guide (Contacts Pattern)")

Workflow

  1. Plan a change
  • Review specs and pending changes
    • openspec list --specs
    • openspec list
  • Pick a unique, verb-led change id (e.g., add-customer-management).
  1. Create the change folder and docs
  • Create: openspec/changes/<change-id>/
  • Add files:
    • proposal.md – Why, What Changes, Impact
    • tasks.md – Implementation checklist
    • Optional design.md – Architecture decisions when needed
    • Spec deltas: openspec/changes/<change-id>/specs/<capability>/spec.md
  • Spec delta format must include sections like:
    • ## ADDED|MODIFIED|REMOVED Requirements
    • At least one #### Scenario: per requirement (use the exact header text)
  1. Validate and iterate
  • openspec validate <change-id> --strict
  • Fix any issues before requesting review/approval.
  1. Implement after approval
  • Follow the tasks in tasks.md sequentially and mark them complete.
  • Use the patterns in openspec/project.md:
    • For data access in handlers use IApplicationDbContextFactory and per-operation context lifetime:
      • await using var db = await _dbContextFactory.CreateAsync(cancellationToken);
    • Follow MediatR pipeline behaviors, caching tags, and specification patterns.
    • Mirror the Contacts module for a new entity's DTOs, commands, queries, specs, security, and UI pages/components.
  1. Archive after deployment
  • Move openspec/changes/<id>/ to openspec/changes/archive/YYYY-MM-DD-<id>/ (or use the CLI archive helper if available).
  • Re-run openspec validate --strict.

Example change scaffold

  • Change id: add-customer-management
  • Files:
    • openspec/changes/add-customer-management/proposal.md
    • openspec/changes/add-customer-management/tasks.md
    • openspec/changes/add-customer-management/specs/customers/spec.md

proposal.md skeleton:

## Why
Introduce Customer management to track client records.

## What Changes
- Add Customer entity, CRUD flows, and pages
- Add permissions and navigation

## Impact
- Affected specs: customers
- Affected code: Domain, Application (Contacts-like), Infrastructure, Server.UI

tasks.md sample:

## 1. Implementation
- [ ] 1.1 Domain entity + events
- [ ] 1.2 EF configuration + seeding
- [ ] 1.3 Application commands/queries/specs/security/caching
- [ ] 1.4 UI pages + dialog
- [ ] 1.5 Tests (unit/integration)

Spec delta snippet:

## ADDED Requirements
### Requirement: Manage Customers
The system SHALL allow users to create, edit, view, list, and delete customers with proper authorization.

#### Scenario: Create customer
- **WHEN** a user submits a valid form
- **THEN** the system saves the customer and returns an id

Tips

  • Use Contacts as the reference implementation for structure and conventions.
  • Add menu entries in src/Server.UI/Services/Navigation/MenuService.cs.
  • Define permissions under Permissions.<Module> and they'll be picked up during seeding.

πŸ”§ Code Generation

Accelerate development with the Visual Studio extension:

<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:

πŸš€ Docker Setup for Blazor Server Application

Pull the Docker Image

docker pull blazordevlab/cleanarchitectureblazorserver:latest

Run the Docker Container

For Development:

docker run -p 8443:443 -e ASPNETCORE_ENVIRONMENT=Development -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" \
  blazordevlab/cleanarchitectureblazorserver:latest

For Production (Persistent Database and SMTP Configuration):

docker run -d -p 8443:443 \
-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:
      - 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.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“– Learning Resources

Video Tutorials

Adding Contact Entity Tutorial: Adding a Contact Entity

Removing Customer Object Tutorial: Removing a Customer Object

🌐 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.30.3 258 11/7/2025
1.30.2 214 10/31/2025
1.30.1 185 10/30/2025
1.30.0 183 10/28/2025
1.1.0 556 7/31/2025
1.0.2 421 1/20/2025
1.0.0-preview.26 256 8/9/2024
1.0.0-preview.21 205 4/18/2024
1.0.0-preview.20 933 2/21/2024
1.0.0-preview.19 373 2/13/2024
1.0.0-preview.18 431 2/2/2024
1.0.0-preview.17 1,617 12/6/2023
1.0.0-preview.16 1,525 10/14/2023
1.0.0-preview.15 222 9/22/2023
1.0.0-preview.14 237 8/28/2023
1.0.0-preview.12 250 8/15/2023
1.0.0-preview.11 241 8/10/2023
1.0.0-preview.10 223 8/9/2023
1.0.0-preview.9 289 8/9/2023
1.0.0-preview.8 217 8/8/2023
1.0.0-preview.7 205 8/8/2023
1.0.0-preview.6 247 7/21/2023
1.0.0-preview.5 245 7/16/2023
1.0.0-preview.4 256 7/11/2023
1.0.0-preview.3 254 7/5/2023
1.0.0-preview.2 256 7/5/2023
1.0.0-preview.1 297 7/3/2023

1.30.2
- Upgraded to .NET 10 (including all project files, Docker images, and dependencies)
- Updated all Microsoft packages to .NET 10 RC2 (10.0.0-rc.2.25502.107)
- Updated Entity Framework Core to version 10.0.0-rc.2
- Updated ASP.NET Core packages to version 10.0.0-rc.2
- Upgraded third-party packages for .NET 10 compatibility:
  - Npgsql.EntityFrameworkCore.PostgreSQL β†’ 10.0.0-rc.2
  - EFCore.NamingConventions β†’ 10.0.0-rc.2
  - Hangfire packages β†’ 1.8.22
  - Minio β†’ 7.0.0
  - QuestPDF β†’ 2025.12.0-alpha3
  - NUnit3TestAdapter β†’ 6.0.0-beta.1
- Updated Docker base images to .NET 10 runtime and SDK
- Added full Specification pattern support (spec) for advanced querying and filtering
- Integrated Stl.Fusion for real-time UI/state updates across sessions
- Implemented Google and Microsoft external provider authentication enhancements
- Improved multi-tenant context handling and tenant switch service
- Enhanced Document OCR pipeline (Gemini integration and job reliability fixes)
- Added Security Risk Dashboard and user login risk summary indicators
- Picklist and PicklistSet import/export and advanced specification filtering
- Added comprehensive validation and exception handling pipeline behaviours
- Theme customization (dynamic primary color and themes menu improvements)
- Localization and culture enhancements (multi-language resource sets)
- Added global search dialog and improved navigation menu structure
- Improved caching keys and parallel/channel domain event publish strategies
- Extended integration/unit test coverage (specifications, exception handlers, services)
- Strengthened security analysis and audit logging (LoginAudits, AuditTrails, SystemLogs)
- Added user profile reactive state management and session tracking
- Added AI settings configuration interface
- Updated EF Core configurations and migrations for .NET 10