# Zod

> TypeScript-first schema validation with static type inference

Source: https://talira.ai/catalog/zod-ptz19tg1
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / validation / schema](https://talira.ai/categories/libraries/validation/schema), [languages / typescript](https://talira.ai/categories/languages/typescript)
- Licence: MIT[^3]
- Pricing: Free and open source[^3]
- Free tier: yes[^3]
- Self-hostable: yes[^4]
- Creator: Colin McDonnell (colinhacks)

Zod is a [TypeScript](https://talira.ai/catalog/typescript-w0asrgz8.md)-first validation library: you define a schema once, parse untrusted data with it, and get back a typed result, with `z.infer` giving you the static type so types and runtime checks don't drift apart. Schemas cover objects, unions, discriminated unions, refinements, transforms and async checks, and failures come back as structured issues with a path for each field. Zod 4 adds built-in JSON Schema conversion, ahead-of-time compilation for hot paths, and Zod Mini, a tree-shakable functional API for small frontend bundles. It implements Standard Schema, so form libraries such as [React Hook Form](https://talira.ai/catalog/react-hook-form-pdfnnrk2.md) and [TanStack Form](https://talira.ai/catalog/tanstack-form-4s0n3sq2.md) and HTTP clients such as [Ky](https://talira.ai/catalog/ky-7jhb33p5.md) accept its schemas. It has no dependencies, runs in Node.js and browsers, and is MIT licensed.

## Links

- Website: https://zod.dev
- GitHub: https://github.com/colinhacks/zod
- Docs: https://zod.dev/api

## Problems it solves

- I write a TypeScript interface and a separate validation function for the same data and they drift apart
- parse JSON from an API or a request body and get a typed object instead of any
- validate request bodies in my Node.js API and reject bad input with field-by-field errors
- check my environment variables at startup and fail fast with a clear message
- generate JSON Schema from my TypeScript validation schemas for OpenAPI docs or LLM structured output
- turn query string values into numbers, booleans and dates while validating them
- share one validation schema between the browser form and the backend
- validate webhook payloads that come in several shapes, picked by a type field
- trim, normalise or convert values as part of validation and get the converted type back
- run an async check, like whether a username is taken, inside a validation schema
- my validation library adds too much to the frontend bundle
- validation is a bottleneck when I parse large arrays of objects on a hot path
- build a validator at runtime from a JSON Schema someone gives me
- show users readable messages for each invalid field instead of one generic error

## Features

- schemas for primitives, objects, arrays, tuples, unions, discriminated unions, records, maps, sets, enums
- parse / safeParse and async variants returning a typed deep clone
- z.infer, z.input and z.output to extract static types
- refinements, transforms, coercion and async validation
- ZodError with structured issues and paths
- z.toJSONSchema(): Draft 2020-12 by default, Draft-07, Draft-04 and OpenAPI 3.0 targets
- z.fromJSONSchema() (experimental)
- z.compile() ahead-of-time compiled fast path
- Zod Mini (zod/mini): tree-shakable functional API
- implements Standard Schema
- zero dependencies; 2kb core bundle (gzipped)
- zod/v3 and zod/v4 permalink subpaths; zod/v4/core for library authors
- also published on JSR as @zod/zod

## Limitations

- Doesn't support TypeScript versions before 5.5: it's tested on TypeScript 5.5 and later and needs strict mode[^1]
- Doesn't convert every schema to JSON Schema: bigint, date, map, set, transform and custom types have no equivalent and throw by default[^2]

## Trust

Overall: 0.23 out of 1.
Signals: backing 0.20, extensibility 0.00.

- created by Colin McDonnell (colinhacks)

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Pydantic](https://talira.ai/catalog/pydantic-5as3qf1q.md): Data validation using Python type hints

## Sources

[^1]: https://zod.dev/ (checked 20 Nov 2026)
[^2]: https://zod.dev/json-schema (checked 20 Nov 2026)
[^3]: https://github.com/colinhacks/zod/blob/main/LICENSE (checked 20 Nov 2026)
[^4]: https://github.com/colinhacks/zod (checked 20 Nov 2026)
