
What is Zod?
Zod is a TypeScript-first validation library that lets you define schemas and parse data with them. You’ll get back strongly typed, validated results.Key Features
Zero Dependencies
No external dependencies. Works in Node.js and all modern browsers.
Tiny Bundle Size
Core bundle is just 2kb minified and gzipped.
TypeScript-First
Define a schema once and Zod automatically infers the static TypeScript type.
Immutable API
Methods like
.check() return a new instance, keeping your schemas immutable.Works with Plain JS
You don’t need to use TypeScript. Zod works with plain JavaScript too.
Built-in JSON Schema
Convert your Zod schemas to JSON Schema for interoperability.
Get Started
Installation
Install Zod using npm, yarn, pnpm, or bun
Quick Start
Learn the basics with a hands-on tutorial
Primitives
Explore string, number, boolean, and other basic types
Objects
Define complex object schemas with nested structures
Why Zod?
With Zod, you declare a validator once and automatically get:- Static type inference - No duplicate type declarations
- Runtime validation - Catch data errors at runtime
- Detailed error messages - Know exactly what went wrong
- Developer-friendly API - Concise, chainable interface
