Skip to main content

Why Zod Instead of X

⚠️🚧 Work in Progress
This document is a work in progress. Content may change, and some sections may be incomplete.

JSON Schema

  • Context: Need for runtime validation and TypeScript integration
  • Decision: Use Zod for schema definition
  • Alternatives Considered: JSON Schema, Pydantic (when we were considering using Python)

Rationale:

  • Zod provides TypeScript type inference automatically
  • Runtime validation matches compile-time types exactly
  • Schema definitions are more maintainable in TypeScript
  • Better error messages for developers

Trade-offs:

  • Zod is less universally known than JSON Schema
  • Schemas are tied to TypeScript ecosystem
  • Larger runtime bundle due to Zod dependency