prisma-package
Central, version-controlled Prisma schema for all Polinate Node services.
By packaging the database model, migrations, generated Prisma client, and trimmed Zod validators as an npm module we guarantee every service runs against the exact same schema version.
What you get
• Prisma schema & migrations – found in src/prisma/
so application databases can migrate to the right version.
• Generated Prisma client – published with the package so most consumers don't have to run prisma generate
.
• Zod validation types – auto-generated then slimmed down by a post-generation script to keep the install footprint small.
• Scripts – src/scripts/trim-zod.ts
executes after prisma generate
(during postinstall
or manual npm run generate
) to prune the huge Zod file to a manageable size.
Intended outcome
- Single source of truth – Design schema changes once, publish a new package version, and upgrade dependants with
npm update
.
- Consistent runtime validation – Services share identical Zod models that match the schema exactly.
- Effortless migrations – Each version ships its own
migrations/
; deployment pipelines can run them in order.
Basic usage in a service
npm i @polinate/prisma # or the name you publish under
export DATABASE_URL="postgres://…"
import { PrismaClient, UserSchema } from '@polinate/prisma';
const prisma = new PrismaClient();
Regenerating locally (optional)
If you need a platform-specific query engine (e.g. on Alpine), run:
npm run generate # inside the package directory (fork)
A fresh client and trimmed Zod bundle will be produced.
Maintained by the Polinate team. Feel free to open issues or submit PRs for schema changes.