{"id":49631,"library":"valibot","title":"Valibot","description":"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.","status":"active","version":"1.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/open-circle/valibot","tags":["javascript","modular","typescript","schema","validation","parsing","bundle-size","type-safe","runtime"],"install":[{"cmd":"npm install valibot","lang":"bash","label":"npm"},{"cmd":"yarn add valibot","lang":"bash","label":"yarn"},{"cmd":"pnpm add valibot","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; Valibot relies on TypeScript >=5 for type inference and schema definitions.","package":"typescript","optional":true}],"imports":[{"note":"Valibot does not export a default namespace. Use namespace import.","wrong":"import v from 'valibot'","symbol":"default import (all as v)","correct":"import * as v from 'valibot'"},{"note":"Tree-shaking works best with named imports. CommonJS also supported.","wrong":"const parse = require('valibot').parse","symbol":"parse","correct":"import { parse } from 'valibot'"},{"note":"Import individual functions for optimal tree-shaking.","wrong":"","symbol":"object, string, pipe, email, minLength","correct":"import { object, string, pipe, email, minLength } from 'valibot'"},{"note":"InferOutput is a type (value and type). Both work.","wrong":"import type { InferOutput } from 'valibot'","symbol":"InferOutput","correct":"import { InferOutput } from 'valibot'"},{"note":"Returns a result object, does not throw.","wrong":"","symbol":"safeParse","correct":"import { safeParse } from 'valibot'"}],"quickstart":{"code":"import * as v from 'valibot';\n\n// Define a schema\nconst LoginSchema = v.object({\n  email: v.pipe(v.string(), v.email()),\n  password: v.pipe(v.string(), v.minLength(8)),\n});\n\n// Infer TypeScript type\ntype LoginData = v.InferOutput<typeof LoginSchema>;\n\n// Parse with exception\nconst result = v.parse(LoginSchema, { email: 'test@example.com', password: '12345678' });\nconsole.log(result); // { email: 'test@example.com', password: '12345678' }\n\n// Safe parse\nconst safeResult = v.safeParse(LoginSchema, { email: 'bad', password: 'short' });\nif (safeResult.success) {\n  console.log(safeResult.output);\n} else {\n  console.log(safeResult.issues);\n}","lang":"typescript","description":"Creates a login schema with email and password validation, parses data, and demonstrates safe parsing with error handling."},"warnings":[{"fix":"Replace custom error handling with safeParse or catch errors from parse.","message":"v1.0.0 changes API from v0.x: parse now throws by default; use safeParse for non-throwing.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use parse() which supports async validators natively.","message":"v1.0.0 removed the 'parseAsync' function; use parse with async schemas or pipe.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use additional string validators like v.regex(/.../) for stricter checks.","message":"Email validation (v.email()) does not reject all invalid emails; it follows HTML5 spec.","severity":"gotcha","affected_versions":"*"},{"fix":"Replace v.recursive(() => ...) with v.lazy(() => ...).","message":"v.recursive() is deprecated; use v.lazy() with object schemas.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Always import from the main package: import { object } from 'valibot'.","message":"Tree-shaking only works if imports are from 'valibot' (not 'valibot/core' etc).","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.4.1':24 '100':60 '5':85 '700':43 '95':71 'activ':108 'along':58 'altern':20 'api':87 'architectur':38 'base':50,89 'bundl':72,119 'bundle-s':118 'byte':44 'cadenc':106 'class':99 'compar':75 'coverag':62 'depend':31 'design':16 'develop':109 'distinguish':65 'easili':102 'enabl':68 'except':49 'exception-bas':48 'extens':103 'full':27 'function':94 'github':111 'independ':93 'javascript':13,112 'librari':11,64 'lightweight':19 'make':100 'mani':91 'modular':5,37,113 'monolith':98 'pars':51,52,55,117 'provid':46 'rather':95 'reduct':74 'releas':105 'requir':83 'runtim':124 'safe':8,54,123 'safepars':56 'schema':9,115 'shakabl':36 'shake':81 'ship':25 'size':73,120 'small':92 'stabl':104 'start':40 'support':29 'test':61 'tree':35,80 'tree-shak':34,79 'type':7,122 'type-saf':6,121 'typescript':15,28,84,114 'valibot':1,2 'valid':10,116 'version':23 'zero':30 'zod':22,77","created_at":"2026-06-07T17:02:46.311919+00:00","updated_at":"2026-06-07T17:02:46.311919+00:00","problems":[{"fix":"Ensure typescript@>=5 is installed and import from 'valibot', not 'valibot/...'.","cause":"Missing TypeScript version >=5 or incorrect import path.","error":"Cannot find module 'valibot' or its corresponding type declarations."},{"fix":"Use import * as v from 'valibot' or import { parse } from 'valibot'.","cause":"Using default import (import v from 'valibot') instead of namespace import.","error":"TypeError: v.parse is not a function"},{"fix":"Ensure the first argument is a valid schema created with valibot functions like v.object().","cause":"Passing a non-schema value to parse() or passing undefined/null where object is expected.","error":"SchemaError: Invalid schema received"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://valibot.dev","github":"https://github.com/open-circle/valibot","docs":null,"changelog":null,"pypi":null,"npm":"valibot","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}