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

Unify Prisma validation, policy guardrails, and developer workflows in a single generator.

πŸš€ Get PZG Pro – Purchase on GitHub | πŸ“š Documentation | πŸ›‘οΈ Drift Guard

npm version downloads CI MIT TypeScript Module formats Docs Node.js

Prisma β†’ Zod generator for end-to-end workflows.
πŸš€ generate validation Β· πŸ” gate policies Β· πŸ“š ship docs Β· βš™οΈ automate server actions

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

🌟 All Features (Core + Pro)

Core Features Pro Features

πŸ“‹ Complete Feature Overview

Green = Free (MIT) β€’ Purple/Gold = Pro (Paid)


Prisma Zod Generator feature map (Core vs Pro tiers)

View Mermaid source
graph TB
    classDef coreRoot fill:#1e8449,stroke:#0b5345,stroke-width:4px,color:#fff;
    classDef coreCategory fill:#27ae60,stroke:#145a32,stroke-width:3px,color:#fff;
    classDef coreItem fill:#58d68d,stroke:#196f3d,color:#0b3d1f;
    classDef proRoot fill:#f39c12,stroke:#7d6608,stroke-width:4px,color:#fff;
    classDef proCategory fill:#9b59b6,stroke:#512e5f,stroke-width:3px,color:#fff;
    classDef proItem fill:#bb8fce,stroke:#5b2c6f,color:#2e0f3a;

    subgraph "🎯 CORE FEATURES (Free Forever)"
        PZG[Prisma Zod Generator]

        PZG --> GEN[Schema Generation]
        PZG --> CUSTOM[Customization]
        PZG --> SAFETY[Type Safety]
        PZG --> PERF[Performance]

        GEN --> GEN1["⚑ Minimal Mode"]
        GEN --> GEN2["🌟 Full Mode"]
        GEN --> GEN3["πŸŽ›οΈ Custom Mode"]
        GEN --> GEN4["πŸ“¦ Schema Variants"]
        GEN --> GEN5["πŸ”’ Decimal Handling"]
        GEN --> GEN6["πŸ“… DateTime Support"]

        CUSTOM --> CUST1["🎨 Naming Patterns"]
        CUSTOM --> CUST2["πŸ“‚ File Organization"]
        CUSTOM --> CUST3["🎯 Selective Generation"]
        CUSTOM --> CUST4["πŸ”§ Config Options"]
        CUSTOM --> CUST5["🧰 Multi-Provider Helpers"]

        SAFETY --> SAFE1["βœ… Zod v4 Formats"]
        SAFETY --> SAFE2["πŸ›‘οΈ Strict Mode"]
        SAFETY --> SAFE3["πŸ”’ Type Checking"]
        SAFETY --> SAFE4["πŸ“‹ Validation Suites"]

        PERF --> PERF1["⚑ Fast Output"]
        PERF --> PERF2["πŸ“¦ Tree Shaking"]
        PERF --> PERF3["🎯 Selective Imports"]
        PERF --> PERF4["πŸ“ Granular Emit Control"]
    end

    subgraph "πŸ’Ž PRO FEATURES (Paid Plans)"
        PRO[PZG Pro]

        PRO --> SEC[Security & Governance]
        PRO --> DEV[Developer Experience]
        PRO --> PLAT[Platform & Scale]

        SEC --> SEC1["πŸ›‘οΈ Policies & Redaction"]
        SEC --> SEC2["🚨 Drift Guard"]
        SEC --> SEC3["🐘 PostgreSQL RLS"]
        SEC --> SEC4["πŸ§ͺ Contract Testing"]

        SEC1 --> SEC1A["Role-Based Policies"]
        SEC1 --> SEC1B["Conditional Access"]
        SEC1 --> SEC1C["PII Redaction"]

        SEC2 --> SEC2A["CI Integration"]
        SEC2 --> SEC2B["Breaking Change Alerts"]
        SEC2 --> SEC2C["Auto-Block Enforcement"]

        DEV --> DEV1["⚑ Server Actions Pack"]
        DEV --> DEV2["πŸ“ Form UX Pack"]
        DEV --> DEV3["πŸ“„ API Docs Pack"]
        DEV --> DEV4["🏭 Data Factories"]

        DEV1 --> DEV1A["Next.js Actions"]
        DEV1 --> DEV1B["Type-Safe Handlers"]
        DEV1 --> DEV1C["Error Recovery"]

        PLAT --> PLAT1["πŸ“¦ SDK Publisher"]
        PLAT --> PLAT2["🏒 Multi-Tenant Kit"]
        PLAT --> PLAT3["πŸš€ Performance Pack"]

        PLAT3 --> PLAT3A["Streaming Validation"]
        PLAT3 --> PLAT3B["Chunked Processing"]
        PLAT3 --> PLAT3C["Memory Efficient Pipelines"]
    end

    class PZG coreRoot;
    class GEN,CUSTOM,SAFETY,PERF coreCategory;
    class GEN1,GEN2,GEN3,GEN4,GEN5,GEN6,CUST1,CUST2,CUST3,CUST4,CUST5,SAFE1,SAFE2,SAFE3,SAFE4,PERF1,PERF2,PERF3,PERF4 coreItem;

    class PRO proRoot;
    class SEC,DEV,PLAT proCategory;
    class SEC1,SEC2,SEC3,SEC4,SEC1A,SEC1B,SEC1C,SEC2A,SEC2B,SEC2C,DEV1,DEV2,DEV3,DEV4,DEV1A,DEV1B,DEV1C,PLAT1,PLAT2,PLAT3,PLAT3A,PLAT3B,PLAT3C proItem;
Loading

🎯 Core Features (MIT License - Free Forever)

Schema Generation

  • ⚑ Minimal Mode - Essential CRUD only
  • 🌟 Full Mode - Complete ecosystem
  • πŸŽ›οΈ Custom Mode - Granular control
  • πŸ“¦ Schema Variants - Input, result, pure models
  • πŸ”’ Decimal Handling - BigInt & Decimal support
  • πŸ“… DateTime Support - ISO formats & Zod v4

Customization

  • 🎨 Naming Patterns - Custom schema names
  • πŸ“‚ Organization - File structure control
  • 🎯 Selective Generation - Filter what gets generated
  • πŸ”§ Config Options - Extensive configuration
  • 🧰 Multi-Provider Helpers - Ready-made presets for each datasource

Type Safety

  • βœ… Zod v4 Formats - ISO string methods (.iso.date(), .iso.datetime(), etc.)
  • πŸ›‘οΈ Strict Mode - Enforce type correctness
  • πŸ”’ Type Checking - Full TypeScript integration
  • πŸ“‹ Validation - Runtime type validation

Performance

  • ⚑ Fast Output - Optimized generation
  • πŸ“¦ Tree Shaking - Remove unused code
  • 🎯 Selective Imports - Import only what you need
  • πŸ“ Granular Emit Control - Precise directory + preset outputs

πŸ’Ž Pro Features (Paid Plans)

Security & Governance

  • πŸ›‘οΈ Policies & Redaction (Professional+) - Role-based policies, conditional access, PII protection
  • 🚨 Drift Guard (Professional+) - Breaking change detection, CI integration
  • 🐘 PostgreSQL RLS (Professional+) - Row-level security, tenant isolation
  • πŸ§ͺ Contract Testing (Business+) - Pact.js integration, consumer-driven contracts

Developer Experience

  • ⚑ Server Actions Pack (Starter+) - Next.js typed server actions
  • πŸ“ Form UX Pack (Starter+) - React Hook Form + UI library integration
  • πŸ“„ API Docs Pack (Business+) - OpenAPI v3, Swagger UI generation
  • 🏭 Data Factories (Business+) - Test data generation

Platform & Scale

  • πŸ“¦ SDK Publisher (Professional+) - Generate typed client SDKs
  • 🏒 Multi-Tenant Kit (Enterprise) - Tenant isolation, context management
  • πŸš€ Performance Pack (Professional+) - Streaming validation, chunked processing, memory efficient


πŸ“– Quick Start

⭐️ Tip: Star the repo to keep track of new generators, recipes, and fixes.

# Install
npm install -D prisma-zod-generator

# Add to schema.prisma
generator zod {
  provider = "prisma-zod-generator"
}

# Generate
npx prisma generate

🧠 Config IntelliSense

Point your config file at the published JSON Schema to get autocomplete, hover docs, and validation errors in any JSON-aware editor:

{
  "$schema": "../node_modules/prisma-zod-generator/lib/config/schema.json",
  "mode": "full"
}

Use a relative path that matches your repo layout (for example ./node_modules/...). See the JSON Schema IntelliSense guide for monorepo examples, CI validation scripts, and tips on shipping the schema with custom tooling.

πŸ’‘ Usage Examples

  • See the full documentation for detailed guides, upgrade notes, and feature walkthroughs.
  • Browse recipes/ for copy-paste presets, CI snippets, and integration templates that match your stack.
  • Share llms.txt with AI copilots for an on-ramp to the architecture, commands, and conventions.

❀️ Sponsor Development

If Prisma Zod Generator saves you time or catches bugs before production, consider sponsoring to fund maintenance and new feature work.

  • On GitHub Sponsors, switch to the One-time tab (second tab) to see the PZG plan tiers. Pick the yearly tiers labeled PZG Starter, PZG Professional, PZG Business, or PZG Enterprise to unlock the corresponding Pro licensesβ€”monthly β€œsupport” tiers (e.g., Pro (Individual)) in the Monthly tab do not include PZG Pro.

GitHub Sponsors One-time tab showing PZG yearly tiers
Open the One-time tab to see the Prisma Zod Generator Starter, Professional, and Business tiers.

- Become a sponsor: https://github.com/sponsors/omar-dulaimi

🀝 Contributing

PRs are welcome! Keep diffs focused, open an issue before large refactors, and lean on the test suites for expected behavior and coverage.

πŸ–ΌοΈ Updating Diagrams

When you edit Mermaid blocks in this README, run pnpm render:diagrams afterwards. The script refreshes the SVG fallbacks in docs/assets/diagrams/ so diagrams render correctly on npm and GitHub Mobile.

πŸ“„ License

MIT Β© Omar Dulaimi

Core features: MIT licensed, free forever
Pro features: Commercial license, see pricing

About

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

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-PRO.md

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Contributors 24