Nodea — logo

Blazor

Blazor is a web UI framework from Microsoft, shipped as part of ASP.NET Core, that lets developers build interactive browser applications in C# rather than JavaScript. UI logic, event handling, validation and data binding are all written in one language, which makes Blazor especially appealing to teams that already maintain a .NET backend and want to avoid running a parallel JavaScript stack.

How Blazor works

Applications are composed of Razor components — .razor files mixing HTML markup with C# code. What makes Blazor unusual is that the same component model runs in several hosting modes:

  • Blazor WebAssembly — the app plus a trimmed .NET runtime is downloaded and executed inside the browser via WebAssembly. The result is a true client-side SPA that keeps working through brief connection drops and can be served as static files.
  • Blazor Server — components execute on the server; the browser receives only DOM diffs over a persistent SignalR (WebSocket) connection. Startup is fast and the code never leaves the server, but every interaction needs a live connection.
  • Hybrid and mixed rendering — since .NET 8, render modes can be chosen per component (static SSR, server, WebAssembly, or auto), and Blazor Hybrid embeds the same components in desktop and mobile apps via .NET MAUI.

Practical use

Blazor shines in line-of-business software: admin panels, internal dashboards, CRM/ERP front ends and form-heavy intranet tools, where developer productivity and code sharing (validation rules, DTOs) beat raw bundle-size concerns. The WebAssembly flavor suits offline-capable apps and static hosting behind a CDN; the Server flavor suits apps where a small time-to-first-render and centralized execution matter more.

Deployment-wise, Blazor Server needs a host that supports the .NET runtime and long-lived WebSocket connections — typically a Linux or Windows VPS behind a reverse proxy — while Blazor WebAssembly can sit on any plain web server with the API deployed separately. The main trade-off of the client-side mode remains the initial download size, which Microsoft keeps shrinking through IL trimming and Brotli-compressed publishing.

Powiązane pojęcia

Najczęstsze pytania

Do I still need JavaScript with Blazor?

Mostly no — components, routing, forms and state are handled in C#. For browser APIs or existing JS libraries without a .NET wrapper, Blazor provides JS interop, so small amounts of JavaScript may still appear in real projects.