Featured sponsor: Jazz
Source URL: https://zod.dev/
TypeScript-first schema validation with static type inference by @colinhacks
Website • Discord • 𝕏 • Bluesky
Zod 4 is now stable! Read the release notes here.
Featured sponsor: Jazz
Section titled “Featured sponsor: Jazz”Interested in featuring? Get in touch.
Zod is a TypeScript-first validation library. Using Zod, you can define schemas you can use to validate data, from a simple string to a complex nested object.
import * as z from "zod";
const User = z.object({ name: z.string(), });
// some untrusted data... const input = { /* stuff */ };
// the parsed result is validated and type safe! const data = User.parse(input);
// so you can use it with confidence :) console.log(data.name);- Zero external dependencies
- Works in Node.js and all modern browsers
- Tiny: 2kb core bundle (gzipped)
- Immutable API: methods return a new instance
- Concise interface
- Works with TypeScript and plain JS
- Built-in JSON Schema conversion
- Extensive ecosystem
npm install zodZod is also available as @zod/zod on jsr.io.
Zod provides an MCP server that can be used by agents to search Zod’s docs. To add to your editor, follow these instructions. Zod also provides an llms.txt file.
Zod is tested against TypeScript v5.5 and later. Older versions may work but are not officially supported.
You must enable strict mode in your tsconfig.json. This is a best practice for all TypeScript projects.
{ // ... "compilerOptions": { // ... "strict": true } }Zod has a thriving ecosystem of libraries, tools, and integrations. Refer to the Ecosystem page for a complete list of libraries that support Zod or are built on top of it.
I also contribute to the following projects, which I’d like to highlight:
- tRPC - End-to-end typesafe APIs, with support for Zod schemas
- React Hook Form - Hook-based form validation with a Zod resolver
- zshy - Originally created as Zod’s internal build tool. Bundler-free, batteries-included build tool for TypeScript libraries. Powered by
tsc.
Sponsorship at any level is appreciated and encouraged. If you built a paid product using Zod, consider one of the corporate tiers.
Cut code review time & bugs in half
API for logos, colors, and company info
The API platform for sending notifications
Generate better SDKs for your APIs
Serverless Postgres — Ship faster
Build AI apps and workflows with Retool AI
Generate best-in-class SDKs
SDKs & Terraform providers for your API