Discover and explore top open-source AI tools and projects—updated daily.
omar-dulaimiGenerate Zod schemas from Prisma schema definitions
Top 46.7% on SourcePulse
This project provides a Prisma 2+ generator that automatically creates Zod schemas from your Prisma schema. It aims to offer zero-boilerplate validation and typed data for your models, benefiting developers who use Prisma and Zod for data validation and type safety in their applications.
How It Works
The generator transforms your Prisma schema definitions into corresponding Zod schemas. It offers multiple generation modes: "Full Mode" for a complete ecosystem of CRUD operations, input/result schemas, and enums; "Minimal Mode" for essential CRUD operations with lean output; and "Custom Mode" for granular control and selective generation based on user-defined rules. This approach ensures consistent, type-safe validation across your application without manual schema creation.
Quick Start & Requirements
npx prisma init), Zod installed (runtime dependency).npm i -D prisma-zod-generatorpnpm add -D prisma-zod-generatoryarn add -D prisma-zod-generatorbun add -d prisma-zod-generatorschema.prisma:
generator zod {
    provider = "prisma-zod-generator"
}
npx prisma generate.import { UserSchema } from './prisma/generated/schemas';) and use Zod's safeParse for validation.Highlighted Details
@zod comments for enhanced parsing, JSON schema generation, and fixes for circular dependencies.Maintenance & Community
The project encourages contributions via Pull Requests and discusses larger changes in issues. Sponsorship is welcomed to support maintenance and new features via GitHub Sponsors.
Licensing & Compatibility
The project is licensed under the MIT license. This license is permissive and generally compatible with commercial use and closed-source applications.
Limitations & Caveats
The provided README does not explicitly mention any limitations, alpha status, known bugs, or deprecations. The project appears to be actively maintained with a clear feature set.
3 days ago
Inactive
dzhng
Unstructured-IO