September 28th, 2024

Show HN: htmgo - build simple and scalable systems with golang + htmx

htmgo, in alpha release, enables interactive web application development using Go and htmx. It features single binary deployment, live reload, automatic page registration, Tailwind CSS support, and a plugin architecture.

Read original articleLink Icon
FrustrationExcitementAppreciation
Show HN: htmgo - build simple and scalable systems with golang + htmx

htmgo is currently in its alpha release phase, designed to facilitate the development of interactive websites and web applications using Go and htmx. This framework allows developers to create fast and simple web applications without the need for JavaScript, as it combines the efficiency of Go with the hypermedia capabilities of htmx. The applications built with htmgo are compiled into a single deployable binary, simplifying deployment. Key features include live reload functionality, which automatically rebuilds CSS, Go code, and routes upon changes, as well as automatic registration of pages and partials based on file paths. htmgo also supports Tailwind CSS out of the box, eliminating the need for additional configuration. Furthermore, it offers a plugin architecture for integrating optional plugins, such as those from entgo.io, and includes custom htmx extensions to minimize boilerplate code for common tasks.

- htmgo is in alpha release, focusing on building interactive web applications with Go and htmx.

- It compiles applications into a single deployable binary, enhancing deployment simplicity.

- Key features include live reload, automatic page registration, and built-in Tailwind CSS support.

- The framework supports a plugin architecture for optional enhancements and custom htmx extensions to reduce boilerplate.

Related

78MB Hugo binary is full of paths and URLs

78MB Hugo binary is full of paths and URLs

Hugo, a fast and flexible static site generator written in Go, offers advanced templating and quick site rendering. Installation options include prebuilt binaries, package managers, and repositories. The extended edition provides additional features. Documentation covers various aspects, and users are encouraged to seek support on the community forum. Contributions involve diverse tasks with detailed guidelines available.

Show HN: Gothem stack – An Htmx and templ template

Show HN: Gothem stack – An Htmx and templ template

The "gothem-stack" GitHub project is a flexible template using Go, Templ, HTMX, Echo, and Mage. It supports TailwindCSS, DaisyUI, and Alpine.js, aiding quick setup and various functionalities. Persistence relies on Postgres and sqlc.

From React to Htmx on a real-world SaaS product (2022) [video]

From React to Htmx on a real-world SaaS product (2022) [video]

David Guillo shares his experience replacing React with htmx in a SAS product, highlighting htmx's advantages for creating rich user interfaces without JavaScript frameworks, emphasizing accessibility and ease of use.

HMPL – template language for displaying UI from server to client

HMPL – template language for displaying UI from server to client

hmpl is a lightweight server-side template language that generates HTML, reducing JavaScript size and improving loading speeds for SPAs. It supports loading indicators, error handling, and offers various installation options.

Htmx, Raku and Pico CSS

Htmx, Raku and Pico CSS

The author simplifies web development using HTMX, Raku, and Pico CSS, emphasizing semantic HTML and dynamic content creation without JavaScript, while working on a project to rebuild HTMX examples.

AI: What people are saying
The comments on the htmgo article reflect a mix of enthusiasm and skepticism regarding the project and its approach to web development.
  • Some users appreciate the combination of Go and HTMX, highlighting its potential for building web applications without relying heavily on JavaScript.
  • Critics express concerns about the complexity and limitations of using a DSL for HTML generation, preferring more traditional methods.
  • There is a call for more open-source templates and components that are not tied to specific licensing restrictions.
  • Several commenters mention the need for features like live reload and integration with existing frameworks to enhance developer experience.
  • Overall, there is a recognition of the evolving landscape of web development tools, with some questioning whether new approaches can truly replace established standards like HTML.
Link Icon 23 comments
By @novoreorx - 7 months
Welp, another fasthtml project. I still don't understand the idea of reinventing HTML in another language. It's too restrictive and will never be as compatible as JSX.

Don't get me wrong, I love HTMX, I just don't want to write DSL to generate HTML. IMO a backend language should integrate HTMX similar to how https://hotwired.dev/ works.

By @2024user - 7 months
Without touching JavaScript but now you have to type

return h.NewPage( h.Div( h.Class("flex gap-2"), h.TextF("the current time is %s", now.String()) ) )

To me that is horrible.

By @anonzzzies - 7 months
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 'pay to a for all the useful components and templates'; not because I don't want to pay, but because of the licensing; we reuse all things internally, so 1-site license etc are just not options) html/tailwind, htmx, htmgo, clog etc templates with components.

edit: typo

By @breadchris - 7 months
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/frameworks go is easy to parse and transpile!

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't perfect, but the full language spec is implemented.

My personal goal is to build the Go equivalent of rails/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]

[1] https://github.com/breadchris/share/blob/master/html2/html.g... [2] https://github.com/traefik/yaegi [3] https://github.com/breadchris/share/blob/master/graph/build....

By @DLA - 7 months
This is useful! Love the Go & HTMX combination and use it often. Good documentation too for an alpha release. Nice work.
By @tanduv - 7 months
The example TODO app doesn't seem to be doing so well https://todo-example.htmgo.dev/
By @OccamsMirror - 7 months
htmx + Templ (https://templ.guide/) is something I'm really enjoying as a replacement for React in my personal projects.
By @winrid - 7 months
Reminds me of https://j2html.com

Which I have also been starting to use for one project, with quarkus, been a nice experience so far.

By @smallerfish - 7 months
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't a great fit for. I built a framework for my own use that has typesafe routing & SQL. It's a thing of beauty.
By @sublinear - 7 months
"Scalable", but does it scale in terms of business requirements typical of web projects?
By @jasonlotito - 7 months
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!

I’m mean fine have fun with your libraries but the amount of excitement for something like this? Amazing.

By @pmdfgy - 7 months
I'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's so rare nowadays that it deserves it.
By @65 - 7 months
Has there ever been a widely used open source project for writing HTML as functions inside of another language? (JSX and PHP don't count - you're still writing the HTML markup).
By @jmole - 7 months
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.
By @anonzzzies - 7 months
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.

[0] https://github.com/canopyclimate/golive

By @politician - 7 months
Template functions are a better approach, IMO.

[1] https://templ.guide/

By @TripleChecker - 7 months
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?

There were a few typos in the docs page: https://triplechecker.com/s/D32t6y/htmgo.dev?v=HrUfl

By @ilrwbwrkhv - 7 months
Beautiful! I don't use Go anymore (moved to Rust) but this looks pristine.
By @ocean_moist - 7 months
Backend devs rejoice as they can now build dashboards without leaving go.
By @seumars - 7 months
How is htmx low level?
By @Terretta - 7 months
“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.”

Hand-coding HTML is three decades in, like using computer languages from the 1970s in the 2000s.

There are so many of these experiments the last few years, could any be what replaces HTML5?

If not, why not? What would be enough better? Most likely not just another form of the same.

By @bugsense - 7 months
Fresh air