Valibot: 700 bytes, zero dependencies, and a parse that throws
The modular and type safe schema library for validating structural data 🤖
At a glance
- What is it?
- Valibot is a TypeScript schema library that validates unknown data at runtime by composing many small functions. Its size story depends on tree shaking, the package you install lives in a workspace rather than the repo root, and moving over from Zod means rewriting expressions rather than renaming imports.
- Who is it for?
- Valibot fits a TypeScript codebase that wants runtime checks on unknown data and is willing to compose schemas out of many small imports instead of one large object. Skip it if you want a single bundled helper library, if you need a catalogue of validators you can read off one page, or if your build does not eliminate unused ESM imports.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- open-circle/valibot9,092 ★ · +71
| Repository | 2026-09-22 | 2026-11-22 |
|---|---|---|
| open-circle/valibot | 9k | 9.1k |
71 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Valibot ships zero runtime dependencies and modular helpers
The library declares no dependencies and says outright that it can run in any JavaScript environment. The root package.json is the private workspace rather than the published package, so it cannot show the library's own dependencies; its devDependencies are all tooling, with prettier and its sort-imports and tailwindcss plugins, typescript, and cve-lite-cli. None of it ships to a consumer.
The package also exports schema-oriented methods beyond validation and transformation actions. These include `pick`, `omit`, `partial`, `getDefaults`, `flatten` and `summarize`; consult the API for the version you use to check the full set.
Its modular functions are designed to be imported individually. Verify the behavior and bundle size of the specific methods your application uses.
A schema is executable code, but nothing validates until you call parse, safeParse or is
The central distinction is drawn in the project's own terms. A schema can be compared to a type definition in TypeScript, with the difference that TypeScript types are not executed and are more or less a developer experience feature, while a schema can be executed at runtime to guarantee the type safety of unknown data.
That guarantee is opt-in at the call site. Defining a schema does nothing on its own. Checking happens when you hand the schema to one of three entry points. `parse` returns the data or throws, which is what the example shows with an empty email and an empty password. `safeParse` is the non-exception-based alternative. `is` is a type guard. The consequence for anyone feeding it a request body, a form field or a configuration file is that a path calling `parse` on untrusted input throws on malformed data instead of returning a result you can branch on, and a separate guide covers parsing data.
So choosing `parse` everywhere is a decision about failure handling, not about convenience. Where the input is genuinely unknown, the guard and the non-throwing call are the ones that keep control flow in your hands.
The sub 700 byte figure holds only when a bundler removes what you never imported
The size claim is a floor rather than a total: the bundle starts at less than 700 bytes. The example import is annotated with 1.31 kB for the whole namespace import, which is the honest way to read both numbers. The floor is what the smallest thing you actually use costs; the namespace figure is what importing everything costs.
Both follow from the design rather than from luck. Instead of a few large functions carrying many methods, the API is built from many small and independent functions with a single task each. That is what lets a bundler read the import statements and drop code you never referenced, and the project puts a ceiling on the benefit: bundle size can be reduced by up to 95 % compared to Zod.
Treat that as a design time claim with a ceiling already on it, not as a measurement of your application. The word can is doing real work, and the comparison is against one named library. If your build does not perform ESM import elimination, the reduction never happens and the namespace figure is what you ship.
The repository root is a private pnpm workspace frozen at version 0.0.0
The root package.json is marked private and carries the version 0.0.0, so it is not the package you install. It is a workspace: pnpm is the declared package manager at 11.5.0, pnpm-workspace.yaml sits beside pnpm-lock.yaml, and nearly every script delegates across packages.
pnpm -r run test
pnpm -r run lint
pnpm -r --filter='!website' run build
cve-lite . --reportThe build line is the informative one, because it explicitly filters the workspace down to everything except the website. The documentation site lives in this repository but is excluded from the root build.
The tree explains the rest. `library/`, `packages/` and `website/` sit side by side, and there is a `codemod/` directory for rewriting code, a `patches/` directory, and a `brand/` directory, with `partners.webp` and `valibot.jpg` at the root. The consequence for a reader pinning a dependency is that the version string at the root tells you nothing about what a registry serves. Read the published version instead.
Three releases in one month carry three base versions and two feature suffixes
The recent tags do not form a single ascending line. Inside about a week the project published v1.5.0, then v1.8.0 (to-json-schema), then v1.3.0 (i18n), in that order by date, with the last push to main landing on 2026-10-31.
Two things are visible in that pattern. The suffixes name i18n and to-json-schema, so not every tag is a release of the core library; the tree has a packages/ directory beside library/. And the base numbers are not monotonic across those three tags, which means the release list cannot be read as one version history without checking what each tag actually points at.
For someone pinning a dependency the practical consequence is that the tag list is not a substitute for a release note. Pin an exact version rather than a moving range, and confirm which build you resolved before attributing a behaviour change to the library.
Coming from Zod means rewriting the shape, because the design is the opposite
The comparison the project draws is against libraries built as a few large functions with many methods, and Zod is the named reference point. Against that, Valibot's API is many small and independent functions, each with a single task. That is not a naming difference. A method hanging off a large object and a standalone export do not compose the same way, do not tree shake the same way, and do not get replaced the same way.
Migration is treated as a real path rather than an afterthought, with a dedicated article laying out the benefits and a guide for moving schemas across. What neither can do is turn the mechanical part into a no-op, because rewriting a schema means rewriting the expression when the composition primitives are different.
The same property cuts the other way too. Extending the library with external code is listed as an advantage of small independent functions, so a validation action you need and that is not built in is something you can supply yourself rather than wait for a release.
v.pipe is the composition model, and InferOutput reads the result back out
The example is built from two primitives and a wrapper. `v.object` takes a record of entries. Each entry is a `v.pipe` call whose first argument is the type check and whose remaining arguments are actions, so an email field is a string piped into an email action, and a password field is a string piped into a minimum length action.
import * as v from 'valibot'; // 1.31 kB
// Create login schema with email and password
const LoginSchema = v.object({
email: v.pipe(v.string(), v.email()),
password: v.pipe(v.string(), v.minLength(8)),
});
// Infer output TypeScript type of login schema as
// { email: string; password: string }
type LoginData = v.InferOutput<typeof LoginSchema>;
// Throws error for email and password
const output1 = v.parse(LoginSchema, { email: '', password: '' });Two details follow. `InferOutput` derives the output type from the schema instead of restating it, so a transformation that changes the value is reflected there rather than in a second hand written interface. And the order inside the pipe is the evaluation order, which means a length check placed ahead of a transformation measures the wrong value. The full action list is not enumerated in the README, so the available operations have to be looked up per need.
The tree ships agent instruction files and a codemod directory the README never mentions
The root listing contains a set of entries aimed at tooling rather than at the library's output. `.agents/`, `.claude/`, `CLAUDE.md`, `AGENTS.md` and a `.grit/` directory sit next to `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` and `SECURITY.md`.
That shape says something about how the work gets done. Coding agents are given their own instruction files inside the repository, and a `.grit/` directory implies pattern based changes applied across many files at once. The `codemod/` directory points the same way, and it lines up with the migration story, since rewriting schemas that were written against a different library is exactly the job a codemod exists for.
None of it appears in the README, so anyone assessing the project from the README alone will not know it is there. The practical use is narrow but real: if you intend to contribute, those files are where the conventions live, and the codemod directory is the place to look before hand editing schemas across a large codebase.
Editorial conclusion
Valibot fits a TypeScript codebase that wants runtime checks on unknown data and is willing to compose schemas out of many small imports instead of one large object. Skip it if you want a single bundled helper library, if you need a catalogue of validators you can read off one page, or if your build does not eliminate unused ESM imports. Before porting a Zod suite, read the migration guide and budget for rewriting every schema expression.
Frequently asked questions
Is Valibot better than Zod?
The project argues the difference is structural rather than a matter of degree: Valibot is many small independent functions instead of a few large functions with many methods. Bundle size can be reduced by up to 95 % compared to Zod, and a migration article plus a migration guide are provided.
what is valibot
A schema library for validating structural data, MIT licensed, with no dependencies, able to run in any JavaScript environment. A schema can be executed at runtime to guarantee the type safety of unknown data, which TypeScript types alone cannot do.
valibot vs zod benchmark
No benchmark numbers are published. The only figure given concerns bundle size, and it is qualified: because the API is many small functions, a bundler can remove unused code, which can reduce bundle size by up to 95 % compared to Zod.
valibot vs zod mini
That pairing is not addressed anywhere in the README. The single named comparison point is Zod, together with a migration article and a migration guide aimed at people moving their schemas over.
valibot alternative
No alternative libraries are named. The comparison section contrasts the design against the general pattern of a few large functions with many methods, and Zod is the only specific project referenced.
Official sources
Where developers are discussing it
Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.
- I Compared 6 TypeScript Validation Libraries. Here's What Surprised Me 🤔dev.to · Oct 28, 2026 · 79 points · 39 comments
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/open-circle-valibot)Star history chart for your README
[](https://hysenlabs.com/projects/open-circle-valibot)Was this useful?