This was originally written for a Remix app, but you could adapt it to work for any SSR framework.
Check the docs for these packages to learn how to use these snippets
https://www.npmjs.com/package/kysely-migration-cli https://www.npmjs.com/package/kysely-codegen https://www.npmjs.com/package/kysely#migrations
It's configured to use MySQL on Planetscale, but you could adjust it to use Postgres or SQLite if you want.