Gsxui – Shadcn-style components for Go
ui.gsxhq.dev
ui.gsxhq.dev
EDIT: highlights are:
- live reload: it only reloads after new binary is built. also has /healthz check integration. I believe this is better than air, wgo etc
- dev panel & error overlay: see generate, build status: on syntax error, you get an error overlay explaining where the error is;
- status for slow builds: if you're working in a big project, you can see the building progress & log in the dev overlay
I don't care to hear arguments about how npm was _configured wrong_.
A tool with insecure defaults, with a long and storied history of being the vector by which data has been exfiltrated and companies hacked, needs to do an awful lot to justify still being used for any infrastructure our team is responsible for.
My big contention with this project is that if I wanted to use node (or npm; or vite) in any capacity, I would have chosen node for that. I don’t want to use those tools in this context because it serves me worse than a well thought out solution.
The thought out solution is to isolate your frontend into its own directory. You can embed and serve that as part of your Go server. That frontend could have been done with react, vite, jsx, whatever typescript nonsense you want; without the Go parts necessarily needing npm or node in the build process.
I literally have toy projects illustrating the idea (this one is a toy I had AI make with some of my own patterns months ago): https://github.com/SamInTheShell/social/tree/main/frontend
Projects like grafana do stuff like this already. It’s a known good pattern.
And why does this depend on node / npx? Something to do with the JSX syntax and parsing?
I wish go std templates were more ergonomic for components.
Past that I wish projects like templ or GSX have a simple go generate pipeline, and support html and text/markdown output including whitespace.
Until then I have a Frankenstein of a bunch of templating.
Also I've been a long time templ & html/template user, also used templui. gsx is born out of my ergonomics desire from templ. gsxui is similar to templui, but makes bundling possible. Also borrowed pipeline filters from html/template. But you're right, this does involve a _build_ step. But I think it's worth it.
Later I'll add the bundler free version. But really, vite has been so useful. Just treat it as another tool.