Stop manually stripping Prisma inputs. Generate Zod schemas & guard your DB automatically.
Prisma Guard is a new tool designed to enhance the Prisma ORM by automating input validation and sanitization. It generates Zod schemas from Prisma models, allowing for robust type safety and runtime protection against unknown fields. This tool aims to streamline the development process by eliminating the need for manual input handling in API requests.
- ▪Prisma Guard automatically transforms Prisma models into Zod schemas for validation.
- ▪It offers two modes: runtime protection to silently strip unknown fields and full validation with schema generation.
- ▪The tool generates dual schemas for public API requests and internal database operations.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3942119) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } explita Posted on May 22 Stop manually stripping Prisma inputs. Generate Zod schemas & guard your DB automatically. #prisma #typescript #zod #node If you use Prisma, you already know it's a fantastic ORM with excellent developer experience. But there's a common friction point almost all of us hit when building real-world APIs: input validation and sanitization. Prisma is strict.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).