What problem does it solve?
Validate and enforce consistent, type-safe input boundaries to prevent invalid or unexpected data from entering your application, reducing runtime errors and security issues.
Core Features & Use Cases
- Schema-based validation: Define reusable, composable Zod schemas for request bodies, query/path parameters, environment variables, and data transformations.
- Type inference and safety: Use z.infer to derive TypeScript types from schemas for end-to-end type safety.
- Integration patterns: Examples for safeParse error handling, Fastify schema conversion (zod-to-json-schema), coercion, async refinements, and environment validation for robust startup checks.
- Use Case: Validate incoming API requests, parse and coerce query parameters, ensure environment variables are present and typed, and return flattened, user-friendly validation errors.
Quick Start
Validate the incoming request body against the CreateUserSchema and return a 400 with flattened validation errors if parsing fails.