← All tools
Free tool

SQL to TypeScript types generator

Paste PostgreSQL CREATE TABLE statements and get TypeScript interfaces or Zod validation schemas, nullables, arrays, dates, and uuids mapped correctly.

Output:
schema.sql · 33 lines
types.ts · 32 lines
export interface Users {
  id: string;
  email: string;
  name: string;
  created_at?: Date | null;
}

export interface Posts {
  id: string;
  user_id: string;
  title: string;
  body?: string | null;
  created_at?: Date | null;
}

export interface Tags {
  id: string;
  name: string;
}

export interface Comments {
  id: string;
  post_id: string;
  user_id: string;
  content: string;
}

export interface PostTags {
  post_id: string;
  tag_id: string;
}

Frequently asked questions

Related tools

Turn it into an ER diagram

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.