Zod
TypeScript-first schema declaration and runtime validation library with static type inference.
HN commenters use Zod for runtime validation of forms, API routes and API responses on both client and server,123 and as a schema source of truth shared across languages and API contracts.456 The main caveats are reports of suspicious code in the v4.6.6 release78 and complaints that its schema-first approach is harder to read and debug than defining types directly.910
Why people recommend it
Runtime validation · 3
Used to validate forms, API routes, API responses and wire protocols at runtime on client and server.
“I use it heavily for form validation on the client and the server”
“I use Zod for strict schema validation on all API routes”
Show 1 more
“validated with zod on both ends”
Shared schemas · 3
Serves as a single source of truth for data shapes across languages and contract-first APIs.
“I prefer to use Zod or JSON Schema as the source of truth.”
“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”
Show 1 more
“use zod (or your language equivalent) and contract-first API development; this is my favourite bit tbh”
Ecosystem fit · 3
Commenters pair it with Drizzle, Django Ninja with InertiaJS and Vue, and the postgres library.
“I use it heavily for form validation on the client and the server”
“I use Django Ninja, Zod, InertiaJS+Vue”
Show 1 more
“I use it with Zod”
API design · 1
Its API design is credited as influential enough for other libraries to replicate.
“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”
Bundle size · 1
One commenter reports no issues with its bundle size and would use it even without TypeScript.
“Even without TS, I'd be using zod (or a similar library). I haven't had any issues with zod's bundle size”
Caveats and dissent
Compromised release · 2
Commenters flagged a suspicious commit in v4.6.6 and said the compromised code was still tagged on GitHub.
“The compromised code is still tagged on Github”
Schema-first types · 2
Some dislike writing schemas and using derived types, and find it hard to read and debug.
“I don't like zod. I want to define my types, not write schemas.”
“Honestly, it made things worse for me.”
Runtime speed · 1
A build-time compiler project reports 2-74x faster parsing than standard Zod.
“The plugin swaps Zod with compiled parse.”
Limited expressiveness · 1
One commenter says their TypeScript schema typing goes far beyond what Zod can express.
“We're going far beyond what's capable with Zod or ArkType.”
Often compared with
Who recommends it in their own words
Threads where it came up
- Zod 4.6.6 compromised by malware? 2 mentions
- Zod v4.5 adds schema compilation (3-9x faster validation) 2 mentions
- Show HN: I made Leisure Suit Larry 1 multiplayer co-op 1 mention
- Port of the TypeScript compiler, checker and lsp to Rust, by LLM 1 mention
- Protobuf has LSP support. You're welcome 1 mention
- HTML over WebSockets: real-time SPAs with barely any JavaScript 1 mention
Also written as zod. Data: zod.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.
All comments 16
“The compromised code is still tagged on Github”
“it's not looking great”
“validated with zod on both ends”
“We're going far beyond what's capable with Zod or ArkType.”
“I use it heavily for form validation on the client and the server”
“Honestly, it made things worse for me.”
“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”
“I use Django Ninja, Zod, InertiaJS+Vue”
“The plugin swaps Zod with compiled parse.”
“Even without TS, I'd be using zod (or a similar library). I haven't had any issues with zod's bundle size”
“I don't like zod. I want to define my types, not write schemas.”
“use zod (or your language equivalent) and contract-first API development; this is my favourite bit tbh”
“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”
“I use it with Zod”
“I use Zod for strict schema validation on all API routes”
“I prefer to use Zod or JSON Schema as the source of truth.”