Skip to content

Blazor

Blazor is a .NET web UI framework for building interactive web apps using C# and Razor components instead of JavaScript. Choose this component when you’re building dashboards, internal tools, or full-featured web apps where you want to stay in the .NET ecosystem and share code across client and server. Diploi builds your Blazor project and deploys it with the runtime and assets it needs to run.

Paste this entry into the components list in diploi.yaml to add Blazor to your project.

components:
- name: Blazor
identifier: blazor
package: https://github.com/diploi/component-blazor#v10.0-05.2026
  1. In the Dashboard, click Create Project +
  2. Under Pick Components, choose Blazor. Here you can also add a backend framework to create a monorepo app
  3. In Pick Add-ons, you can add one or multiple databases to your app
  4. Choose Create Repository to generate a new GitHub repo
  5. Finally, click Launch Stack

Link to the full guide - upcoming

During development, the container uses dotnet watch to enable automatic reloads when files change. The development server is started with:

Terminal window
dotnet watch --no-launch-profile --hot-reload --non-interactive

This will:

  • Use dotnet watch to monitor for changes to .cs, .razor, and .css files and restart the server when changes are detected.
  • Run the Blazor Server application with hot reload enabled.
  • Start the app on port 5054.
  • Enable automatic browser refresh when Razor components or CSS files change.

Front-end libraries (CSS/JS frameworks like Bootstrap, jQuery, etc.):

First, ensure .NET tools are restored:

Terminal window
dotnet tool restore

Then install front-end libraries using LibMan:

Terminal window
dotnet tool run libman install <library>@<version> --provider cdnjs --destination wwwroot/lib/<library>

For example:

Terminal window
dotnet tool run libman install bootstrap@5.3.0 --provider cdnjs --destination wwwroot/lib/bootstrap
dotnet tool run libman install jquery@3.7.1 --provider cdnjs --destination wwwroot/lib/jquery

NuGet packages (C# libraries and frameworks):

Terminal window
dotnet add package <PackageName>

For example:

Terminal window
dotnet add package Newtonsoft.Json
dotnet add package Microsoft.EntityFrameworkCore.SqlServer

The libman.json file manages client-side libraries, while the .csproj file tracks NuGet dependencies. Both are automatically restored during development and build.

Important: Important: After running dotnet add package , always run dotnet build to resolve new dependency update.

Builds a production-ready image. During the build, dependencies are restored with dotnet restore and the application is published with dotnet publish. When the container starts, it runs:

Terminal window
dotnet component-blazor.dll

This uses the compiled .NET application optimized for production deployment.

The application uses ASP.NET Core Data Protection for securing authentication cookies and anti-forgery tokens. In Kubernetes deployments, data protection keys are persisted using a PersistentVolumeClaim to ensure session continuity across pod restarts.