🌐
GitHub
github.com › chrishoermann › zod-prisma-types
GitHub - chrishoermann/zod-prisma-types: Generator creates zod types for your prisma models with advanced validation · GitHub
zod-prisma-types is a generator for prisma that generates zod schemas from your prisma models. This includes schemas of models, enums, inputTypes, argTypes, filters and so on. It also provides options to write advanced zod validators directly ...
Starred by 867 users
Forked by 76 users
Languages   TypeScript 99.7% | JavaScript 0.3%
🌐
GitHub
github.com › omar-dulaimi › prisma-zod-generator
GitHub - omar-dulaimi/prisma-zod-generator: Prisma 2+ generator to emit Zod schemas from your Prisma schema · GitHub
Unify Prisma validation, policy guardrails, and developer workflows in a single generator. 🚀 Get PZG Pro – Purchase on GitHub | 📚 Documentation | 🛡️ Drift Guard · Prisma → Zod generator for end-to-end workflows. 🚀 generate validation · 🔐 gate policies ·
Starred by 824 users
Forked by 77 users
Languages   TypeScript 95.2% | JavaScript 3.1% | CSS 1.6% | Shell 0.1%
Discussions

decimal validation
There was an error while loading. Please reload this page More on github.com
🌐 github.com
1
March 21, 2023
[BUG] zod-prisma-types generates CUID validation for CUID2 fields
When using @default(cuid(2)) in Prisma schema, the generated zod schemas incorrectly use .cuid() validator instead of .cuid2(), causing validation errors for CUID2 IDs. More on github.com
🌐 github.com
2
March 10, 2025
Zod validator using Prisma (MySQL) enum
Have you tried this? https://github.com/colinhacks/zod#native-enums More on reddit.com
🌐 r/typescript
5
3
August 25, 2023
How to infere type from Prisma with Zod
Prisma generates very good types for you. In my opinion, it's the main reason to use Prisma in TS projects. It looks like you figured out the solution to your type error the right way; if you're only using the email from the User interface inside the function, just pass that single thing as an argument. That's generally a good pattern, even without Typescript. You might want to do some validation that the email is correctly formatted at some point, ideally before you let a user submit it to be added to your database. More on reddit.com
🌐 r/nextjs
2
4
March 9, 2023
🌐
GitHub
github.com › ciscoheat › prisma-to-zod
GitHub - ciscoheat/prisma-to-zod: Generate Zod validation schemas from a Prisma schema. · GitHub
July 19, 2024 - Generate Zod validation schemas from a Prisma schema. - ciscoheat/prisma-to-zod
Author   ciscoheat
🌐
Omar-dulaimi
omar-dulaimi.github.io › prisma-zod-generator
Prisma Zod Generator
Starter to Enterprise: automate validation, docs, redaction, and drift guard while staying in your Prisma flow. 🚀Get Started✨ Start 14‑day Trial⚙️ConfigurationGitHub ... Built with modern development in mind, featuring everything you need for production-ready applications. ... Auto-generate Zod schemas from your Prisma schema with multiple output modes.
🌐
GitHub
github.com › wladpaiva › zod-prisma-utils
GitHub - wladpaiva/zod-prisma-utils: A Zod schema type validator for Prisma models
A Zod schema type validator for Prisma models. Contribute to wladpaiva/zod-prisma-utils development by creating an account on GitHub.
Author   wladpaiva
🌐
GitHub
github.com › prisma › prisma › discussions › 22058
Advice on implementing custom validation with Prisma Client · prisma/prisma · Discussion #22058
Write Zod schemas for the models that need custom validation to validate email/url/other fields · Create a Prisma Client Extension that uses all of the Zod schemas I've written.
Author   prisma
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › releases
Releases · chrishoermann/zod-prisma-types
Generator creates zod types for your prisma models with advanced validation - chrishoermann/zod-prisma-types
Author   chrishoermann
Find elsewhere
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › discussions › 226
Should custom validators work for Prisma composite types? · chrishoermann/zod-prisma-types · Discussion #226
/// @zod.import(["import { validatePhoneNumber } from '../../../custom/phoneNumberValidation'"]).custom.use(z.string().refine((val) => validatePhoneNumber(val))); role String? isPrimaryContact Boolean @default(false) } Context: OrganizationContact is a composite type, not a model. phoneNumber has a custom validator on it that is importing a custom function and using it to do some validation. Expectation: npx prisma generate would result in the following for phone number: phoneNumber: z.string().refine((val) => validatePhoneNumber(val)).optional().nullable() Reality: npx prisma generate results in the following for phone number ·
Author   chrishoermann
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › issues › 112
decimal validation · Issue #112 · chrishoermann/zod-prisma-types
March 21, 2023 - Would be great to have an easy solution for validation decimal "numbers" without using custom functions. Just like the way numbers are validated ex. /// @zod.decimal.lt(10).gt(1)
Author   chrishoermann
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › issues
Issues · chrishoermann/zod-prisma-types
Generator creates zod types for your prisma models with advanced validation - Issues · chrishoermann/zod-prisma-types
Author   chrishoermann
🌐
GitHub
github.com › topics › prisma-zod-generator
prisma-zod-generator · GitHub Topics · GitHub
A CLI that keeps your Zod schemas in sync with your Prisma models. It generates modular, type-safe validation files automatically, ensuring your database and application logic stay aligned.
🌐
npm
npmjs.com › package › prisma-zod-generator
prisma-zod-generator - npm
Unify Prisma validation, policy guardrails, and developer workflows in a single generator. 🚀 Get PZG Pro – Purchase on GitHub | 📚 Documentation | 🛡️ Drift Guard · Prisma → Zod generator for end-to-end workflows. 🚀 generate validation · 🔐 gate policies ·
      » npm install prisma-zod-generator
    
Published   Feb 14, 2026
Version   2.1.4
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › discussions › 324
Email Validation? · chrishoermann/zod-prisma-types · Discussion #324
model MyModel { myField String /// @zod.string.email({ message: "not a valid e-mail address" }).max(255, { message: "max error" }).[...chain more validators] }
Author   chrishoermann
🌐
GitHub
github.com › multipliedtwice › prisma-generator-express
GitHub - multipliedtwice/prisma-generator-express: This tool automatically generates Express/Fastify CRUD API that uses Prisma to handle database operations and validates responses with Zod schemas to ensure the integrity of input and output. · GitHub
May 11, 2026 - This tool automatically generates Express/Fastify CRUD API that uses Prisma to handle database operations and validates responses with Zod schemas to ensure the integrity of input and output. - mul...
Starred by 28 users
Forked by 6 users
Languages   TypeScript 86.2% | JavaScript 13.8%
🌐
GitHub
github.com › CarterGrimmeisen › zod-prisma
GitHub - CarterGrimmeisen/zod-prisma: A custom prisma generator that creates Zod schemas from your Prisma model. · GitHub
A custom prisma generator that creates Zod schemas from your Prisma model. - CarterGrimmeisen/zod-prisma
Starred by 916 users
Forked by 104 users
Languages   TypeScript
🌐
GitHub
github.com › chrishoermann › zod-prisma-types › issues › 326
[BUG] zod-prisma-types generates CUID validation for CUID2 fields · Issue #326 · chrishoermann/zod-prisma-types
March 10, 2025 - Describe the bug When using @default(cuid(2)) in Prisma schema, the generated zod schemas incorrectly use .cuid() validator instead of .cuid2(), causing validation errors for CUID2 IDs. Reproduction Define a Prisma model with CUID2: mode...
Author   chrishoermann
🌐
GitHub
github.com › innei-template › nest-http-prisma-zod
GitHub - innei-template/nest-http-prisma-zod: A best practice for NestJS framework with using Prisma + Postgres, Socket.IO, Zod and Vitest
A best practice for using Prisma + Postgres, Socket.IO (Guest or authentication required) and Zod data validation.
Starred by 168 users
Forked by 12 users
Languages   TypeScript 96.1% | Shell 2.8% | JavaScript 1.1% | TypeScript 96.1% | Shell 2.8% | JavaScript 1.1%
🌐
Reddit
reddit.com › r/typescript › zod validator using prisma (mysql) enum
r/typescript on Reddit: Zod validator using Prisma (MySQL) enum
August 25, 2023 -

Hi,

I'm trying to make a zod validator, it should parse data coming from frontend form (im using next.js app router)

here are code snippets:

schema.prisma:

model ProposalOption {
  id                Int                 @id @default(autoincrement())
  name              String              @db.TinyText
  category          OptionCategory
  active            Boolean
}

enum OptionCategory {
  reason
  size
  feature
  additional
}

now based off that schema i would like to create a zod validator, but idk how to define that...

import z from "zod";
import type { OptionCategory } from "@prisma/client";

const options: OptionCategory[] = ["additional", "feature", "reason", "size"];

export const CreateProposalOptionValidator = z.object({
  description: z
    .string()
    .min(5, { message: "Description must have at least 5 characters" })
    .max(100, { message: "Description must have less than 100 characters" }),
  // @ts-expect-error TODO: fix this
  category: z.enum(options),
});

export type ProposalOptionCreateRequest = z.infer<
  typeof CreateProposalOptionValidator
>;

unfortunately category key is atm just a string, not a OptionCategory, therefore on the backend i have a type error

    const body = await req.json();
    const { category, description } = CreateProposalOptionValidator.parse(body);

    await db.proposalOption.create({
      data: {
        // @ts-expect-error
        category,
        description,
      },
    });

Any hints?
Thanks in advance!!