valibot

v1.3.1 MIT

The modular and type safe schema library for validating structural data

Weekly Downloads
5.7M
Stars
8.5K
Forks
315
Open Issues
118
Gzip Size
14.6 kB
Unpacked Size
1.8 MB
Dependencies
1
Last Updated
4mo ago

valibot Download Trends

Download trends for valibot07.8M15.6M23.4M31.2MFeb 2025MayAugNovFebApr 2026
valibot

About valibot

Valibot is a schema library designed for robust structural data validation, addressing the common challenge of ensuring data integrity in diverse application environments. It provides a type-safe approach to define and validate data structures, significantly reducing runtime errors and improving developer confidence.

Its core philosophy centers around modularity and type safety, making it an excellent choice for TypeScript developers who require reliable data parsing and validation without sacrificing developer experience. The library aims to be intuitive and flexible, catering to a wide range of validation needs from simple object shapes to complex nested data.

Key API patterns include schema definition using builder functions such as `object`, `string`, `number`, and `boolean`, or more complex types like `array` and `union`. The `parse` function is central, transforming input data into a validated, typed output, while `safeParse` offers a non-throwing alternative for error handling. The library's composable nature allows for the creation of intricate schemas by combining smaller, reusable validation units.

Valibot integrates seamlessly into modern JavaScript and TypeScript workflows. It is particularly well-suited for backend frameworks like Express or NestJS for validating API request payloads, client-side form validation with frameworks like React or Vue, and data transformation pipelines. Its modular design means you only import what you need, leading to better bundle sizes.

With a bundle size of 14.6 kB (gzip), Valibot offers a performant validation solution without a significant impact on load times. The library is actively maintained, as indicated by its last update on 2026-03-18 and growing community support, evidenced by 8.5K GitHub stars and 313 forks.

A potential consideration is its design, which prioritizes explicitness. This can lead to slightly more verbose schema definitions compared to more implicit or convention-based systems, but this tradeoff enhances clarity and maintainability, especially in collaborative projects.

When to use

  • When validating API request bodies or response payloads in Node.js environments, leveraging `object` and `string` schemas to ensure incoming data conforms to expected types.
  • For client-side form validation in frameworks like React, using `parse` or `safeParse` within component logic to provide immediate user feedback on invalid inputs.
  • When defining and enforcing data shapes for configuration files or environment variables, ensuring applications start with valid settings.
  • For runtime data transformations where you need to convert untrusted input into a predictable, type-safe data structure before further processing.
  • When building reusable validation modules that can be shared across different parts of a monorepo or multiple projects.
  • To integrate with serialization libraries where defining a schema upfront can streamline both validation and deserialization processes.

When NOT to use

  • If you require only basic type checking at compile time for internal code — TypeScript's built-in type system suffices.
  • When your validation needs are limited to simple primitive checks and do not involve complex data structures or nesting; a simpler conditional check might be more appropriate.
  • If the primary goal is performance optimization for extremely high-throughput, low-latency scenarios where even minimal parsing overhead is unacceptable; consider highly optimized, specialized parsers.
  • When working in environments where runtime code size is critically constrained and every kilobyte matters significantly beyond Valibot's 14.6 kB gzip bundle size.
  • If you prefer a convention-over-configuration approach for validation where schemas are inferred rather than explicitly defined, look for libraries that emphasize this pattern.

valibot Alternatives

valibot Categories