
All NestJS + Zod utilities you need
The nestjs-zod library offers a seamless integration between NestJS applications and Zod schema validation, providing a robust solution for managing input data validation and serialization. This library aims to enhance the way data validation is handled in NestJS applications, allowing developers to define schemas using Zod, which provides type-safe validation without the overhead of traditional validation libraries.
By simplifying the validation process, nesting Zod within NestJS ensures that response data is also formatted correctly, adhering to the defined schemas. This results in cleaner code and a more maintainable structure, ultimately leading to better application performance and fewer errors when handling incoming requests and generating outgoing responses.
Automatic Setup: Quickly integrate the library into your project with a single command, enabling essential components like validation pipes and interceptors with minimal effort.
ZodValidationPipe: A powerful validation pipe that ensures incoming data meets specified Zod schema requirements, throwing exceptions when the data is invalid.
ZodSerializerInterceptor: Automatically serializes responses according to Zod schemas, ensuring uniformity and accuracy in the data sent back to clients.
Create ZodDTO: Generate Data Transfer Objects (DTOs) directly from Zod schemas, streamlining the definition and validation of incoming data.
Optional HttpExceptionFilter: Implement a custom exception filter to handle Zod-related errors more gracefully within your application.
OpenAPI Support: Easily generate and cleanup OpenAPI documentation using the library, ensuring that your APIs are accurately represented and easy to navigate.
Flexible Schema Integration: Supports various Zod schema versions, allowing for backward compatibility and integration of existing schemas with the latest features.
Type Safety and Validation: Combines compile-time TypeScript types with runtime validations, reducing the likelihood of errors and enhancing developer productivity.

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript.
TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.
Zod is a TypeScript-first schema declaration and validation library. It allows you to define schemas that can validate data at runtime while providing excellent TypeScript inference, making it perfect for API validation, form validation, and type-safe data handling.