Fir is a Go toolkit for building reactive web interfaces by re-rendering html/template fragments on the server and patching the DOM with an Alpine.js plugin, positioning itself between Phoenix LiveView and htmx. It is an open-source library hosted on GitHub (github.com/livefir/fir) that ships with a Go server library and an Alpine.js plugin.
What is Fir?
Fir is a Go library and Alpine.js plugin for building reactive web applications with server-rendered HTML. It takes Go code and html/template templates as input, and produces HTML fragments that update the page in response to user or server events. Fir runs inside a standard Go web server and is designed for developers who want reactive behavior without learning a full JavaScript framework.
Key Features
- Server rendered — HTML is generated on the server using Go's standard
html/templatelibrary. - DOM patching — Only the changed parts of the page are updated, via the Alpine.js plugin.
- Progressive enhancement — Start with a JavaScript-free HTML file and Go server; gradually add the Alpine.js plugin to avoid page reloads.
- Publish over websocket — HTML fragments can be broadcast to connected clients over websockets in response to client or server events.
- Interactivity over standard HTTP — Websockets can be disabled; UI diffs are then sent over standard HTTP.
- Broadcast from server — Server-side code can push page changes to specific connected clients.
- Error tracking — Returning an error or nil shows or hides user-specific errors on the page.
- Development live reload — HTML pages reload automatically on edits when development mode is enabled.
Who should use Fir?
Go developers with moderate HTML/CSS/JS skills who want to build reactive apps without mastering a complex frontend framework are the primary audience. It is a good fit for building internal tools, interactive forms, and real-time feeds. The page explicitly notes Fir works well for these three use cases with low effort.
Use cases
- Internal tools: Build passable UIs quickly by server-rendering forms and data views with Go's
html/templateand patching updates via Alpine.js. - Interactive forms: Validate and re-render form fragments on the server, returning errors to specific users without a full page reload.
- Real-time feeds: Broadcast HTML fragments over websockets to connected clients in response to server events.
- Quickstart projects: Use the
github.com/livefir/clitool to generate a new project and route, then run it onlocalhost:9867.
How does Fir work?
Fir introduces a single declarative expression, fir:event-name:event-state::template-name, which attaches to Alpine.js event binding syntax. When an event fires, Fir sends a request to the server, re-renders the specified html/template, and patches the page with the returned fragment. The Go API mirrors Phoenix LiveView concepts: routes (Fir Route), loading data on page load (Fir OnLoad), and handling user events (Fir OnEvent).
Alternatives
- Phoenix LiveView — a full framework in Elixir that returns atomic UI diffs over websocket and includes a server library, whereas Fir returns HTML fragments and runs in Go.
- htmx — a JavaScript library that returns HTML fragments over HTTP without a dedicated server library, while Fir ships with a Go server and pubsub.
- livetemplate — the project Fir's development has pivoted to; a Phoenix LiveView-inspired web framework (notably, Fir's GitHub repo flags that development stopped).
FAQ
Is Fir free?
Fir is an open-source toolkit published on GitHub under github.com/livefir/fir, with an Alpine.js plugin published on npm under @livefir/fir. Both libraries are freely available.
Is Fir still maintained?
The GitHub repository states: "DEVELOPMENT STOPPED ON FIR" — development has pivoted to a new project called livetemplate, a Phoenix LiveView-inspired web framework. The repository remains available, but new feature work is happening on livetemplate.
Does Fir require websockets?
No. Fir has built-in pubsub over websocket, but websockets can be disabled. In that case, UI diffs are still delivered over standard HTTP, allowing the toolkit to work in simpler deployment environments.
Can Fir be used without Alpine.js?
Yes, thanks to progressive enhancement. You can begin with a JavaScript-free HTML file and Fir's Go server API for a quick setup. The Alpine.js plugin is then added gradually to enable DOM updates without page reloads.
What is the Fir event expression?
The expression fir:event-name:event-state::template-name piggybacks on Alpine.js event binding syntax. It declares which html/template should be re-rendered on the server when an event occurs, and the resulting HTML fragment is applied to the page.





