Zod preview
zod

Zod

TypeScript-first schema validation with static type inference

42.4k|stable|v4.3.6
import * as z from "zod"; const User = z.object({ name: z.string() }); const data = User.parse({ name: "John" }); console.log(data.name);
Static type inference — Extract TypeScript types directly from schemas using z.infer<>
Error handling — Parse with try/catch or use safeParse for discriminated union results
Async validation — Support for asynchronous refinements and transforms via parseAsync
JSON Schema conversion — Generate JSON Schema specifications from Zod schemas
Zero dependencies — 2kb core bundle with no external dependencies
Zod is the go-to schema validation library for TypeScript projects. Define your schema once and get full type safety at parse time—no separate type definitions needed. The API is minimal and immutable, making it easy to compose complex validations while keeping your code readable.
Node.js or modern browser
Source on GitHub
pavilion