Valibot is a modular, type-safe schema validation library for JavaScript and TypeScript, designed as a lightweight alternative to Zod. Version 1.4.1 ships with full TypeScript support, zero dependencies, and a tree-shakable modular architecture that starts at under 700 bytes. It provides both exception-based parsing (parse) and safe parsing (safeParse, is), along with 100% test coverage. The library distinguishes itself by enabling up to 95% bundle size reduction compared to Zod through tree-shaking. It requires TypeScript >=5. The API is based on many small, independent functions rather than a monolithic class, making it easily extensible. Stable release cadence with active development on GitHub.
npm install valibotNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a login schema with email and password validation, parses data, and demonstrates safe parsing with error handling.
Replace custom error handling with safeParse or catch errors from parse.
Use parse() which supports async validators natively.
Use additional string validators like v.regex(/.../) for stricter checks.
Replace v.recursive(() => ...) with v.lazy(() => ...).
Always import from the main package: import { object } from 'valibot'.Ensure typescript@>=5 is installed and import from 'valibot', not 'valibot/...'.
Use import * as v from 'valibot' or import { parse } from 'valibot'.Ensure the first argument is a valid schema created with valibot functions like v.object().