百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fir

> 前端框架
开源

在 Go 中构建反应 html 应用程序

183 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

在 Go 中构建反应 html 应用程序

DEVELOPMENT STOPPED ON FIR: Pivoted to working on livetemplate which is a Phoenix Liveview inspired web framework.

Fir

A Go toolkit to build reactive web interfaces using: Go, html/template and alpinejs.

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. Fir can be used for building passable UIs with low effort and is a good fit for internal tools, interactive forms and real-time feeds.

Fir has a simple and predictable server and client API with only one new (and weird) expression:

javascript
  

snippet from chirper example

Fir’s magic event handling expression fir:event-name:event-state::template-name piggybacks on alpinejs event binding syntax to declare html/templates to be re-rendered on the server. Once accustomed to this weirdness, Fir unlocks a great deal of productivity while adhering to web standards to enable rich and interactive apps

Fir sits somewhere between Phoenix Liveview and htmx in terms of capabilities. It's event-driven like Liveview but, instead of providing atomic UI diffs, it returns html fragments like htmx. Fir is closer to liveview since it ships with a server library. Similar to Liveview, Fir has the concept of routes: Fir Route, Liveview Router, loading data on page load: Fir OnLoad, Liveview onmount and handling user events: Fir OnEvent, Liveview handle_event.

Feature Highlights:

  • Server rendered: Render HTML on the server using Go’s standard html templating library.
  • DOM Patching: React to user or server events to update only the changed parts of a web page.
  • Progressive enhancement: Begin with a JavaScript-free HTML file and Fir's Go server API for quick setup. Gradually improve to avoid page reloads, using Fir's Alpine.js plugin for DOM updates.
  • Publish over websocket: Broadcast html fragments over websocket in response to both client and server events.
  • Interactivity over standard HTTP: Fir possesses a built-in pubsub over websocket capability to broadcast UI diff changes to connected clients. However, it doesn't solely rely on websockets. It's still possible to disable websockets and benefit from UI diffs sent over standard HTTP.
  • Broadcast from server: Broadcast page changes to specific connected clients.
  • Error tracking: Show and hide user specific errors on the page by simply returning an error or nil.
  • Development live reload: HTML pages reload automatically on edits if development mode is enabled

Usage

Examples

How it works

CLI

You don't need this to get started but the the cli can be used to generate a simple quickstart boilerplate:

go
go run github.com/livefir/cli gen project -n quickstart // generates a folder named quickstart
cd quickstart
go run main.go
open localhost:9867

go run github.com/livefir/cli gen route -n index // generates a new route

Community

  • https://blog.logrocket.com/building-reactive-web-app-go-fir/

    • Building a web application in Go with Fir | Part 1| youtube.com
  • https://bsky.app/profile/hrbrmstr.dev/post/3kk2f5eqxyk22

    • https://dailydrop.hrbrmstr.dev/2024/01/29/drop-410-2024-01-29-your-real-time-app-stack/

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goalpine-jsenhancementgo-web-frameworkhtml-template

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架