Skip to content

colinhacks/zod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zod logo

Zod

https://zod.dev
TypeScript-first schema validation with static type inference


Zod CI status Created by Colin McDonnell License npm stars

Documentation   •   Discord   •   npm   •   deno   •   Issues   •   @colinhacks   •   tRPC


clerk announcement


Table of contents

These docs have been translated into Chinese.

Introduction

Zod is a TypeScript-first schema declaration and validation library. I'm using the term "schema" to broadly refer to any data type, from a simple string to a complex nested object.

Zod is designed to be as developer-friendly as possible. The goal is to eliminate duplicative type declarations. With Zod, you declare a validator once and Zod will automatically infer the static TypeScript type. It's easy to compose simpler types into complex data structures.

Some other great aspects:

  • Zero dependencies
  • Works in Node.js and all modern browsers
  • Tiny: 8kb minified + zipped
  • Immutable: methods (e.g. .optional()) return a new instance
  • Concise, chainable interface
  • Functional approach: parse, don't validate
  • Works with plain JavaScript too! You don't need to use TypeScript.

Sponsors

Sponsorship at any level is appreciated and encouraged. If you built a paid product using Zod, consider one of the corporate tiers.


Diamond


clerk logo

The most comprehensive User Management Platform
clerk.com



Platinum

Neon
Serverless Postgres — Ship faster
neon.tech

stainless
Build AI apps and workflows with Retool AI
retool.com

stainless
Generate best-in-class SDKs
stainlessapi.com

speakeasy
SDKs & Terraform providers for your API
speakeasy.com


Gold

PropelAuth
PropelAuth
Cerbos
Cerbos
Scalar.com logo
Scalar
Trigger.dev logo
Trigger.dev
Transloadit logo
Transloadit
Infisical logo
Infisical
Whop logo
Whop
CryptoJobsList logo
CryptoJobsList
Plain logo
Plain.
Inngest logo
Inngest
Storyblok CMS
Storyblok
Mux logo
Mux

Silver

val town logo route4me logo Encore.dev logo Replay.io logo
Numeric logo Marcato Partners
Bamboo Creative logo Jason Laster

Bronze