← Stack
LEARNING·Since 2026

Zod

Schema validation, runtime type checking

About

A TypeScript-first schema validation library. Defines schemas that validate data at runtime and automatically infer TypeScript types — bridging the gap between compile-time types and runtime values from APIs, forms, or databases.

Why

TypeScript types are a compile-time illusion — at runtime they're gone. Zod validates what actually arrives from outside the system.

Notes

Define a schema, attach it as a NestJS Pipe, done. If the shape doesn't match it fails at the boundary — not somewhere deep in the call stack two minutes later.

The narrowing at the entry point means everything inside trusts the types. That's the right contract.