Sam Thorogood

December Tech Vibe Check

It's the end of 2023. This isn't a "year in review", just some musings about what's been going on recently.

Read on to find out more about:

Cloud Tech Stack

There's been some cool updates in the way I build projects.

Cloud Run

I bit the bullet and moved this blog over to Cloud Run with all the bells and whistles. This is fine, but I end up paying for a myriad of various services just for what is a relatively simple site.

I pay for:

…yesh. It actually honestly works really well, but it just feels like a lot for a tiny blog. 🤯

Also, it connects directly to my GitHub repository and builds whenever I push. This is đź‘Ś: I previously had the incredibly awkward credential delegation stuff set up so GitHub could deploy on my behalf. (I do need to also trigger regular builds somehow in order to update 'the most popular' posts, but hopefully I make enough changes that I'll regularly see this update anyway.)

By the way, the swap to Cloud Run was largely spurred by App Engine's broken Custom Domains feature which added stupid amounts of latency. Honestly, this was embarassing: I used to work at Google literally on how to make your sites faster, and my own blog was incurring ~100-200ms+ wasted latency for some users.

Anyway, as far as I can tell, this is a failure of Google's internal teams to talk to each other (it's not run by Cloud, oh no) and a bit of legacy around what IPs it uses. So as usual, just use the new shiny because no-one at Google wants to fix, document or care about the broken feature.

Fly.io

I've been hacking with Fly.io lately. It's a really interesting inversion of the traditional big cloud model—you can set up Docker-like VMs which spin up very fast and can be trivially replicated worldwide. (This feels 'hard' to do on traditional cloud providers—Google only vaguely supports this IIRC on Firebase/Cloud Functions.)

Fly's model is that there is no "batteries included".

This is not the fever dream of people who long for fully integrated PaaS, because you have to do a lot yourself. Ironically, one of the clearest use-cases for Fly is something like a fast static blog with low/minimal server part, because you can just blat it worldwide trivially, but your synchronization story becomes complex (or at least still singly-homed).

I even wrote a small library, Hangar, to help develop Fly apps locally, basically helping you emulate the distributed production environment.

Also, I have a longer post about building webapps using long-lived services like this coming soon. đź‘€

GitHub Pages Deploy

I'm now using GitHub to deploy content to GitHub pages for quick/lazy hosting for demos.

I think what's notable here is that I can now build a GitHub Action that deploys directly to GitHub Pages without having to awkwardly push to another branch and/or folder. At least previously, you had to choose a path to serve from, and it was always super weird to have your action commit its artifacts.

For example, I've deployed a hacky project svg-earth. Its build file is here, but you can basically follow the obvious path.

Amusingly, all the examples use frameworks but none just call npm build. Weird.

Vite

I've normalized a bit on using Vite for everything web.

In old times, I wrote dhost, which included cache-busting and module import rewrite support (just for .js). It still gets used a bit when I want to serve build artifacts, but its time is otherwise done.

Sort of related, Santa Tracker, even though I'm not involved anymore, went off without a hitch this year. The way I designed its build system is very Vite-like, and I think even possibly predates it: a local dev serving path that rewrites every file, but a more complex build step. I never productionized it for anyone else, though.

Cloud Libraries

I regularly find myself reusing code from prior projects. And honestly, managing individual packages is a pain. So I've started publishing 'super-packages' that contain things I need, but in a way that makes them reasonably tree-shakable.

thorish (JS/NPM)

I publish thorish for JS. This mostly contains primitives around concurrency (well, JS' concurrency…)—things like work queues that I find myself often recreating.

By the way, I like (although it seems broken/slow at times) the autogenerated docs tsdocs.dev as it's very Go-like and it also means I don't have to bother generating docs myself.

thorgo (Go)

And speaking of Go, I publish thorgo. I've started to work more with context.Context in Go, writing some helpers for that. I've realized that it's really paramount to JS' AbortController/AbortSignal, and it should be used far more often for close/shutdown mechanics for any type of helper—i.e., you only ever have a Join method, and shutdown is entirely based on the passed context.

My Queue type, for instance, allows multiple users to subscribe to a queue of events. There's no channels used here, avoiding oddities with consuming/draining.

Business Stack

After leaving the startup earlier this year, I set up a Pty Ltd in Australia for consulting and services work. I'm building some basic SaaS for developers that may or may not land well, but at least it's something that I want myself.

Wise

I am overwhelmingly impressed with Wise, which let me set up a business banking account with almost zero fuss (and only a one-time $22 payment), and immediately provided me with both a digital and physical (in the mail) debit card.

This is in contrast to traditional banks, which needed umpteen forms of ID brought in-person to an office. And then they still have the gall to charge me $10/mo for a debit card.

To be fair, I think Wise won't and doesn't pay any interest on cash held by the account, but I have reasonably small amounts.

Invoicing

I haven't really found a "simple invoice generator" yet. Yes, I'm aware there's a million out there behind a Google search. No, this isn't the SaaS I'm building—don't worry.

All I've done so far is created a basic template in Google Docs and have edited it every time I've sent a new invoice, before storing the final generated PDF in a Drive folder for posterity (and you know, tax).

Fin

That's all for now. Happy new year, watch this space, etc. 🎉