5 ms·
HTMX is awesome. I've replaced several OSS web apps on my home server with HTMX + Go + PostgreSQL replacements. The results are lightweight, responsive, work gr
by throw2ih020 2mo ago
HTMX is awesome. I've replaced several OSS web apps on my home server with HTMX + Go + PostgreSQL replacements. The results are lightweight, responsive, work great on desktop and mobile alike, all with the absolute minimum complexity required. The codebases are easy to understand and modify, and so far I'm going months between updates (mostly just minor bugfixes for my applications). I fully expec my mature apps will go years if not decades between required upgrades.
- nicpottier 2mo agoAre any of these open source? I've gone down the go/htmx/pg path lightly a few times and I haven't loved the feel of it, but maybe I'm doing it wrong. I think just server side templating just starts feeling icky in go so maybe I'm just missing a good pattern or library.
- gavmor 2mo agoI just started experimenting with GSX and GSXUI https://github.com/gsxhq/gsxui https://github.com/gsxhq/gsxui https://github.com/jackielii/structpages https://github.com/jackielii/structpages is what I might call a framework that GSX sits nicely in. Also one ai haven't tried: Templ. https://github.com/a-h/templ https://github.com/a-h/templ
- throw2ih020 2mo agoI don't want to ID my account but they basically look like: - OpenAPI API spec and using https://github.com/oapi-codegen/oapi-codegen/ https://github.com/oapi-codegen/oapi-codegen/ to generate the types, server interface, and client library - Standard library http package for the API server implementation - Standard library template/html package for generating the dynamic parts of the webpage content - Static web content is embedded within the Go binary (https://pkg.go.dev/embed https://pkg.go.dev/embed) and served through server routes - api served from /api route, htmx webpage served from / - no ORM, mostly using standard library database/sql package for DB transactions, maybe reaching for a query builder library for more complex queries like complex search functionality - Local S3 compatible object store for dynamic binary data like user-uploaded images and video. Local filesystem can be fine for small scale stuff. For my home server I have authn/authz happening at the OS/infra layer, but if you need multitenancy you can pretty easily integrate an OAuth/OpenID authn/authz middleware for login with Google or whatever.
- yawaramin 2mo agoI wrote specifically about this, see https://news.ycombinator.com/item?id=48915935 https://news.ycombinator.com/item?id=48915935
- nasretdinov 2mo ago<please don't take this too seriously> That's great but I believe it's still over-engineered. Unless it's a web site that can tolerate no downtime at all during schema updates, SQLite in WAL2 mode is more than enough. Moreover, in Postgres version upgrades can't be done without significant downtime (or setting up replication and performing a complex dance), so even that isn't so cut and dry. </ ... >
- ffsm8 2mo agoFrom an engineering perspective, sqlite and PostgreSQL are equivalent. The difference is only in the deployment/maintenance. And considering the context he stated, zero downtime really doesn't seem like something he's worrying about.
- sroerick 2mo ago(Me not taking this seriously) I personally find Postgres WAY easier than SQLite simply because of the deployment story. I do a lot of hotfixes and dangerous stuff on personal projects, and having two databases complicates that tremendously. I like being able to run hot code on prod. For the record, this is not the same reason I like postgres for actual production code
- nasretdinov 2mo agoSorry can you please clarify what you mean by having two databases? You can share the same SQLite between applications if you really want
- kelnos 2mo agoI think they mean that they actually do need Postgres for some of their projects, and it's easier to just use Postgres for everything, than to use Postgres for some things and SQLite for others.
- nasretdinov 2mo agoYes, but on the other hand what I'm implying is that you might not actually need it :)
- robertoandred 2mo agoHow does introducing a third layer reduce complexity?
- throw2ih020 2mo agoI'm replacing existing third-party applications which have complex JavaScript frameworks with my "in house" apps using HTMX + mostly just HTML+CSS for most pages and functionality. i.e. I'm not introducing a layer, I'm replacing one. Why not just use html without HTMX you ask? With HTMX I don't have to reload the entire page to navigate, which is especially helpful for making the app responsive even on low bandwidth connections like a bad cell signal.
- robertoandred 2mo agoYou said you added a new Go templating layer.
- yawaramin 2mo agoNo they didn’t…they replaced whatever backend they had before with a Go server, which simplified things overall.
- throw2ih020 2mo agoSorry, I don't follow? I'm just using the templating from Go's standard library. That part replaces existing server-side components of the old applications.