← All Libraries
Zod

Zod

TypeScript-first schema validation with static type inference.

Language: TypeScriptCategory: UtilityFirst released: 2020Created by: Colin McDonnellLicense: MIT

Zod is a TypeScript-first schema declaration and validation library. It allows you to define schemas for your data and automatically infer TypeScript types from them, eliminating duplicate type declarations. Zod works at runtime to validate and parse data, and at compile time to provide accurate type inference. It is widely used for API validation, environment variable parsing, and form validation.

Links

Key Features

Static type inference from runtime schemasComposable schema primitives (string, number, object)Union, intersection, discriminated unionsTransform and refine for custom validation logicZero dependencies, small bundle sizeError formatting with custom messagesAsync refinements for DB queriesNative ESM and CJS dual package