I'll just quickly plug Kanel (https://github.com/kristiandupont/kanel) which I use to generate Typescript types from a Postgres database. I agree with the author to think migrations-first, though I prefer to write them in SQL to ensure I can utilize all the powerful features that Postgres has to offer.
With it, I only get types for the tables and views etc., so any join will be untyped if done client-side. This is still a big win in my opinion, and I much prefer it to normal ORM's.
That's interesting. I use Knex a lot and I agree that it's very easy to end up just writing what is basically an ORM on the spot. I haven't quite decided if I think it's a real problem though.
I created and use Kanel (https://github.com/kristiandupont/kanel) to generate Typescript types from my Postgres database which helps a lot. Knex itself has some attempt at type safety but it gets confused quite quickly, so that's where it's tempting to override things.
We are using Kanel[1] for this right now — is there an advantage to using this instead?
I generate Typescript types from my database (https://github.com/kristiandupont/kanel) which gives me type safety on back- and frontend without relying on an ORM. I am curious about Prisma but I don't see any advantage to it from my quick skimming.
You might also want to check Kanel out! https://github.com/kristiandupont/kanel