Hey all, I just wanted to share a project I'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've been really enjoying, I'm building this project to cater to my needs and was thinking it would be useful for other developers.
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.<p>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 <a href="https://hotwired.dev/" rel="nofollow">https://hotwired.dev/</a> works.
Without touching JavaScript but now you have to type<p>return h.NewPage(
h.Div(
h.Class("flex gap-2"),
h.TextF("the current time is %s", now.String())
)
)<p>To me that is horrible.
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.<p>edit: typo
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!<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't perfect, but the full language spec is implemented.<p>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]<p>[1] <a href="https://github.com/breadchris/share/blob/master/html2/html.go">https://github.com/breadchris/share/blob/master/html2/html.g...</a>
[2] <a href="https://github.com/traefik/yaegi">https://github.com/traefik/yaegi</a>
[3] <a href="https://github.com/breadchris/share/blob/master/graph/build.go">https://github.com/breadchris/share/blob/master/graph/build....</a>
The example TODO app doesn't seem to be doing so well <a href="https://todo-example.htmgo.dev/" rel="nofollow">https://todo-example.htmgo.dev/</a>
htmx + Templ (<a href="https://templ.guide/" rel="nofollow">https://templ.guide/</a>) is something I'm really enjoying as a replacement for React in my personal projects.
Reminds me of <a href="https://j2html.com" rel="nofollow">https://j2html.com</a><p>Which I have also been starting to use for one project, with quarkus, been a nice experience so far.
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.
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.
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.
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).
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.
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://github.com/canopyclimate/golive">https://github.com/canopyclimate/golive</a>
Template functions are a better approach, IMO.<p>[1] <a href="https://templ.guide/" rel="nofollow">https://templ.guide/</a>
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://triplechecker.com/s/D32t6y/htmgo.dev?v=HrUfl" rel="nofollow">https://triplechecker.com/s/D32t6y/htmgo.dev?v=HrUfl</a>
<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.