Another thread here mentioned SQLite. Can you say more about why/how you are using postgres.js? I use pocketbase a lot and am curious how your stack handles auth, login, etc?
OK, I need to say more about this code snippet. I'm really fascinated by it.
This is typescript, which is interesting because we have more confidence the JS "works."
But, it is also embedding SQL directly into your typescript.
Isn't that a contradiction in code? I'm NOT suggesting you refactor to use an ORM or something!
When I was an Android developer, I thought it was really fascinating to see how Room worked. Each SQL statement you created was actually compiled and validated at compile time not runtime, and it meant the SQL was sanity checked and sanitized.
Nothing like that is happening here, right? You cannot validate this SQL at compile/build time? If not, aren't you YOLO riding the motorcycle but telling mom you are wearing your helmet?
> Nothing like that is happening here, right? You cannot validate this SQL at compile/build time? If not, aren't you YOLO riding the motorcycle but telling mom you are wearing your helmet?
Correct! It's a total pain haha.
I loathe SQL, but it's the best tool for most modern web apps.
All of flashcasts.com is 1800 lines. I'd guess 30% is HTML and 30% is SQL.
The SQL does the vast majority of the heavy lifting if you think about moving bits over distances.
So SQL is really important, but why don't I have any safeguards? Well, in my experience, the available safeguards are medicine more painful than the poison.
For example, any of the queries in my app I can copy-and-paste into psql and start an interactive debugging session. Can't do that with ORMs.
In my app, I dynamically aggregate and build all the podcast XML for every feed in a single Postgres query. It's super performant and surprisingly little SQL. Can't imagine doing that through an ORM.
SQL queries will throw an error if they're not well formatted, so you just have to write a test suite that somehow hits every query exactly once. You can do this by separating out your SQL, or integration tests, or a handful of other methods, none of which are pleasant.
Anyway, I'm tired of SQL, sol I'm working on an embedded query language in scrapscript. Stay tuned for details:
I also use postgres.js a lot, but most of the time I don't even bother with the typescript. If you develop using the JetBrain suite then you can have really good support for sql embedded in strings, it is aware of your schema and does syntax highlighting.
Ha, Taylor, of course this is you doing cool things in cool outfits. I should have known. Thanks!
My favorite truth in that site: "Anyway, instead of learning biochem and spanish I went and built this stupid website." I don't know what you are talking about at all.
Hono + Postgres.js is getting pretty close to my ideal web stack.
IMO, SSR websites is the best way to get projects out quickly: predictable "builds", minimal surface area, boring tech, etc.
It helps that Hono has a very clean API :)