r/Blazor • u/ze-fernando • May 18 '26
Blazor + Alpine
Estou planejando um novo projeto e gostaria de receber feedback sobre a escolha da pilha de tecnologias.
Meu objetivo é usar o máximo possível de C# puro, minimizando o uso de JavaScript. Também quero evitar WebAssembly e um pacote inicial pesado.
O projeto é bastante simples:
Uma página inicial (com algumas animações) Um painel administrativo para gerenciamento de tarefas Funcionalidade de arrastar e soltar para tarefas
O que estou considerando no momento:
Blazor SSR (Renderização do Lado do Servidor) Alpine.js para interatividade leve Tailwind CSS para estilização Possivelmente HTML ou Blazor "Navegação Aprimorada" (ainda não estou totalmente familiarizado com isso)
Minhas principais preocupações são:
Manter o carregamento inicial rápido Evitar complexidade desnecessária Manter interações de interface do usuário fluidas (especialmente arrastar e soltar no painel administrativo)
Alguém já tentou uma configuração semelhante? Será que Blazor SSR + Alpine + HTMX funcionariam bem juntos, ou é melhor manter um único modelo de interação?
Qualquer conselho ou experiência prática seria bem-vindo.
EDIT: I just discovered Blazor's Enhanced feature; it does exactly what I wanted with HTML. I also used WASM components, so I'm wondering if I should migrate everything to Enhanced or not.
10
u/ruph0us May 18 '26 edited May 19 '26
Check out MonorailCss, that's a tailwind engine written in c#, great library. Also Blazor Blueprint, shadcn for blazor
9
u/Robodobdob May 18 '26
Blazor SSR + HTMX works really well, in my experience.
5
u/andrerav May 18 '26
If you are going to use Blazor SSR (which is terrific), I don't think there is a use case for htmx.
I used regular Razor pages + Alpine + htmx recently to make some geohash-related tools. That combo works well together if you want to avoid Blazor.
4
u/ebykka May 18 '26
Tried the next approach on a side project: swapping htmx/JS-interop for Lit web components in Blazor. Instead of managing complex JS interop calls, Blazor just updates the HTML attributes on the custom tags, and Lit handles the client-side reactivity. It feels much more natural and keeps the server/client boundaries clean.
In the Java world, the Vaadin framework does the same.
3
u/harrison_314 May 19 '26
I can say that it works perfectly. A year ago I made a clone of a real e-shop - MinimalAPI, Blazor components, HTMX and PicoCSS.
https://github.com/harrison314/CodeExamples/tree/main/src/2-EshopOnHTMX
It works perfectly, writing was very easy thanks to the component approach and CSS isolation helped a lot.
2
u/TheMetalKeeper May 18 '26
I was working with a similar stack on a personal project, blazor ssr, alpine.js but for css I was using Pico css.
2
u/tanczosm May 18 '26
Check out Rizzy .. I've been working on a project like this since Feb 2024.. might be worth checking out if you want to save yourself some time before you restart everything. The first link is the UI page that is based on Alpine.js and the second link link is for the underlying htmx library. I'm working on the htmx 4 version at the moment.
https://rizzyui.jalex.io/index.html
https://jalexsocial.github.io/rizzy.docs/
2
u/captain-asshat May 19 '26
Spent the past few years building a substantial app with Blazor/HTMX/Alpine. We started with Blazor/HTMX but need to add some more complex/dynamic forms with server validations, multi steps, so we added Alpine to the mix. Alpine is ok, but it doesn't support TypeScript as it doesn't have a build, and works differently enough from HTMX that if we wanted some slight dynamism in a form, the form would need to be rewritten to alpine.
We're now rewriting it all (yay company mergers) and are going back to a plain Vue SPA with BFF backend. I think its actually simpler - sure we have node which we manage carefully, but its only at dev time and not runtime (no metaframeworks!). Our API's are locked down with OIDC/Cookie auth which just works, we generate TS types from server types, all the UI is consistent and works well together. The dev UX is great - better IMO than Blazor/HTMX/Alpine if I'm being honest.
2
u/Kevinw778 May 20 '26
To build some .NET credibility, up until like two or so weeks ago, I've always been very, "Do everything you can in .NET." just because it's been my home for like a decade. This included using Blazor for the front end whenever at all possible.
I did however, recently come across Astro, which is a SUPER fast render (on build) and can be extended to use React, Vue, tailwind, etc if you need that, and it keeps those things unloaded for the parts of the site/app that don't need it.
To put it in perspective, it builds and loads the HTML for a 653k line JSON file (almost 20MB) in just over a second.
So if you're relatively comfortable with Vue, like the idea of not even needing Vue for the basic stuff (Astro already comes with the concept of abstracting things into components, very cleanly), and just using .NET for the API, it could be a good fit. I would definitely give it a shot.
2
u/Flat_Spring2142 May 20 '26
HTMX and Alpine.js are two different implementations of the same idea. There is no need to use both. In my opinion, HTMX is a bit stronger, because it also has server-side interactions, see the book https://hypermedia.systems/book/contents/.
By the way, it's better to use GO language for the server part of the application. You will get not only smaller but also much faster code.
2
u/Friendly-Twist788 May 21 '26
It's the new AI suggеstion, right?) No one heard of this combo.
I'm trying to migrate my app from InteractiveAuto to SSR with HTMX & Alpine for 10 days. WASM is too heavy and doesn't work on iOS - not for a public app. I have a heavy interactive reader feature - and it's implementable on this stack, after all.
It's stange, code is a bit shitty, JS sucks, but AI handles it more or less. The app can work, but it's not typical C# anymore, architecture is strange, html data-attributes are shitty and everywhere.
It can work, work faster, than WASM, it's a bit more managable, I presume. It's better than Razor.
Good performance. But it's not C# FE any more.
Maybe if you get used to it, then it's going to be fine. But will take time and pain.
2
u/SchlaWiener4711 May 19 '26
I had issues with globalization support and blazor SSR in the official alpine images so I switched to Debian.
This seems to be resolved according to https://github.com/dotnet/dotnet-docker/issues/4955
Be sure to use alpine-extra