What is SchemaBridge?
One tool to keep your TypeScript Zod schemas and Python models in sync. Define your schemas once in Zod; SchemaBridge generates Pydantic models and .d.ts types for you.
Why it exists
Section titled “Why it exists”Copying schemas between TypeScript and Python leads to drift and bugs. I hit this in TypeScript-first projects that later added Python services. JSON Schema detours and hand-ported models never stayed in sync. SchemaBridge removes the manual work so both sides stay aligned.
The idea in 10 seconds
Section titled “The idea in 10 seconds”- You define Zod schemas.
- SchemaBridge turns them into Pydantic models (and optional
.d.tsfiles). - Use it from the CLI, in build scripts, or over a whole folder.
Tiny example
Section titled “Tiny example”Input (TypeScript, Zod v4):
import { z } from 'zod';
export const userSchema = z.object({ id: z.string().uuid(), name: z.string(), email: z.string().email(), birthdate: z.date().optional(), role: z.enum(['admin', 'viewer']),});Output (Python, Pydantic v2):
from pydantic import BaseModelfrom typing import Literal, Optionalfrom uuid import UUID
class UserSchema(BaseModel): id: UUID name: str email: str birthdate: Optional[date] = None role: Literal["admin", "viewer"]What you can do
Section titled “What you can do”- Convert one schema:
schemabridge convert zod schema.ts --export userSchema --to pydantic - Convert a folder:
schemabridge convert folder ./src/schemas --out ./generated --to pydantic --init - Automate: Call the Node API in your build to keep models in sync.
Ready to try?
Section titled “Ready to try?”Start here: Getting Started →