Choosing a Blazor stack
I'm planning to make a self-hostable video sharing platform in ASP.NET with Blazor, but I'm not sure what model to pick.
I'd like to use EF Core and Identity
I want it to be as responsive as possible, so my initial plan was to use Blazor WASM with a controller-based API on the backend, but looking at the docs it doesn't seem to be a very "idiomatic" setup?
I am also wondering how to share data models like POST forms and queries between the WASM client and backend idiomatically.
I considered gRPC-web for the backend API, but that seems like an even more exotic of a setup with Identity, and I'd probably not be able to use cookie-based auth with it in a sane way.
For the record, I have experience with building web apps in Rust, but this is my first time doing it in .NET.
2 Replies
Blazor WASM with an API works just fine
For sharing models, just use a
.Shared
project that contains all the DTOs
Or generate clients from the OpenApi spec
The most idiomatic way — or at least the way Microsoft would like you to take — would be just using a "blazor app" with automatic handling of components
The way it works by default, is it prerenders everything, then adds interactivity with Blazor Server until the WASM bundle gets downloaded, then it switches to WASMsounds good, thank you <3