TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Build progressively enhanced reactive HTML apps using Go and Alpine.js

127 pointsby realrockerabout 2 years ago
Fir leverages Golang’s standard library html&#x2F;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&#x2F;css &amp; 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:&#x2F;&#x2F;livefir.fly.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;livefir.fly.dev&#x2F;</a>

15 comments

ajd1988about 2 years ago
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&#x2F;CSS &amp; 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!
评论 #35882323 未加载
fshrabout 2 years ago
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.
评论 #35882360 未加载
kindofabigdealabout 2 years ago
The one thing that golang really needs is a templating library that doesn&#x27;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.
评论 #35886318 未加载
评论 #35887379 未加载
whiddershinsabout 2 years ago
The second example counter is jumping around instead of incrementing&#x2F;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
评论 #35882487 未加载
quickthrower2about 2 years ago
I wonder if it slow because of the locking, because other than that it shouldn&#x27;t use much resources to run this.<p>Anyway I am lazy, so I would probably just use HTMX boosting:<p><pre><code> &lt;div hx-boost=&quot;true&quot;&gt; &#x2F;&#x2F; traditional code goes here &lt;&#x2F;div&gt;</code></pre>
评论 #35882732 未加载
评论 #35883566 未加载
examplary_cableabout 2 years ago
I&#x27;m currently working with Alpine.js in order to try to build &quot;Universal Components&quot; or &quot;Hypermedia Components&quot;. Where you just hit a URL and get your component like &#x2F;components&#x2F;infinite-canvas or &#x2F;components&#x2F;svg-2-base64 or &#x2F;components&#x2F;lib-somelib.<p>[1] ilse.ink&#x2F;components(It&#x27;s not ready yet)
评论 #35885733 未加载
msolbergabout 2 years ago
This is very cool. I&#x27;m working on a side project right now with a go back end and alpine front end. One of the things I&#x27;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.
cyneoxabout 2 years ago
I&#x27;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:&#x2F;&#x2F;gocial.netlify.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gocial.netlify.app&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;dorneanu&#x2F;gocial">https:&#x2F;&#x2F;github.com&#x2F;dorneanu&#x2F;gocial</a>
Art9681about 2 years ago
I&#x27;m building a platform using GoFiber + AlpineJS and it&#x27;s wonderful. I have to go through the Fir project because I&#x27;m trying to figure out what problem it solves. Wouldn&#x27;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&#x27;s unique im still in a position to pivot.
评论 #35882723 未加载
drusepthabout 2 years ago
Been using Alpine.js in a Ruby on Rails app for about 6 months now. It&#x27;s a very cool, lightweight js library that I rarely see talked about.
cloudkingabout 2 years ago
Counter doesn&#x27;t work properly on Android Chrome FYI just reloads the page.
评论 #35884406 未加载
husarcikabout 2 years ago
This is exactly what I need! I use Laravel mostly (with htmx and alpine) but wanted to build some stuff in Go. Thank you for your work!
hyeomansabout 2 years ago
Hope this is constructive feedback: I’m located in México and it takes around 20 seconds to load.
评论 #35882305 未加载
评论 #35882298 未加载
earthboundkidabout 2 years ago
Yes! This is the project I’ve been waiting for.
RamblingCTOabout 2 years ago
I&#x27;m on Arc (Chromium) and pressing any of the buttons in the first example jumps to the top of the page.