Validate incoming API response data against a schema before using it in your app, with TypeScript types inferred automatically from the same schema.
Check user-submitted form data against rules like required email format and minimum password length, and get structured error messages when validation fails.
Replace Zod with Valibot in a frontend bundle where file size is a concern, keeping the same schema-first workflow at a fraction of the weight.
No external dependencies, install from npm and import only the functions you need.
Valibot is a TypeScript library that checks whether data matches a shape you define. You describe the expected structure once, as a schema, and Valibot runs that schema against real data at runtime to confirm it matches. This covers incoming server data, form inputs, configuration files, or anything else your code receives from outside sources. The main practical difference between Valibot and similar tools is how small it stays in a production build. Its API is built from many small, single-purpose functions rather than a few large ones. A bundler can detect which functions you actually import and drop the rest. The README states this can reduce bundle size by up to 95% compared to Zod, a widely used alternative, with a minimal use case starting at under 700 bytes. You define a schema by composing those functions. The README shows a login example: an object schema that requires a valid email string and a password of at least 8 characters. TypeScript infers the correct output type directly from the schema definition, so you write the shape once and get both runtime validation and compile-time type safety from a single source. For running a schema against data, you can use parse, which throws an error when data fails, or safeParse, which returns a result object instead of throwing. The library runs in any JavaScript environment, has no external dependencies, and is fully covered by unit tests. It is MIT licensed and was originally created as a bachelor thesis at Stuttgart Media University.
← open-circle on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.