Live data from Hacker News

How I use HTMX with Go

alexedwards.net

11–20 of 121 posts

Re: How I use HTMX with Go

#11
post #4

Love Go + HTMX. I pair it with a-h/templ for a bit more type safety on the template, components and partials. I just shared my whole toolkit too [1], I call it the "GUS stack" -- Go, Unix, SQLite. Inspired heavily by the exe.dev "GUTS" stack [2] but with HTMX instead of Typescript. Some other Go components in the kit... - cockroachdb/errors for errors with stack traces - templ for type-safe HTML templates (with htmx…

Could rebrand to the HUGS stack -- HTMX (or hypertext), Unix, Go, SQLite

Re: How I use HTMX with Go

#12
We use this[1] little package, which enables chaining together HTMX responses that can be based on an HTML template file, an HTML raw string, or plain text. All but the first being OOB targets. Real example:

  return htmx.Write(w,

    &htmx.Template{
      FS:       htmx.FS(ui.HTMX, "parts"),
      Filename: "arrows.html",
      Fields:   []any{thread, up},
    },

    &htmx.Component{
      HTML: `
        {{$count}} points`,
      Fields: []any{count, thread},
    },

  )
[1] https://github.com/cattlecloud/webtools/tree/main/htmx

Re: How I use HTMX with Go

#13
I wrote a framework for my own use that uses Kotlin + HTMX - https://github.com/reubenfirmin/zoned. The goal was to see if I could create webapps that were fully typed, end to end. It uses Kotlinx.html, which provides a jsx-ish dsl for writing html.

I did the first 90% by hand, and have done the last 10% (and README) with Claude, just to get it out there.

Re: How I use HTMX with Go

#16
post #4

Love Go + HTMX. I pair it with a-h/templ for a bit more type safety on the template, components and partials. I just shared my whole toolkit too [1], I call it the "GUS stack" -- Go, Unix, SQLite. Inspired heavily by the exe.dev "GUTS" stack [2] but with HTMX instead of Typescript. Some other Go components in the kit... - cockroachdb/errors for errors with stack traces - templ for type-safe HTML templates (with htmx…

I tried to use templ but it felt more frustrating than ergonomic. Like at that point I'd rather just use react (and I hate react). Just sticking with basic std templates + HTMX sprinkling is good enough for my needs.

Re: How I use HTMX with Go

#17
While I love both Go and Alex, my experience with HTMX has always ended up being disappointing.

I think the best way to put it, when I'm working with HTMX it feels like the complexity of the codebase is growing at a 2:1 rate compared to the app itself. I always end up with some weird edge case that I can not come out of without some weird hack.

I get why people dislike Node packages, HTMX feels like it's an overcompensating response to that. But the time you save by not having to wrestle with JSON is tripled when you try to make the app actually look or feel good. It takes me 2 minutes to slap together a Mantine template [1] and tap into some of the best UI components, then I can embed the built static assets and end up with the same single Go binary.

[1] https://github.com/mantinedev/vite-min-template

Re: How I use HTMX with Go

#18

While I love both Go and Alex, my experience with HTMX has always ended up being disappointing. I think the best way to put it, when I'm working with HTMX it feels like the complexity of the codebase is growing at a 2:1 rate compared to the app itself. I always end up with some weird edge case that I can not come out of without some weird hack. I get why people dislike Node packages, HTMX feels like it's an overcompe…

What's an example of a UI that you built with Mantine that you couldn't with htmx?

Re: How I use HTMX with Go

#19
post #4

Love Go + HTMX. I pair it with a-h/templ for a bit more type safety on the template, components and partials. I just shared my whole toolkit too [1], I call it the "GUS stack" -- Go, Unix, SQLite. Inspired heavily by the exe.dev "GUTS" stack [2] but with HTMX instead of Typescript. Some other Go components in the kit... - cockroachdb/errors for errors with stack traces - templ for type-safe HTML templates (with htmx…

Could rebrand to the HUGS stack -- HTMX (or hypertext), Unix, Go, SQLite

I love HUGS a lot too. Currently building a next gen platform using strictly HUGS.
Post reply on HN