Skip to content

omar-dulaimi/prisma-zod-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisma Zod Generator

Prisma → Zod in one generate. Ship validated, typed data everywhere.

npm version downloads CI MIT TypeScript Module formats Docs

Prisma → Zod generator: zero‑boilerplate validation for your models.
✍️ comment rules · ⚡ fast/minimal mode · 🎯 selective filtering · 🔒 strict types

Docs: https://omar-dulaimi.github.io/prisma-zod-generator/

Highlights

  • Zero‑boilerplate Zod schemas generated from your Prisma models
  • Multiple variants for different layers: input, result, and pure models
  • Fast minimal mode and filtering when you only need a subset
  • Type‑safe across ESM/CJS, works great with TypeScript strict

Prerequisites

  • Node.js 18+
  • Prisma installed and initialized (npx prisma init)
  • Zod installed (runtime for generated schemas)

Quick start

  1. Star this repo 🌟

  2. Install

npm i -D prisma-zod-generator
# pnpm: pnpm add -D prisma-zod-generator
# yarn: yarn add -D prisma-zod-generator
# bun:  bun add -d prisma-zod-generator
  1. Add a generator block to your schema.prisma
generator zod {
	provider = "prisma-zod-generator"
}
  1. Generate
npx prisma generate
  1. Import and use
// Default output exports an index; adjust path if you customized output
import { UserSchema } from './prisma/generated/schemas';

// Validate data
const parsed = UserSchema.safeParse({ id: 'clx...', email: '[email protected]' });
if (!parsed.success) console.error(parsed.error.format());

Docs & recipes

Sponsor ❤️

If this saves you time or prevents bugs, please consider sponsoring to support maintenance and new features.

https://github.com/sponsors/omar-dulaimi

Contributing

PRs welcome. Keep diffs focused and discuss larger changes in an issue first. See the test suites for expected behavior and coverage.

License

MIT © Omar Dulaimi

About

Prisma 2+ generator to emit Zod schemas from your Prisma schema

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published