COMPARISON · VALIDATION

class-validator vs. valibot

Side-by-side comparison · 9 metrics · 14 criteria

class-validator v0.15.1 · MIT
Weekly Downloads
18.0M
Stars
11.9K
Gzip Size
105.8 kB
License
MIT
Last Updated
9mo ago
Open Issues
329
Forks
848
Unpacked Size
5.3 MB
Dependencies
N/A
valibot v1.5.0 · MIT
Weekly Downloads
35.1M
Stars
9.1K
Gzip Size
15.4 kB
License
MIT
Last Updated
1y ago
Open Issues
247
Forks
422
Unpacked Size
1.9 MB
Dependencies
1
DOWNLOAD TRENDS

class-validator vs valibot downloads · last 12 months

Download trends for class-validator and valibot2 download series from Nov 2025 to Oct 2026. Use left and right arrow keys to inspect monthly values.027.1M54.1M81.2M108.2MNov 2025FebMayAugOct 2026
class-validator
valibot
FEATURE COMPARISON

Criteria · class-validator vs valibot

Schema Reuse
class-validator
Rules are organized around decorated class properties
valibot ✓
Modular schema definitions support schema-centered reuse
Data Model Fit
class-validator
Naturally fits class-oriented models and instances
valibot
Naturally fits structural data independent of class instances
Learning Curve
class-validator
Familiar to teams already using classes and decorators
valibot
Requires learning schema declarations and composition
Rule Placement
class-validator
Keeps constraints alongside class fields
valibot
Keeps constraints in separate schema definitions
Type Inference
class-validator
Provided description does not specify type inference
valibot ✓
Type inference is an explicit design focus
Package Footprint
class-validator
Larger reported unpacked package footprint
valibot ✓
Smaller reported unpacked package footprint
Bundle Suitability
class-validator
Reported gzip bundle is larger for size-constrained delivery
valibot ✓
Smaller reported gzip bundle suits tighter delivery budgets
Migration Approach
class-validator
Moving away requires translating decorated property rules
valibot
Moving away requires translating schema declarations
Open Issue Context
class-validator
More reported open issues in the supplied data
valibot ✓
Fewer reported open issues in the supplied data
Structural Parsing
class-validator
Validation is organized around classes and their instances
valibot ✓
Designed for validating structural data against schemas
Validation Declaration
class-validator
Attaches validation rules to class properties through decorators
valibot
Defines validation rules in explicit structural schemas
Type-Safe Schema Design
class-validator
Class-based declaration; type-safety details are not specified
valibot ✓
Explicitly focuses on type-safe schemas
Decorator-Based Workflow
class-validator ✓
Provides a direct property-decorator validation workflow
valibot
Uses schema declarations rather than property decorators
Class-Oriented Project Fit
class-validator
Fits projects that make classes the home of validation rules
valibot
Can validate structural data without a class-centered model
VERDICT

class-validator is designed for developers who model application data as TypeScript classes and want validation rules attached directly to class properties. Its decorator-based philosophy suits class-oriented codebases where the class definition already acts as the shape of an input or domain object; it is less suited to teams that want validation expressed independently of class instances.

valibot centers validation on explicitly declared schemas for structural data, with type inference as a stated part of its design. That approach fits developers who want reusable validation definitions for incoming data, forms, or other values without requiring decorated classes, and who prefer schema composition as the main way to describe accepted input.

The key architectural difference is where rules live and how data flows through validation. class-validator associates rules with class properties through decorators, so validation is organized around a class and its instance; valibot defines a schema that describes a data structure and validates values against that description. This affects code organization: class-validator makes the model the natural home for constraints, while valibot makes the schema the explicit validation unit.

Their extension approaches follow the same divide. class-validator’s property-decorator model offers a direct way to place constraints alongside class fields, which can be convenient when validation belongs tightly to those fields. valibot emphasizes modular schemas and structural parsing, making it a more natural fit when developers need to assemble or reuse validation logic as separate schema definitions; the supplied package details do not establish a plugin system for either package.

For developer experience, class-validator can be approachable when a project already uses classes and decorators, because its validation intent appears near the properties being checked. valibot’s schema-first style requires developers to learn its schema declarations, but its stated type-safety and type-inference focus can keep the relationship between a schema and validated structural data explicit. The choice is therefore partly about whether a team wants rules embedded in class definitions or represented as schemas.

Bundle constraints strongly distinguish the packages for client-facing or otherwise size-sensitive code: valibot’s reported gzip bundle is 15.4 kB, compared with 105.8 kB for class-validator. The unpacked package sizes follow the same direction, at 1.9 MB for valibot and 5.3 MB for class-validator. Those figures make valibot the more attractive option when reducing delivered JavaScript is a priority; they do not by themselves establish runtime speed or validation throughput.

Choose class-validator when the application already relies on class-based models and the team wants property-level decorators to keep validation rules beside those fields. Choose valibot when validation needs to be schema-first, structural, and type-inferred, or when a smaller reported bundle is an important constraint. For a new data-validation layer without a requirement for decorated classes, valibot is the more direct fit; for an established class-oriented design, class-validator may align better with existing model organization.

A migration between them is a change in representation, not simply a rename: class-validator rules attached to properties need to be expressed as valibot schemas, while schema declarations need a deliberate class model if moving in the other direction. The supplied data does not establish a compatibility bridge, so teams should plan to translate validation definitions and verify behavior for their actual inputs. valibot has fewer reported open issues, while class-validator has more reported stars and forks; these figures provide context but do not guarantee a particular maintenance outcome.

The distinction matters most at boundaries where data arrives as plain structural values rather than as class instances: valibot’s schema-centered model is naturally aligned with describing such data. Conversely, class-validator is a focused option when an application’s validation contract is intentionally attached to class properties. Neither package’s supplied details establish a specific integration, runtime-performance advantage, or edge-case behavior, so those requirements should be checked against the project’s concrete validation cases before adoption.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

RELATED COMPARISONS 8
ajv vs class-validator ★ 26.7K · 553.1M/wk class-validator vs joi ★ 33.0K · 51.6M/wk class-validator vs ow ★ 15.7K · 20.6M/wk @sinclair/typebox vs class-validator ★ 11.9K · 184.0M/wk class-validator vs zod ★ 56.3K · 480.8M/wk class-validator vs fast-xml-parser ★ 15.0K · 132.6M/wk class-validator vs yup ★ 35.5K · 34.3M/wk class-validator vs superstruct ★ 19.0K · 27.7M/wk