The Bundle Size Problem
Zod is great but ships 14KB minified to every user. For a simple email validation, that's overkill.
Valibot is tree-shakeable. Import only what you use. A simple schema compiles to <1KB.
What Valibot Gives You
Modular API
import * as v from 'valibot';
const UserSchema = v.object({
name: v.pipe(v.string(), v.minLength(1)),
email: v.pipe(v.string(), v.email()),
age: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
});
type User = v.InferOutput<typeof UserSchema>;
Same concept as Zod. Pipe-based API enables tree-shaking — unused validators don't ship.
Parse and Validate
// Throws on error
const user = v.parse(UserSchema, requestBody);
// Safe parse
const result = v.safeParse(UserSchema, requestBody);
if (result.success) {
console.log(result.output.name);
} else {
console.log(result.issues);
}
Transform
const TrimmedEmail = v.pipe(
v.string(),
v.trim(),
v.toLowerCase(),
v.email()
);
const email = v.parse(TrimmedEmail, ' User@EXAMPLE.com ');
// 'user@example.com'
Bundle Size Comparison
| Library | Full Bundle | Simple Schema |
|---|---|---|
| Zod | 14.0KB | 14.0KB |
| Yup | 14.3KB | 14.3KB |
| Valibot | 7.1KB | 0.7KB |
Valibot's modular design means small forms ship tiny bundles.
Framework Integration
Works with: React Hook Form, SvelteKit, Remix, Qwik, Modular Forms — anywhere Zod works, Valibot can replace it.
Quick Start
npm install valibot
Zero dependencies. TypeScript-first.
Why This Matters
Validation is needed everywhere — forms, APIs, config files. Valibot proves you don't have to ship 14KB to every user just to check an email address.
Need validated web data? Check out my web scraping actors on Apify Store — clean, structured data. For custom solutions, email spinov001@gmail.com.
Top comments (0)