substitutefor

software · Q133

Valibot

MIT-licensed modular runtime schema-validation library for JavaScript and TypeScript with composable validation pipelines.

Suggest a correction

Overview

Valibot is an open-source schema library for checking data at runtime and deriving static TypeScript types. Its API composes small functions into schemas and validation or transformation pipelines. This is useful for forms, server inputs and configuration in AI-assisted applications, where explicit data contracts are preferable to assuming generated types alone validate incoming values.[1]

Building a contract from small pieces

Valibot separates schema construction from actions that validate or transform values. A pipeline can first establish that input is a string and then apply format or length checks. Its independent-function design gives bundlers opportunities to omit unused code. That is an architectural characteristic, not a measured guarantee that every application becomes smaller or faster after switching. A generated schema still needs to express the actual accepted input rather than only a convenient example.[1]

Parsing and type guards are not interchangeable

parse throws ValiError when input fails, while safeParse returns a success flag with output or issues. The distinction is particularly important when transformations are involved. The parsing guide warns that is and assert type guards neither apply transformations nor strip unknown object keys and do not expose validation issues. Replacing parsing with a boolean test can therefore change what the application actually receives, even if both approaches seem to check the same schema.[3]

Object shape and cross-field checks

The ordinary object schema removes entries that were not declared. looseObject preserves unknown entries, strictObject rejects them, and objectWithRest can validate additional entries against another schema. Cross-field validation can use a pipeline check, with issues assigned to a relevant field. The guide notes that a whole-object check needs fully typed input and offers partialCheck for selected fields. These distinctions help avoid accidental acceptance, removal or delayed reporting of fields in an application form.[4]

Asynchronous work must propagate through the schema

Valibot's asynchronous variants use an Async suffix and return promises. An asynchronous check nested inside an object requires asynchronous enclosing composition, while synchronous checks can remain inside the async structure. The documentation uses checking whether a username is available as an example. Such a check integrates external state into validation but does not make that state immutable; the surrounding application remains responsible for its persistence rules.[5]

JSON Schema export and migration

The official JSON Schema converter is a separate package. It covers compatible schema constructs, but Valibot's transformations and non-JSON capabilities are not all expressible in JSON Schema. Its Zod migration tool is also explicitly beta. The migration guide changes chained methods into pipeline calls and documents renamed operations and different parsing syntax. Conversion should therefore be reviewed against representative inputs and outputs rather than treated as a proof that the old and new validators are identical.[6][7]

License and substitution

Valibot uses the MIT license. It can substitute for Zod for overlapping runtime data contracts, provided the application's callers, error rendering and transformations are adapted. Bundle size is a useful reason to investigate modular validation, but current Zod also offers a functional Mini variant, so an old comparison against regular Zod alone is not a complete current evaluation. The choice should be measured within the actual application. No codemod, package install or comparative benchmark was run for this article.[2][7][8][9]

Capabilities & limitations

Composable validation pipelines

supported

Schemas and independent actions combine validation and transformations with inferred types.[1]

Runtime validation of structured application data · JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

1 source · check evidence
https://valibot.dev/guides/introduction/

Modular function design, runtime checking and type inference

vendor · checked 2026-10-07

Parsed-output handling

limited

parse and safeParse return schema output; is/assert type guards do not apply transformations or remove unknown keys.[3]

Runtime validation of structured application data · JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

1 source · check evidence
https://valibot.dev/guides/parse-data/

parse/safeParse output and type-guard limitations

vendor · checked 2026-10-07

Asynchronous validation

supported

Async schemas/actions can contain synchronous work, but async work requires async parent composition.[5]

Runtime validation of structured application data · JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

1 source · check evidence
https://valibot.dev/guides/async-validation/

Promise-based functions and nesting constraints

vendor · checked 2026-10-07

Automatic Zod migration

limited

Official codemod is beta and may miss edge cases; construction and parsing APIs change.[7]

Runtime validation of structured application data · JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

1 source · check evidence
https://valibot.dev/guides/migrate-from-zod/

Beta codemod, pipelines and changed names

vendor · checked 2026-10-07

JSON Schema export

limited

Provided by a separate package for compatible schemas; arbitrary transformations are not faithfully portable to JSON Schema.[6]

Runtime validation of structured application data · JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

1 source · check evidence
https://valibot.dev/guides/json-schema/

Separate conversion package and non-JSON transformation limits

vendor · checked 2026-10-07

Can substitute for

These are products or services this entry can replace. Check the task and limitations for each comparison.

Zod for Runtime validation of structured application data

limited

Candidate for runtime data validation and inferred types when modular function composition is preferred. Use the migration guide and test error/output behavior; no universal size or compatibility advantage is claimed.[1][7][8][9]

JavaScript runtimes, TypeScript applications, Web browsers · Version, build and integration requirements apply

References

  1. Valibot introduction

    Modular function design, runtime checking and type inference

    vendor · retrieved 2026-10-07
  2. Valibot source license

    MIT license

    vendor · retrieved 2026-10-07
  3. Valibot parsing

    parse/safeParse output and type-guard limitations

    vendor · retrieved 2026-10-07
  4. Valibot objects

    Unknown entries, strict/loose behavior and partial checks

    vendor · retrieved 2026-10-07
  5. Valibot async validation

    Promise-based functions and nesting constraints

    vendor · retrieved 2026-10-07
  6. Valibot JSON Schema

    Separate conversion package and non-JSON transformation limits

    vendor · retrieved 2026-10-07
  7. Migrate from Zod to Valibot

    Beta codemod, pipelines and changed names

    vendor · retrieved 2026-10-07
  8. Zod basic usage

    Runtime parsing, type inference and input/output distinctions

    vendor · retrieved 2026-10-07
  9. Zod Mini

    Functional tree-shakable Zod option and benchmark qualification

    vendor · retrieved 2026-10-07

Discussion & disputes

Ask about unclear claims or explain a concern with supporting sources. If you have a specific fix, suggest a correction.

No discussion yet.

Sign in with an active account to join the discussion.

Revision history

Open a revision to read an earlier version of this article.

RevisionTimestampEdit summary
1172026-10-10 06:44:24/* wbeditentity-create-item:0| */ sf:a44d3d10-6418-47e3-8280-4f84671142e0:v1 | Add Valibot with parsed-output versus type-guard differences, object policy, async nesting and beta Zod migration; avoid unverified blanket bundle-size superior | attribution: /proposals/a44d3d10-6418-47e3-8280-4f84671142e0