Skip to content

The best class-validator alternatives

5 tools that do a similar job to class-validator, 5 of them open source. Each entry says what it does and who it suits, so you can pick the one that fits instead of the most famous.

You're replacing

class-validator

Validates class properties using TypeScript decorators, for browser and Node.js.

  1. 1

    Zod

    Open source · MIT · ★ 44.2k

    TypeScript-first library for validating data at runtime and inferring static types from the same schema.

    Best for: TypeScript developers who want runtime checks that match their static types; Teams validating API request or response data in TypeScript projects

  2. 2

    Yup

    Open source · MIT · ★ 23.7k

    A JavaScript/TypeScript library for defining schemas that validate and convert data at runtime.

    Best for: Developers validating form or API input in JavaScript or TypeScript; Teams that want TypeScript types inferred from a validation schema

  3. 3

    Ajv

    Open source · MIT · ★ 14.9k

    A fast library that checks whether JSON data matches a schema, for Node.js and browsers.

    Best for: Node.js developers validating API request or response bodies; Front-end developers validating form or config data in the browser

  4. 4

    validator.js

    Open source · MIT · ★ 23.7k

    A JavaScript library for checking and cleaning up strings, like emails, dates, and URLs.

    Best for: JavaScript developers validating form or API input on Node.js; Developers who need checks like isEmail or isDate without writing regular expressions themselves

  5. 5

    VeeValidate

    Open source · MIT · ★ 11.3k

    A library for building and validating forms in Vue.js apps.

    Best for: Vue developers who need form validation without writing it from scratch; Teams building Vue 3 forms with synchronous or asynchronous rules

How we pick: tools in the same category that solve the same problem, projects that name each other as alternatives, and open-source projects that describe themselves as an alternative to class-validator. We don't take payment for placement.