zod VS class-validator

Compare zod vs class-validator and see what are their differences.

zod

TypeScript-first schema validation with static type inference (by colinhacks)

class-validator

Decorator-based property validation for classes. (by typestack)
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
zod class-validator
303 29
31,418 10,642
- 1.3%
9.3 9.0
5 days ago 6 days ago
TypeScript TypeScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

zod

Posts with mentions or reviews of zod. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-06-24.
  • Valibot: featherweight validator
    2 projects | dev.to | 24 Jun 2024
    Today I want to talk about a tool that makes lightness its cornerstone. It's called Valibot. Valibot is an npm package for data validation. It works independently with JS and TypeScript and allows a wide variety of validations. In practical terms, as for the methods, it's essentially 1 to 1 with the most commonly used package for the same task, namely Zod.
  • Combining Node.js with Async Rust for remarkable performance
    5 projects | dev.to | 18 Jun 2024
    Encore.ts, as the name suggests, is designed from the ground up for TypeScript. But you can't actually run TypeScript: it first has to be compiled to JavaScript, by stripping all the type information. This means run-time type safety is much harder to achieve, which makes it difficult to do things like validating incoming requests, leading to solutions like Zod becoming popular for defining API schemas at runtime instead.
  • Valibot: A New Approach to Data Validation in JavaScript
    3 projects | dev.to | 16 Jun 2024
    Hiller had previously worked on modular forms, but he wanted to bring that same modular philosophy to data validation. While popular validation libraries like Zod offer excellent APIs, Hiller felt there was room to take modularity even further.
  • Type-Safe Env Vars in Remix - A modern approach with ArkType
    4 projects | dev.to | 14 Jun 2024
    Aside from updating Remix (from 1.7 to 2.9) and switching from Zod to ArkType, I’ve introduced a makeTypedEnvironment helper to streamline handling environment variables in both server and client environments. Additionally, I’ve optimized the codebase by removing the typedPick method and refining imports to ensure server code doesn’t leak into the client bundle.
  • NEXT JS STARTER PACK
    3 projects | dev.to | 13 Jun 2024
    React hook form Zod @hookform/resolvers
  • Simple AI Smart Home Manager
    3 projects | dev.to | 12 Jun 2024
    For the language models, Genkit provides the concept of Flows. A flow basically combines a prompt with a set of "tools" or actions that the llm can take. Like other frameworks in this space ZOD is used to provide schema information for both the input and output of flows and actions.
  • Using Arktype in Place of Zod - How to Adapt Parsers
    4 projects | dev.to | 12 Jun 2024
    Ever since I started using Zod, a TypeScript-first schema declaration and validation library, I've been a big fan and started using it in all my projects. Zod allows you to ensure the safety of your data at runtime, extending TypeScript’s type-checking capabilities beyond compile-time. Whenever I need to validate data from an outside source, such as an API, FormData, or URL, Zod has been my go-to tool.
  • 10 must known JS/TS open-source packages
    6 projects | dev.to | 11 Jun 2024
    Zod TypeScript-first schema validation with static type inference
  • This week trending news in tech
    1 project | dev.to | 6 Jun 2024
    Zod
  • Creating GPT Actions with ValTown
    3 projects | dev.to | 25 May 2024
    To define the action's inputs and outputs we will need the zod library. Zod is an npm package and ValTown lets us import it directly into our Vals:

class-validator

Posts with mentions or reviews of class-validator. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-07.

What are some alternatives?

When comparing zod and class-validator you can also consider the following projects:

joi - The most powerful data validation library for JS [Moved to: https://github.com/sideway/joi]

joi - The most powerful data validation library for JS [Moved to: https://github.com/hapijs/joi]

typebox - Json Schema Type Builder with Static Type Resolution for TypeScript

class-transformer - Decorator-based transformation, serialization, and deserialization between objects and classes.

Yup - Dead simple Object schema validation

TypeORM - ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

ajv - The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

io-ts - Runtime type system for IO decoding/encoding

Superstruct - A simple and composable way to validate data in JavaScript (and TypeScript).

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured