Thanks for the input!
I am aware of the JS exension. In fact, I've tried it before on other projects. However, I'm not a big fan of writing application logic straight in the DB. I want to handle it in my usual development environment with tests, CI/CD, Pull Requests via GitHub and so on.
Nice article! I agree with your sentiments about Supabase. I've been using it for a few weeks on a project, and it has good parts and bad parts. You're right the JS client is fairly worthless for anything but toy projects and is more difficult than just writing native SQL statements, which you can luckily do in Postgres functions.
One comment about doing complex calculations on the server. You don't have to do those in SQL. There's a "PLV8" extension available for Postgres on Supabase that lets you write JS functions. I haven't tried that yet, but sounds like a good option. Or you can write complex functions in PLPGSQL, the native Postgres language (which is pretty ugly IMHO).