top | item 40381366

(no title)

whodev | 1 year ago

When I work on solo projects, my goto is what I've dubbed the HAG stack:

  - HTMX: For client/server interactions. Returning HTML fragments is easy and lightweight.
  - AlpineJs: For interactivity that doesn't require a http request, think toggling sidebars etc...
  - Go: Primary development language, simplistic and easy to get started with. Fast compilation and with embedded files I can ship a single binary for deployment that contains all required assets.
Tertiary and other tools/services I use:

  - Turso (Sqlite): Primary datastore, great to use for a "db per user/tenant" approach."
  - Redis: Sometimes I use redis over turso, depending on need. Also used for caching. I've been moving much more into Turso though, especially with the embedded replica's.
  - Docker: Everything is built into docker images. For my Go app I disable CGO and use Google's "distroless" container images as the base image.
  - Fly.io: Hosting everything.

discuss

order

rsyring|1 year ago

Variation: swap Django for Go for the "batteries included", especially admin interface.

Maybe swap HTMX for Unpoly which is more polished IMO.

0xblinq|1 year ago

+1 for Unpoly.

cookiengineer|1 year ago

I was checking out HTMX the other day but I am not really convinced. There's a lot I like about using HTML to define API calls, but I want to keep the backend free of unnecessary burden (and therefore free of frontend related rendering tasks).

I'm looking for something like HTMX in its methodology, which uses HTML attributes for defining API calls and where the data comes from without having to write additional glue code in JS... but which uses OpenAPI as a schema for serialization/deserialization of data to/from the API endpoints.

Maybe something like that exists which I couldn't find with my Google Fu?

whodev|1 year ago

Too each their own, that's the great thing with programming, you can find what you like/want and use that. As you can probably tell I don't feel it is a burden on the backend. I subscribe to the thought that state is managed on the backend, and the browser is just the users client to view those hypermedia responses provided by the server. Template fragments in Go make it easy to only serve the necessary HTML from my templates, or if it's a full page request I can send the entire page.

I'm not sure of anything like what you described, good luck on the search for it. If you find/develop anything ensure you post an obscene amount of memes on twitter for optimal discoverability by tech influencers.

Fire-Dragon-DoL|1 year ago

This is with server side rendering, right? What do you use to "secure" go?

I'm familiar with go, but I always write JSON apis with it, not SSR.

In rails protect from forgery ensures csrf token is put in there to ensure security and authentication is provided by devise, or omniauth or the framework, but if I wanted to roll my own the framework provides tools to safely compare password hashes to avoid timing attacks. Is there anything similar for Go? I'd love to write my next project with that instead of Rails.

Ideally, I also need an "admin UI" of some sort (activeadmin in rails)