Fir leverages Golang’s standard library html/template package and a bit of alpinejs to allow building reactive UIs. You start with plain old html and use alpinejs to enhance it to bring no-page-reload interactivity to web apps.<p>The Fir toolkit is designed for Go developers with moderate html/css & js skills who want to progressively build reactive web apps without mastering complex web frameworks. It includes a Go library and an Alpine.js plugin.<p>How it works ?<p>On receiving user-interactions the fir server re-renders html templates and sends it over the wire where the fir client library selectively updates the changed areas.<p>When a user event is received by a Fir route, an array of html templates are rendered on the server and returned as an array of DOM events to the browser. The DOM events are consumed by the alpinejs plugin and dispatched within the DOM where listeners attached to elements can use the event to update the DOM.<p>See the demo and quickstart here: <a href="https://livefir.fly.dev/" rel="nofollow">https://livefir.fly.dev/</a>
The idea of using Go and Alpine.js together for building reactive web apps seems promising. As you mentioned, Fir is targeting devs with moderate HTML/CSS & JS skills.<p>How does Fir handle more complex scenarios such as nested components, handling form submissions with client-side validation, and integrating third-party APIs or libraries?<p>Does the toolkit offer any built-in functionality or guidelines for handling these cases, or is the developer expected to handle them using custom code and Alpine.js plugins?<p>Also the site is super slow!
Interesting stuff; is this intended to be an experiment or a longer-term project? I think a straight-forward comparison of Fir and things like HTMX (htmx.org) would be a good addition to the demo page or docs. I’m not one, but from what I gather many golang enthusiasts like using the std http features of the language and other libraries like HTMX seem more appealing as they live just in the html templates. It’d help get a quick idea of how it fits in with existing libraries. For instance, the pubsub feature would be a distinction.
The one thing that golang really needs is a templating library that doesn't suck, Html bindings in this language feel more like an after thought and this is coming from a person that really likes this language.
The second example counter is jumping around instead of incrementing/decrementing by 1. Is state being shared between users or somesuch?<p>Or is it because I first clicked the full reload example several times?<p>iOS
I wonder if it slow because of the locking, because other than that it shouldn't use much resources to run this.<p>Anyway I am lazy, so I would probably just use HTMX boosting:<p><pre><code> <div hx-boost="true">
// traditional code goes here
</div></code></pre>
I'm currently working with Alpine.js in order to try to build "Universal Components" or "Hypermedia Components". Where you just hit a URL and get your component like /components/infinite-canvas or /components/svg-2-base64 or /components/lib-somelib.<p>[1] ilse.ink/components(It's not ready yet)
This is very cool. I'm working on a side project right now with a go back end and alpine front end. One of the things I've had to overcome is handling cookies and CORS since not everything is served from localhost.<p>I ended up packaging my frontend in an nginx container and using that same nginx container as a proxy for the backend but the whole time I thought maybe this small project would be easier if everything was served by go.<p>Will definitely keep an eye on this for future stuff.
I've also used alpineJS, Golang and tailwindCSS to build gocial [1]. The source code is also publicly available [2]. The whole project is hosted at netlify as a big Lambda function.<p>But I think for future projects I might use HTMX + Tailwind.<p>[1]: <a href="https://gocial.netlify.app/" rel="nofollow">https://gocial.netlify.app/</a><p>[2]: <a href="https://github.com/dorneanu/gocial">https://github.com/dorneanu/gocial</a>
I'm building a platform using GoFiber + AlpineJS and it's wonderful. I have to go through the Fir project because I'm trying to figure out what problem it solves. Wouldn't it be just as easy as using the vanilla net library + Alpine or one of the more established Go frameworks + Alpine? Honest question. If Fir has a value proposition that's unique im still in a position to pivot.