@pixeldrive/prisma-zod-generator
v2.1.4
Published
Prisma 2+ generator to emit Zod schemas from your Prisma schema
Maintainers
Readme
@pixeldrive/prisma-zod-generator
Fork notice: This is a fork of omar-dulaimi/prisma-zod-generator. The original project is maintained by Omar Dulaimi and published as
prisma-zod-generatoron npm.
Automatically generate Zod validation schemas from your Prisma schema.
Installation
npm install -D @pixeldrive/prisma-zod-generatorQuick Start
Add the generator to your schema.prisma:
generator zod {
provider = "prisma-zod-generator"
}Then run:
npx prisma generateZod schemas will be generated in ./generated/schemas/ (configurable via the output option).
Configuration
Create a config.json file and reference it from your schema:
generator zod {
provider = "prisma-zod-generator"
config = "./config.json"
}{
"mode": "full"
}For autocomplete and validation in your editor, point to the bundled JSON Schema:
{
"$schema": "../node_modules/@pixeldrive/prisma-zod-generator/lib/config/schema.json",
"mode": "full"
}Features
- Schema Generation – Minimal, Full, and Custom modes; Schema Variants (input, result, pure models)
- Customization – Naming patterns, file structure control, selective generation, per-model config
- Type Safety – Zod v4 string formats, strict mode, full TypeScript integration
- Multi-Provider – SQLite, PostgreSQL, MySQL, MongoDB, SQL Server
- Barrel Exports –
enums/index.tsandobjects/index.tsbarrel files generated automatically
Contributing
PRs are welcome. Keep diffs focused and add tests for behaviour changes.
License
MIT © Omar Dulaimi
