🌐
npm
npmjs.com › package › nestjs-zod
nestjs-zod - npm
May 15, 2026 - Providing a schema for ZodValidationPipe to validate incoming client data against · Providing a compile-time typescript type from the Zod schema · Providing an OpenAPI schema when using nestjs/swagger
      » npm install nestjs-zod
    
Published   Jul 25, 2026
Version   5.5.0
🌐
Medium
medium.com › @juliojordan › nestjs-and-zod-eff1e3892c05
NestJS and Zod. Save you from the decorator hell by… | by Julio Jordan | Medium
October 14, 2023 - Keeping the validation of the request ... This is what I mean by decorator hell. Zod is a friendly alternative to the class-validator library for validating the request body....
Discussions

typescript - How to create custom validation pipe for NestJs that will use Zod as validator - Stack Overflow
I want to build a custom validator for NestJs (using v10) that will allow doing following Use Zod schema to validate Allows Creation of Dto from Zod Schema Works with File Upload (Nest's built-in More on stackoverflow.com
🌐 stackoverflow.com
Using global ZodValidationPipe (nestjs-zod) to validate body that is an array of objects? - Stack Overflow
I would very much like to make use of the fact that I have global ZodValidationPipe set up so that I don't have to do double work every time, e.g. this works but that means explicitly instantiating and defining the validation with a schema, where it could be inferred from the body's assigned ... More on stackoverflow.com
🌐 stackoverflow.com
OpenAPI validation for NestJS with Zod
What's the advantage of this over something like class-validator? More on reddit.com
🌐 r/nestjs
6
17
December 30, 2025
OpenAPI validation for NestJS with Zod
A more mature library already exists for this: https://www.npmjs.com/package/nestjs-zod I use this on a monorepo, export zod schemas as a sharable package for native-apps. Consume them in the same way for the web apps on the repo. Really nice to use, really types end-to-end. More on reddit.com
🌐 r/nestjs
1
14
May 3, 2026
🌐
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)!

🌐
GitHub
github.com › BenLorantfy › nestjs-zod
GitHub - BenLorantfy/nestjs-zod: All NestJS + Zod utilities you need · GitHub
Providing a schema for ZodValidationPipe to validate incoming client data against · Providing a compile-time typescript type from the Zod schema · Providing an OpenAPI schema when using nestjs/swagger
Starred by 1.1K users
Forked by 110 users
Languages   TypeScript 87.2% | JavaScript 12.8%
🌐
Medium
medium.com › @bhagyarana80 › why-i-use-zod-with-nestjs-for-bulletproof-validation-49582f2aef1e
Why I Use Zod with NestJS for Bulletproof Validation | by Bhagya Rana | Medium
August 11, 2025 - Writing custom validations or complex rules can quickly become verbose. Sometimes error messages are inconsistent or not very descriptive. Zod is a TypeScript-first schema validation library designed with developer experience in mind.
🌐
Stack Overflow
stackoverflow.com › questions › 76741530 › how-to-create-custom-validation-pipe-for-nestjs-that-will-use-zod-as-validator
typescript - How to create custom validation pipe for NestJs that will use Zod as validator - Stack Overflow
// create-feed.dto.ts import { z } from 'zod'; import { ZodDtoClass } from '../../utils/zod-dto.interface'; const schema = z .object({ title: z.string().min(5).max(35).nullish(), body: z.string().max(140).nullish(), }) .refine( (d) => { return !!(d.title || d.body); }, { path: ['title'], message: "Title, Body and attachment can't be empty at the same time", }, ); export class CreateFeedDto extends ZodDtoClass<typeof schema> { static override schema = schema; } ... @UseInterceptors(FileInterceptor('attachment')) @Post('/create') create( @Body() createFeedDto: CreateFeedDto, @UploadedFile( new ParseFilePipe({ validators: [ new MaxFileSizeValidator({ maxSize: 5000000 }), new FileTypeValidator({ fileType: '(jpg|png)$' }), ], }), ) attachment: Express.Multer.File, ) { console.log({ createFeedDto: createFeedDto, attachment, }); return this.feedsService.create(createFeedDto); }
🌐
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.
🌐
YouTube
youtube.com › watch
Zod + NestJS | Validation, Types & Swagger - YouTube
Learn how to integrate Zod with NestJS to handle validation, TypeScript types, and Swagger documentation — all from a single schema definition.We build a ful...
Published   February 15, 2026
🌐
YouTube
youtube.com › sakura dev
NestJs Full Course 2024 -2: Validation In NestJs (ZOD Included) - YouTube
This video is part two of a NestJS full course and covers validation in NestJS applications, including using Zod.Here are the key points covered in the video...
Published   June 17, 2024
Views   2K
Find elsewhere
🌐
Omiid
omiid.me › notebook › 38 › validating-nestjs-env-vars-with-zod
Validating NestJS env vars with Zod
May 2, 2026 - Use NestJS's ConfigModule to load and validate env vars. Register a validate function to ensure env vars are correct. Use Zod to format and validate env vars.
🌐
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.
🌐
Reddit
reddit.com › r/nestjs › openapi validation for nestjs with zod
r/nestjs on Reddit: OpenAPI validation for NestJS with Zod
May 3, 2026 -

tl;dr it basically uses typescript inference to automatically generate your class validation (no extra decorators)

If you use OpenAPI automatic generation in NestJS, for a standard project, you'd often have to define a property three times:

  1. TypeScript: id: number;

  2. Validation: IsInt()

  3. Documentation: ApiProperty()

And for class-validator and swagger, you often need more than 1 decorator each.

With this lib, for most properties, just the TypeScript definition is enough. You don't need any decorator, it's completely automatic.

🌐
Delightfulengineering
delightfulengineering.com › blog › nest-websockets › pipes-and-validation
Nest JS Websockets - Pipes and E2E Validation with Zod
December 10, 2022 - Use our free whiteboarding app → · Delightful Engineering · BlogStarter Kits · All Posts · Published on · December 7, 2024 · Pointer Events · web-apis · Ditch mouse and touch events for good with pointer events
🌐
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.
🌐
HackMD
hackmd.io › UVRGb-LoQPK7a2Obls_iAw
Deep Dive: NestJS + Zod Integration Architecture - HackMD
Execute Zod validation const validatedData = paramType.schema.parse(requestBody); // validatedData = { name: "John", email: "john@example.com", age: 25 } // 5. Pass to controller method controller.createUser(validatedData); } ``` ### Why Class Wrapper is Needed #### Technical Limitations 1. **reflect-metadata requirement**: Can only read type info from class constructors 2. **NestJS decorator system**: Expects parameters to be classes, not schema objects 3.
🌐
GitHub
github.com › nestjs › nest › issues › 10974
Zod first class support · Issue #10974 · nestjs/nest
January 28, 2023 - Zod for DTOs leaves class-validator in the dust. Zod can validate for http requests much more powerfully than class-validator. It can also infer an exact type for a DTO. You will not worry about having to mark optional DTO properties with ?
Author   nestjs
🌐
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 ...
🌐
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 - 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
🌐
Socket
socket.dev › npm › package › nestjs-config-zod-validation
nestjs-config-zod-validation - npm Package Security Analysis...
import { validationSchema, validationOptions } from "nestjs-config-zod-validation" @Module({ imports: [ ConfigModule.forRoot({ validationSchema: validationSchema(ConfigSchema), // Pass in your ZodSchema "Schema" here validationOptions: validationOptions, }), ], })
🌐
iSpeech
zignuts.com › question-and-answer › how-to-use-zod-with-nestjs-pipes-for-runtime-schemas
How to use Zod with NestJS pipes for runtime schemas?
NestJS integrates Zod via custom pipes that parse/validate incoming data against schemas at runtime, providing client-bundleable validation separate from TypeScript types. Create ZodValidationPipe using zod.toParsedSchema() for transformation; ...