Zod
TypeScript-first schema validation.
TypeScript-first schema validation with static type inference — the standard for input validation in TypeScript.
About Zod
Zod is a TypeScript-first schema declaration and validation library. Define a schema once, and Zod will automatically infer the TypeScript type from it — you write your validation and your TypeScript types in one place.
Zod is used extensively in full-stack TypeScript projects to validate API inputs, form data, environment variables, and config files. Libraries like tRPC, React Hook Form (with zodResolver), and Next.js server actions integrate deeply with Zod. It's become the standard way to handle runtime validation in the TypeScript ecosystem.
Zod schemas are composable — you can combine, extend, pick, omit, and transform schemas to build complex types. Error messages are developer-friendly by default but fully customizable. Compared to Yup (a popular alternative), Zod has better TypeScript inference and an API that feels more natural.