This is a fork of a Vercel Postgres that uses Joist as the ORM.
Disclaimer: I've not actually deployed this to Vercel, I just added a local docker-compose setup to test it locally.
yarn dbwill start a local Postgres instance in docker- The
db.dockerfileanddb-schema.sqlhave an extremely small/naive test schema setup - Each invocation of
yarn dbwill recreate the database withdb-schema.sql
- The
yarn joist-codegenwill regenerate the codegen files after each schema changeyarn seedwill load the./seeds/authorWithSomeBooks.tsfile into the local databaseyarn devwill start the Next.js server as usual
./entities/has the Joist entities./entities/codegen/AuthorCodegen.tswill be overwritten on every change to the db./entities/Author.tsis where you can add custom methods
./lib/em.tsexports agetEmfunction for server-side code to get anEntityManagerinstance.envis a (for demo only) checked-in with the testDATABASE_URLfor local development./components/table.tsxshows doing anem.findin a Next.js page
Maybe look at Bemi for server-side context sharing.