class-validator
Validation library for TypeScript and JavaScript classes that checks object properties against rules declared with decorators.
class-validator checks the properties of TypeScript and JavaScript class instances against rules attached as decorators, and it exports the same checks as plain functions for validation without decorators. The README says it works in both the browser and Node.js and uses validator.js internally to perform the checks. It covers custom messages, nested objects, validation groups, whitelisting, and custom validators that run synchronously or asynchronously.
Worth knowing
Schema-based validation without decorators, defined apart from the class, is no longer supported: the README says the feature broke and will not be fixed. A plain object, such as parsed JSON, has to become a class instance before it is validated, for example with class-transformer.
Identity
Rendering and deploy
- Install with
- npm4
Releases
Adoption
Sources
- 2026-11-04: links
github.com/typestack/class-validator - 2026-11-04: First release
registry.npmjs.org/class-validator - 2026-11-04: Maintainer, License
github.com/typestack/class-validator/blob/v0.15.1/LICENSE - 2026-11-04: Categories, Runtime, Install with
github.com/typestack/class-validator/blob/v0.15.1/README.md - 2026-11-04: Written in, GitHub stars
api.github.com/repos/typestack/class-validator - 2026-11-04: Current major version, Last release
github.com/typestack/class-validator/releases/tag/v0.15.1 - 2026-11-04: Contributors
api.github.com/repos/typestack/class-validator/contributors - 2026-11-04: npm downloads a week
api.npmjs.org/downloads/range/2026-10-26:2026-11-01/class-validator - 2026-11-04: Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/class-validator