Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 7, 2026·1 min de lectura

Zod — TypeScript-First Schema Validation

TypeScript-first schema declaration and validation library. Define a schema once, get type inference, runtime validation, and serialization. The standard for TypeScript data validation. 35,000+ stars.

Introducción

Zod is a TypeScript-first schema declaration and validation library with 35,000+ GitHub stars. Define a schema once and get both TypeScript type inference and runtime validation. Used by tRPC, Vercel AI SDK, React Hook Form, and Drizzle ORM. Best for TypeScript developers who want type-safe validation at API boundaries. Works with: any TypeScript project. Setup time: instant.


Core Features

Type Inference from Schema

const Schema = z.object({ name: z.string(), age: z.number() });
type T = z.infer<typeof Schema>; // { name: string; age: number }

API Validation

const body = CreatePostSchema.parse(await req.json());

AI SDK Integration

const { object } = await generateObject({
  model: anthropic("claude-sonnet-4-20250514"),
  schema: z.object({ summary: z.string(), keywords: z.array(z.string()) }),
  prompt: "Analyze...",
});

Key Stats

  • 35,000+ GitHub stars
  • Zero dependencies, 12KB
  • Used by tRPC, AI SDK, React Hook Form

FAQ

Q: What is Zod? A: TypeScript-first schema library providing both compile-time type inference and runtime validation from a single schema definition.

Q: Is Zod free? A: Yes, MIT license.


🙏

Fuente y agradecimientos

Created by Colin McDonnell. Licensed under MIT.

zod — stars 35,000+

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados