NestJS
docs.nestjs.com › pipes
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP ...
GitHub
github.com › BenLorantfy › nestjs-zod
GitHub - BenLorantfy/nestjs-zod: All NestJS + Zod utilities you need · GitHub
All NestJS + Zod utilities you need. Contribute to BenLorantfy/nestjs-zod development by creating an account on GitHub.
Starred by 1.1K users
Forked by 110 users
Languages TypeScript 87.2% | JavaScript 12.8%
Develop the @nestjs/zod package to simplify integration between Nest and Zod.
Is there an existing issue that is already proposing this? I have searched the existing issues Is your feature request related to a problem? Please describe it In NestJS, input parameter validation is a crucial aspect. Currently, there a... More on github.com
OpenAPI validation for NestJS with Zod
What's the advantage of this over something like class-validator? More on reddit.com
Reddit
reddit.com › r/nestjs_framework › zod validation
r/Nestjs_framework on Reddit: zod validation
August 13, 2025 -
hey guys, I'm new at nestjs framework and better to know that I'm a front-end developer! would you please let me know how may I use zod schemas as validator in nestjs as well? I have added nestjs-zod's validator as app module provider and converted the schema to dto using createZodDto method of the package although I get any type when I import the exported class that is extended the createZodDto(MY_ZOD_SCHEMA)!
Top answer 1 of 2
4
I highly suggest you read this , has an example on how to make a custom Zod validation pipe in NestJS. That said, i do think that class-validator for NestJS is better, it's officially integrated with NestJS and i don't really see much value in using another one, unless you have a monorepo and you want to share validations between FE and BE
2 of 2
2
You will need to use pipes to validate a class. I would recommended using the recommended class-validation library, you just add decorators to the class, way cleaner. Read the docs!
How to conditionally validate a class-validator DTO based on a Zod schema? Feb 19, 2026
r/Nestjs_framework 5mo ago
Generate GraphQL code-first schema from Zod validation objects! Mar 28, 2023
r/Nestjs_framework 3y ago
Is using zod as the primary source of truth for Typescript types sensible/sustainable? Jan 18, 2023
r/typescript 3y ago
npm
npmjs.com › package › nestjs-zod
nestjs-zod - npm
May 15, 2026 - All NestJS + Zod utilities you need. Latest version: 5.5.0, last published: 2 days ago. Start using nestjs-zod in your project by running `npm i nestjs-zod`. There are 45 other projects in the npm registry using nestjs-zod.
» npm install nestjs-zod
Published Jul 25, 2026
Version 5.5.0
GitHub
github.com › nestjs › nest › issues › 15988
Develop the @nestjs/zod package to simplify integration between Nest and Zod. · Issue #15988 · nestjs/nest
November 28, 2025 - In NestJS, input parameter validation is a crucial aspect. Currently, there are two approaches: one uses class-validator and class-transformer, but both packages are inactive, with no updates for over two years. The other approach is using zod, but it lacks integration with NestJS.
Author nestjs
npm
npmjs.com › package › @anatine › zod-nestjs
@anatine/zod-nestjs - npm
Zod helper methods for NestJS. Latest version: 2.0.12, last published: a year ago. Start using @anatine/zod-nestjs in your project by running `npm i @anatine/zod-nestjs`. There are 11 other projects in the npm registry using @anatine/zod-nestjs.
» npm install @anatine/zod-nestjs
Published Apr 05, 2025
Version 2.0.12
Zod
zod.dev
Intro | Zod
Using Zod, you can define schemas you can use to validate data, from a simple string to a complex nested object.
Medium
rifatcse09.medium.com › why-zod-over-traditional-nestjs-dtos-with-full-implementation-a20b145768a9
Why Zod Over Traditional NestJS DTOs (with Full Implementation) | by Rifat | Medium
March 1, 2026 - // user.controller.ts import { Body, Controller, Post } from "@nestjs/common"; import { CreateUserDto } from "./create-user.dto"; @Controller("users") export class UserController { @Post() create(@Body() dto: CreateUserDto) { return { message: "User created", data: dto }; } } Note: In real apps, you usually enable this globally: app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true })); ... //user.schema.ts import { z } from "zod"; export const createUserSchema = z.object({ email: z.string().email(), password: z.string().min(8), }); export type CreateUserInput = z.infer<typeof createUserSchema>;
DEV Community
dev.to › abdulghofurme › zod-vs-class-validator-class-transformer-3oam
zod vs class-validator & class-transformer - DEV Community
December 28, 2024 - class-validator & class-transformer are the 2 packages most commonly used as validation in NestJS, yes, apart from the fact that the writing method is the same as NestJS using decorator-based, also because it is clean & seamless because it can be used with ValidationPipe as DTO. So, the incoming data/payload received by the controller has been validated and changed/transformed according to its definition. Meanwhile zod still needs to validate the data/payload it receives manually, yes, maybe only 1 or a maximum of 3 lines, but of course, the more validation functions are needed the more manual processes are required.
Medium
medium.com › nestjs-ninja › creating-a-configuration-module-like-a-specialist-with-zod-inside-nestjs-c61430de896b
Creating a configuration module like a specialist with Zod inside NestJS | by Henrique Weiand | NestJS Ninja | Medium
October 10, 2023 - To learn more about ZOD, please check out this link. The method z.infer in this example is what creates the magic of having a type automatically. Next, let’s edit our env.service.ts and here we just need to something like this · import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { Env } from './env';
Stack Overflow
stackoverflow.com › questions › 77096252 › using-global-zodvalidationpipe-nestjs-zod-to-validate-body-that-is-an-array-of
Using global ZodValidationPipe (nestjs-zod) to validate body that is an array of objects? - Stack Overflow
I registered ZodValidationPipe globally within my root nestjs Module per documentation: { provide: APP_PIPE, useClass: ZodValidationPipe, }, and that seems to be generally working - as long as what I'm validating isn't an array.
GitHub
github.com › BenLorantfy › nestjs-zod › issues
Issues · BenLorantfy/nestjs-zod
All NestJS + Zod utilities you need. Contribute to BenLorantfy/nestjs-zod development by creating an account on GitHub.
Author BenLorantfy
DEV Community
dev.to › bbescort-team › security-by-design-with-nestjs-zod-ts-rest-and-custom-in-house-frameworks-488n
Security by Design with NestJS, zod, ts-rest, and Custom In-House Frameworks - DEV Community
September 3, 2025 - Implemented via NestJS Guards and decorators. Principle: Least Privilege – narrow, task-focused scopes. Centralized logging (e.g., ELK / Datadog) with anomaly detection. Alerts on suspicious patterns (login abuse, unusual data exports). We use ts-rest combined with Zod to strictly validate both requests and responses.
Medium
medium.com › @priyansu011 › level-up-your-nestjs-dtos-input-validation-and-serialization-with-zod-e990ab8420a7
Level-Up Your NestJS DTOs: Input Validation and Serialization with Zod | by Priyanshu Rajput | Medium
September 25, 2025 - NestJS ships with powerful decorators like @IsString() and @IsNotEmpty() (via class-validator). They work well for most cases—but if you’ve ever wished for: ... In this post, I’ll walk you through replacing the classic class-validator DTO with a Zod schema, show how to integrate it in a NestJS service, and explain why Zod can simplify your entire validation story.
Reddit
reddit.com › r/nestjs › openapi validation for nestjs with zod
OpenAPI validation for NestJS with Zod : r/nestjs
December 30, 2025 - Probably Notting. Great if you like Zod things or maybe want to copy same schemas for frontend ... Thats pretty nice, I have been experimenting with using nestjs-zod, but this seems maybe more efficient.