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: htmgo - build simple and scalable systems with golang + htmx

166 pointsby maddalax8 months ago
Hey all, I just wanted to share a project I&#x27;ve been working on for the past month.<p>After years of heavy frameworks, I really like the idea of using htmx, but it’s a little too low level for me and needs a thin layer above it to facilitate things like components, better syntax with complex JS inside of an attribute, etc<p>To try and solve this problem with a very minimal stack (golang + htmx) that I&#x27;ve been really enjoying, I&#x27;m building this project to cater to my needs and was thinking it would be useful for other developers.

22 comments

novoreorx8 months ago
Welp, another fasthtml project. I still don&#x27;t understand the idea of reinventing HTML in another language. It&#x27;s too restrictive and will never be as compatible as JSX.<p>Don&#x27;t get me wrong, I love HTMX, I just don&#x27;t want to write DSL to generate HTML. IMO a backend language should integrate HTMX similar to how <a href="https:&#x2F;&#x2F;hotwired.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hotwired.dev&#x2F;</a> works.
评论 #41689054 未加载
评论 #41688685 未加载
2024user8 months ago
Without touching JavaScript but now you have to type<p>return h.NewPage( h.Div( h.Class(&quot;flex gap-2&quot;), h.TextF(&quot;the current time is %s&quot;, now.String()) ) )<p>To me that is horrible.
评论 #41686845 未加载
评论 #41687229 未加载
评论 #41687978 未加载
anonzzzies8 months ago
These things are really nice and I enjoy using them very much, but we depend now so much on shadcn and ready made templates on top of that; almost all of those are react (and next). The world needs far more open source (fully, not those &#x27;pay to a for all the useful components and templates&#x27;; not because I don&#x27;t want to pay, but because of the licensing; we reuse all things internally, so 1-site license etc are just not options) html&#x2F;tailwind, htmx, htmgo, clog etc templates with components.<p>edit: typo
评论 #41685304 未加载
breadchris8 months ago
I love this! I have been working on something similar recently [1] and it is exciting to think about the possibility of building full stack components for the web that are not going to break in the foreseeable future. Even if I need to swap languages&#x2F;frameworks go is easy to parse and transpile!<p>I dream of a library like ours to take on the likes of React, and to get there the devex needs to have some key features. Most notably, imo, is live reload. You could use air, but I find it still to be too slow to recompile the entire app. I have had some success so far with yaegi to interpret the go at runtime [2]. It isn&#x27;t perfect, but the full language spec is implemented.<p>My personal goal is to build the Go equivalent of rails&#x2F;django. Live reloading is needed in addition to plugins that provide web app primitives (auth, storage, logging, metrics, etc). Additionally, I think the network effect of React is a powerful value driver, so some easy way to include React in an app is also important. Thankfully evanw has made this trivial with esbuild [3]<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;breadchris&#x2F;share&#x2F;blob&#x2F;master&#x2F;html2&#x2F;html.go">https:&#x2F;&#x2F;github.com&#x2F;breadchris&#x2F;share&#x2F;blob&#x2F;master&#x2F;html2&#x2F;html.g...</a> [2] <a href="https:&#x2F;&#x2F;github.com&#x2F;traefik&#x2F;yaegi">https:&#x2F;&#x2F;github.com&#x2F;traefik&#x2F;yaegi</a> [3] <a href="https:&#x2F;&#x2F;github.com&#x2F;breadchris&#x2F;share&#x2F;blob&#x2F;master&#x2F;graph&#x2F;build.go">https:&#x2F;&#x2F;github.com&#x2F;breadchris&#x2F;share&#x2F;blob&#x2F;master&#x2F;graph&#x2F;build....</a>
评论 #41687486 未加载
评论 #41698690 未加载
评论 #41687628 未加载
DLA8 months ago
This is useful! Love the Go &amp; HTMX combination and use it often. Good documentation too for an alpha release. Nice work.
tanduv8 months ago
The example TODO app doesn&#x27;t seem to be doing so well <a href="https:&#x2F;&#x2F;todo-example.htmgo.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;todo-example.htmgo.dev&#x2F;</a>
评论 #41685170 未加载
OccamsMirror8 months ago
htmx + Templ (<a href="https:&#x2F;&#x2F;templ.guide&#x2F;" rel="nofollow">https:&#x2F;&#x2F;templ.guide&#x2F;</a>) is something I&#x27;m really enjoying as a replacement for React in my personal projects.
评论 #41685095 未加载
winrid8 months ago
Reminds me of <a href="https:&#x2F;&#x2F;j2html.com" rel="nofollow">https:&#x2F;&#x2F;j2html.com</a><p>Which I have also been starting to use for one project, with quarkus, been a nice experience so far.
评论 #41688539 未加载
评论 #41686346 未加载
评论 #41686078 未加载
smallerfish8 months ago
Kotlin is a great fit for this - it has an html dsl library called Kotlinx.html, which works alongside HTMX fantastically. And, you can write a kotlinjs frontend chunk for anything additional you need that HTMX isn&#x27;t a great fit for. I built a framework for my own use that has typesafe routing &amp; SQL. It&#x27;s a thing of beauty.
评论 #41689211 未加载
评论 #41687664 未加载
sublinear8 months ago
&quot;Scalable&quot;, but does it scale in terms of business requirements typical of web projects?
jasonlotito8 months ago
I remember the days when one of the complaints about PHP was people mixing PHP and HTML together. And no, it was mixing PHP and HTML together. That’s it. Don’t try to tack on anything else to the conversation. And we’ve been going back to it for some time now. This doesn’t even map to HTML naturally!<p>I’m mean fine have fun with your libraries but the amount of excitement for something like this? Amazing.
pmdfgy8 months ago
I&#x27;ll defintely give it a try when I can but in the meantime I wanted to congratulate and encourage you for the *simple* and yet very practical website presenting the project. It&#x27;s so rare nowadays that it deserves it.
658 months ago
Has there ever been a widely used open source project for writing HTML as functions inside of another language? (JSX and PHP don&#x27;t count - you&#x27;re still writing the HTML markup).
评论 #41688899 未加载
评论 #41689067 未加载
评论 #41688714 未加载
评论 #41693703 未加载
jmole8 months ago
How do you handle client side interactivity? I’m probably an outlier, but all the JS I write is client side, and I sure wish I had a typed language to use in development.
评论 #41693276 未加载
anonzzzies8 months ago
I find, for a little extra productivity, that liveview [0] even adds a bit more effortless building personally. No plumbing endpoints is great with all written in Go.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;canopyclimate&#x2F;golive">https:&#x2F;&#x2F;github.com&#x2F;canopyclimate&#x2F;golive</a>
评论 #41685785 未加载
评论 #41686555 未加载
politician8 months ago
Template functions are a better approach, IMO.<p>[1] <a href="https:&#x2F;&#x2F;templ.guide&#x2F;" rel="nofollow">https:&#x2F;&#x2F;templ.guide&#x2F;</a>
TripleChecker8 months ago
interesting idea, can it be used with Gin or any other Go web framework - or is that not just the html templating library but a framework on its own?<p>There were a few typos in the docs page: <a href="https:&#x2F;&#x2F;triplechecker.com&#x2F;s&#x2F;D32t6y&#x2F;htmgo.dev?v=HrUfl" rel="nofollow">https:&#x2F;&#x2F;triplechecker.com&#x2F;s&#x2F;D32t6y&#x2F;htmgo.dev?v=HrUfl</a>
评论 #41687574 未加载
ilrwbwrkhv8 months ago
Beautiful! I don&#x27;t use Go anymore (moved to Rust) but this looks pristine.
评论 #41685331 未加载
ocean_moist8 months ago
Backend devs rejoice as they can now build dashboards without leaving go.
seumars8 months ago
How is htmx low level?
评论 #41687276 未加载
Terretta8 months ago
<i>“Letting a hundred flowers blossom and a hundred schools of thought contend is the policy for promoting progress in the arts and the sciences and a flourishing socialist culture in our land.”</i><p>Hand-coding HTML is three decades in, like using computer languages from the 1970s in the 2000s.<p>There are so many of these experiments the last few years, could any be what replaces HTML5?<p>If not, why not? What <i>would</i> be enough better? Most likely not just another form of the same.
bugsense8 months ago
Fresh air