v0.1.5: Integrated Zod Schema Generation
🚀 Major Feature: Integrated Zod Schema Generation
This release introduces a groundbreaking improvement to the Next Prisma Flow generator by integrating zod-prisma-types generation directly within the generator, eliminating the need for external configuration and setup.
✨ What's New
🔧 Self-Contained Zod Generation
- The generator now automatically executes
zod-prisma-typesinternally - Creates local Zod schemas in the
{output}/zod/directory - No more external
zodPrismaImportconfiguration required - Seamless integration with existing Flow templates
📁 Simplified Configuration
Before (v0.1.4):
generator zod {
provider = "zod-prisma-types"
output = "../generated/zod"
}
generator flow {
provider = "./generator.js"
output = "../generated/flow"
zodPrismaImport = "../generated/zod" # ← No longer needed\!
prismaImport = "../lib/db"
models = ["User", "Todo"]
}Now (v0.1.5):
generator flow {
provider = "./generator.js"
output = "../generated/flow"
prismaImport = "../lib/db"
models = ["User", "Todo"]
}🏗️ Enhanced Architecture
- Automatic Schema Generation: Zod schemas are generated first, before Flow templates
- Local Import Paths: All templates now import from local
../zoddirectory - Improved Error Handling: Comprehensive validation and error reporting
- Better Developer Experience: Zero configuration complexity
🔄 Migration Guide
For existing projects, upgrading is simple:
-
Remove external zod generator from your
schema.prisma:- generator zod { - provider = "zod-prisma-types" - output = "../generated/zod" - }
-
Remove zodPrismaImport from Flow generator config:
generator flow { provider = "./generator.js" output = "../generated/flow" - zodPrismaImport = "../generated/zod" prismaImport = "../lib/db" models = ["User", "Todo"] } -
Run generator: Everything else works automatically!
npx prisma generate
🛡️ Technical Improvements
- Added Dependencies:
zod-prisma-typesis now a direct dependency - New Error Classes:
ZodGenerationErrorfor better error handling - Validation System: Ensures all required schemas are generated successfully
- Temporary Schema Handling: Secure creation and cleanup of temporary files
- Path Resolution: Improved relative path handling for nested directories
📦 What Gets Generated
The generator now creates this structure:
generated/flow/
├── zod/ # ← New\! Auto-generated Zod schemas
│ └── index.ts
├── user/
│ ├── actions.ts
│ ├── atoms.ts
│ ├── hooks.ts
│ ├── routes.ts
│ └── types.ts # ← Now imports from ../zod
├── todo/
│ └── ...
└── index.ts
🎯 Benefits
- 🔧 Simplified Setup: No external generator configuration needed
- 🏃♂️ Faster Development: Single command generates everything
- 🛡️ Better Reliability: Eliminates path resolution issues
- 📱 Self-Contained: No external dependencies to manage
- ⚡ Same Performance: All existing features work exactly as before
🧪 Tested & Verified
- ✅ TypeScript compilation
- ✅ Next.js build process
- ✅ All existing templates and imports
- ✅ Error handling and validation
- ✅ Example project integration
💬 Community
This release represents a major step forward in making Next Prisma Flow even more developer-friendly. The integration eliminates common setup pain points while maintaining all the powerful features you love.
Full Changelog: v0.1.4...v0.1.5