SQL Schema to TypeScript & ORM Converter
An interactive SQL schema parser and ORM code generator. Convert CREATE TABLE statements for PostgreSQL, MySQL, and SQLite into strongly-typed TypeScript interfaces, Prisma schemas, Drizzle ORM tables, Kysely interfaces, TypeORM entities, and Zod validation schemas.
How to Convert SQL Schemas to TypeScript & ORM Models
SQL Schema to TypeScript & ORM Converter parses CREATE TABLE DDL statements from PostgreSQL, MySQL, and SQLite dialects and instantly generates strongly-typed TypeScript interfaces, ORM models, and runtime validation schemas.
1. Supported Output Targets
- TypeScript Interfaces: Clean, strongly-typed TypeScript
interfacedeclarations with strict nullability (string | null, optional fields, camelCase/snake_case mapping). - Prisma ORM (
schema.prisma): Native Prismamodeldefinitions including@id,@default(autoincrement()),@unique,@updatedAt, and@@mapattributes. - Drizzle ORM: Ready-to-use Drizzle
pgTablecolumn definitions with chaining methods (.primaryKey(),.notNull(),.unique(),.defaultNow()). - Kysely: Strongly-typed
Databaseinterface andGenerated<T>wrappers for auto-incrementing keys and timestamps. - TypeORM: Decorated class entities (
@Entity(),@PrimaryGeneratedColumn(),@Column(),@CreateDateColumn()). - Zod Schemas: Runtime schema validation objects (
z.object({...})) and inferred TypeScript types (z.infer<typeof schema>).
2. SQL Feature Recognition
- Primary keys (
PRIMARY KEY,SERIAL,AUTO_INCREMENT). - Nullability (
NOT NULL, default nullable). - Unique constraints (
UNIQUE). - Foreign key references (
REFERENCES table(col)). - SQL Data Types:
INT,BIGINT,VARCHAR,TEXT,BOOLEAN,TIMESTAMP,DATETIME,DECIMAL,FLOAT,UUID,JSON,JSONB.
Key Features
- Multi-Target Code Generation: Convert SQL
CREATE TABLEDDL directly into TypeScript interfaces, Prisma models, Drizzle ORM, Kysely, TypeORM, and Zod schemas. - Smart Constraint Recognition: Auto-detects
PRIMARY KEY,AUTO_INCREMENT,SERIAL,NOT NULL,UNIQUE,DEFAULT, andREFERENCESforeign keys. - Case Conversion Options: Easily convert column names from
snake_casetocamelCasewhile keeping table mapping metadata intact. - Multi-Dialect Support: Compatible with PostgreSQL, MySQL / MariaDB, and SQLite DDL syntax.
Common Use Cases
- Legacy Database Migration: Converting legacy relational database
CREATE TABLEscripts directly into modern Prisma, Drizzle, Kysely, or TypeORM schemas. - Full-Stack Type Safety: Instantly generating TypeScript interfaces from SQL dump files for frontend and API route typing.
- Runtime API Validation: Converting SQL table definitions into Zod validation schemas for validating API request bodies against database constraints.
- ORM Switching & Evaluation: Comparing how database schema models look across different TypeScript ORMs (Prisma vs. Drizzle vs. Kysely vs. TypeORM).
Frequently Asked Questions
Does this tool process my database schema locally?
Yes! SQL parsing and model generation occur 100% inside your web browser. No database credentials or raw SQL schemas are sent to any external server.
Can I preserve my original SQL column names?
Yes! Toggle the Convert column names from snake_case to camelCase option on or off to choose between createdAt or created_at.
Related Tools
GraphQL Query Builder & Request Tester
Visually construct GraphQL queries, select nested fields, test live endpoints, and export Apollo or Fetch code.
Mock API & Data Generator
Build custom REST schemas, generate realistic mock JSON data, test simulated endpoints, and export MSW or Express code.
JSONPath Explorer & Evaluator
Query, evaluate, filter, and extract nodes from JSON payloads with an interactive tree view.
JSON Formatter
Pretty print, format, and sort keys of your JSON data.
