# class-validator: 5.6 out of 10

Reasonable, with limits. 7th of 10 in [Validation libraries](https://elestia.ai/opensource/validation/index.md).

class-validator checks class instances with decorators such as @IsString and @IsEmail. The NestJS docs still use it, but it does not infer types from a schema, it depends on legacy decorators, and its maintenance is thin. It is a reasonable pick inside NestJS, but for most new projects Zod or Valibot is the better choice.

**Best for:** NestJS teams that want DTO classes with the built-in ValidationPipe and the patterns in the official docs.

## Scores

- **Overall: 5.6** (likely 4.5 to 6.6)
  - Claude Opus 5.5 (5.0): Inside NestJS it is still a working, documented and familiar default, so it stays reasonable there. Outside that niche, Zod, Valibot and ArkType give type inference, plain-data validation and active maintenance, and NestJS 12 now accepts them directly. Thin maintenance and a falling share keep it in the middle of the category.
  - GPT-6.2 Sol (6.1): Class-validator is a reasonable choice for new NestJS modules that already use decorated DTOs, where its built-in checks and framework integration save setup. For most new validation work, Zod offers simpler parsing of plain data and derives TypeScript types from the rules. Slow maintenance and below-baseline download growth lower the recommendation, while ongoing framework support keeps the class-based choice viable.
- **Needed by many: 4.8** (likely 3.8 to 5.9)
  - Claude Opus 5.5 (5.0): Most JS and TS developers need a validator, but this decorator-and-class approach fits mainly backends built with classes, above all NestJS. It needs the legacy TypeScript decorator setting, and it suits frontend forms or plain-object code poorly. That makes its audience narrower than the category's.
  - GPT-6.2 Sol (4.6): Runtime validation is useful across APIs, forms, and configuration, but this library's main workflow serves developers who model data as decorated classes. It runs in Node.js and browsers and has integrations beyond NestJS. The share of JavaScript and TypeScript developers who prefer class-based validation is hard to measure.
- **Helps a lot: 6.0** (likely 4.9 to 7.0)
  - Claude Opus 5.5 (5.0): It has a broad set of validators, nested validation, groups and custom constraints, and it integrates tightly with NestJS. But it does not infer types, it needs class-transformer to turn plain objects into classes, synthetic benchmarks show it slower than Zod, and some defaults such as forbidUnknownValues have surprised users. AI agents write it well because NestJS examples are everywhere.
  - GPT-6.2 Sol (6.9): Version 0.15.1 offers a broad set of checks, custom async rules, and structured errors with configurable messages. It uses declared class types, and nested JSON needs explicit transformation and validation setup that developers and coding agents can miss. A user reported that validation gets slower as more decorated classes are registered, and benchmark results depend on the payload and transformation setup.
- **Holds up over time: 4.4** (likely 3.2 to 5.9)
  - Claude Opus 5.5 (4.0): Only 16 commits and 4 releases came out last year, the last push was in March 2026, and the Scorecard Maintained check scores 0. Volunteers maintain it with no visible funding, and the backlog holds 283 open issues. NestJS 12 adds Standard Schema validation, so the ecosystem is slowly moving to schema libraries, but its large NestJS base keeps it from being abandoned soon.
  - GPT-6.2 Sol (4.8): The supplied snapshot shows 16 commits and three npm versions in a year, with the last publish in February 2026. Recent GitHub releases came from one maintainer, and users reported upgrade failures after a validation default changed in 0.14.0. NestJS still supports the class-based workflow and now offers a built-in schema pipeline, so continued compatibility looks more likely than renewed adoption. Funding and backup publishing capacity are unclear.
- **Used widely: 6.0** (likely 5.0 to 7.1)
  - Claude Opus 5.5 (6.5): About 70M downloads in four weeks and 56k dependent repositories show heavy real use, mostly through NestJS projects. Its growth ratio of 3.2 is below the 4.1 median, so it is losing share, while Zod (8.4) and Valibot (14.9) grow much faster. Bluesky and Hacker News show almost no attention.
  - GPT-6.2 Sol (5.5): The partial index found 56,346 dependent repositories and 3,854 packages, consistent with an established user base in the tens of thousands. Four-week downloads rose from 21.7 million to 69.9 million, but 3.22× growth trailed the 4.1× catalog baseline and Zod's 8.40×. Repeated installs and framework-driven use make downloads a loose proxy for new choices, and one Bluesky link post gives little evidence of fresh attention.
- **Vouched for: 6.2** (likely 5.2 to 7.3)
  - Claude Opus 5.5 (6.0): The official NestJS docs use it, and so do many production NestJS backends, which is real, current backing. Independent write-ups describe it as the NestJS default, but they usually favour Zod for new work, and some teams record decisions to move away from it. It has no presence in surveys or independent benchmarks beyond that.
  - GPT-6.2 Sol (6.4): NestJS and TypeGraphQL integrate class-validator, and Ever Gauzy documents using it for backend DTOs. Immich moved to Zod in v3, and some NestJS users report that combining validation and framework decorators becomes cumbersome. The State of JavaScript survey shows Zod's momentum and gives no class-validator satisfaction measure, so confidence is strongest within class-based stacks.
- **Safe: 5.9** (likely 4.8 to 7.0)
  - Claude Opus 5.5 (6.0): There is one old critical advisory from 2021, which was disputed and mitigated in 0.14 by defaulting forbidUnknownValues to true, and none in the last 24 months. It has only three dependencies, but validator.js is among them and has had its own advisories. The OpenSSF Scorecard is weak at 4.7, with 0 on Security-Policy, Token-Permissions, SAST and Maintained. The licence is MIT.
  - GPT-6.2 Sol (5.8): The MIT licence and three direct dependencies keep the dependency footprint modest. The critical advisory was fixed in 0.14.0 in December 2022, about 14 months after the GitHub listing, and the bundle records no newer direct advisories. Recent releases also patched dependencies, but Scorecard gives 4.7 with weak workflow token permissions and no detected fuzzing or security policy. Recent GitHub releases name one releaser, and npm publishing controls are unclear.

## Good

- It works out of the box with the NestJS ValidationPipe and is the approach the NestJS docs show.
- It has a large set of ready-made validators (email, UUID, IBAN, phone numbers and more), built on validator.js.
- One DTO class can serve as the validation rules, the TypeScript type and the source for Swagger docs.
- It pulls in only three dependencies and uses the permissive MIT licence.

## Bad

- It needs legacy experimentalDecorators and works on class instances, usually with class-transformer, rather than on plain data.
- It cannot infer types from a schema, and the classes are hard to share with frontend code.
- Maintenance is thin: there were 16 commits last year, no push since March 2026, and about 280 open issues.
- NestJS 12 adds Standard Schema validation, so Zod, Valibot or ArkType can now be used in NestJS without class-validator.

## The numbers

- Downloads, 4 weeks: 70M
- In a year: ×3.2
- GitHub stars: 12k
- Commits, 12 months: 16
- Last npm release: Feb 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/typestack/class-validator
- npm: https://www.npmjs.com/package/class-validator

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 21 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
