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 db
will start a local Postgres instance in docker- The
db.dockerfile
anddb-schema.sql
have an extremely small/naive test schema setup - Each invocation of
yarn db
will recreate the database withdb-schema.sql
- The
yarn joist-codegen
will regenerate the codegen files after each schema changeyarn seed
will load the./seeds/authorWithSomeBooks.ts
file into the local databaseyarn dev
will start the Next.js server as usual
./entities/
has the Joist entities./entities/codegen/AuthorCodegen.ts
will be overwritten on every change to the db./entities/Author.ts
is where you can add custom methods
./lib/em.ts
exports agetEm
function for server-side code to get anEntityManager
instance.env
is a (for demo only) checked-in with the testDATABASE_URL
for local development./components/table.tsx
shows doing anem.find
in a Next.js page
Maybe look at Bemi for server-side context sharing.