A modern .NET 9 solution using Aspire, featuring a Blazor WebAssembly client, Blazor Server, API, and automated SQL Server provisioning with clean architecture principles.
- Blazor WebAssembly Client: Interactive UI with MudBlazor.
- Blazor Server: Server-side rendering and API gateway.
- API Project: ASP.NET Core Web API for backend logic.
- Automated SQL Server: Local SQL Server container with automatic database creation and migrations using DbUp.
- Service Defaults: Health checks, OpenTelemetry, and service discovery.
- Clean Architecture: Clear separation of Application, Domain, and Infrastructure.
• Presentation.Client # Blazor WebAssembly UI • Presentation.Server # Blazor Server host & API gateway • Presentation.API # ASP.NET Core Web API • WeatherDbBuilder # Database migrations (DbUp) • Application, Domain, Infrastructure # Core business logic and data access • CleanArchitectureBlazorInteractiveAuto.AppHost # Aspire app host (orchestration)
- .NET 9 SDK
- Docker (for local SQL Server)
- (Optional) Visual Studio 2022
-
Restore & Build
dotnet restore dotnet build
-
Start the Aspire App Host
dotnet run --project CleanArchitectureBlazorInteractiveAuto.AppHost
This will:
- Launch the SQL Server container
- Run database migrations via
WeatherDbBuilder - Start API, Server, and Client projects
-
Browse the App
- Blazor Client: http://localhost:{PORT}
- API: http://localhost:{PORT}/swagger
- Health checks:
/healthand/alive
- SQL Server runs in a Docker container.
- Migrations are applied automatically at startup via
WeatherDbBuilder/scripts/*.sql.
- Connection strings are managed by Aspire and do not need to be set in
appsettings.json. - For custom settings, use the appropriate
appsettings.*.jsonfiles.
- Business logic:
Application,Domain,Infrastructure - UI:
Presentation.Client(Blazor WASM),Presentation.Server(Blazor Server) - Database scripts:
WeatherDbBuilder/scripts/
- Health checks and OpenTelemetry are enabled by default.
- See
/healthand/aliveendpoints.