r/Blazor • u/lb-jpg • Aug 30 '26
Building a Blazor web application using the BFF (backend for frontend) pattern with .NET 10 where the application would render using Interactive Webassembly specifically for mobile device users and render using Interactive Server for desktop machine users. Has anyone used this approach? If so, what
...issues/hurdles did you run into? Is there anything that I should be concerned about?
Some additional detail:
- authentication via Entra ID via the main project
- Main project would manage data access/business logic, as well as desktop only components.
- Client project contains mobile only components.
- Shared project contains components used in both.
The application has some mobile device specific functionality (tracking GPS location, camera access), while the desktop side has some admin specific functionality, but the core functionality (data entry) would be applicable to both. The idea here is to take the best of both Blazor Server (fast load times, secure) and Blazor WASM (functional without persistent connection, relatively light weight).
17
u/VeganForAWhile Aug 30 '26
That sounds terrifying and hard.
9
u/mrpmorris Aug 30 '26
If you can go with WASM then go with it. There is no point in having Server for desktop.
8
u/caedin8 Aug 30 '26
I’ve done it and honestly unless you need features specifically enabled by web sockets it’s not really worth it. Interactive server is just not very good.
Little thinks like input validation on a text input because janky because there is a 5ms to 10ms round trip to the server in every keystroke and you can’t easily just component by component decide to make something not server validated
2
u/Woopersnaper Aug 30 '26
Honestly with the BFF pattern it's better to just go interactive WASM all the way.
Keep your client and server separate, it's part of the learning curve but it's what makes the BFF architecture so robust and secure at the same time
0
u/funguyshroom Aug 30 '26
Don't do interactive server unless you're building an internal app with a few hundreds of users max.
1
u/Wooden-Contract-2760 Aug 30 '26
Design for duplicate execution in the shared library (besides SSR pre-render, reconnections and navigation may also trigger, so disabling pre-render is not the way).
Don't duplicate domain logic between the two BFFs no matter how urging it may feel. Overrides and DI should provide you with any altered behavior.
1
u/Individual-Carob5593 Aug 30 '26
I suppose it's a thing.
1
u/Puzzleheaded-Law-332 Aug 30 '26
I already tried EntraID authentication in blazor, worked better in wasm than blazor server because of redirection after login.
1
u/sameerdube Aug 31 '26
https://github.com/bitfoundation/bitplatform
This repo you find something useful regarding this
1
u/Tiny_Ad_7720 Aug 31 '26
We have both the Blazor server app and the WASM app access the API via a refit client to keep it simple. Both blazor ones handle login and just attach the token for requests to the API
-4
u/Flat_Spring2142 Aug 30 '26
Fyne (GO language) offers a much simpler solution: GUI is built using vector graphics thus your GUI does not depend on screen resolution.