SQL DDL to TypeScript Converter
Convert SQL CREATE TABLE statements to TypeScript interfaces. Maps SQL types to TS types, handles nullable columns, arrays, JSON, and UUIDs.
Your data never leaves your browser
Available via MCP
How to Use
- Paste your SQL
CREATE TABLEstatements into the left panel. - Optionally toggle Optional for nullable fields to use
?syntax. - Click Convert to TypeScript.
- Copy the generated interfaces with the Copy button.
Type Mapping Reference
INT, SERIAL, BIGINT, FLOAT, DECIMAL→numberVARCHAR, TEXT, CHAR, UUID→stringBOOLEAN, BOOL→booleanTIMESTAMP, DATE, DATETIME→DateJSON, JSONB→Record<string, unknown>BYTEA, BLOB→BufferTEXT[]→string[]
Related Tools
Format SQL queries with the SQL Formatter. Convert SQL to MongoDB with SQL to NoSQL. Generate TypeScript from JSON with JSON to TypeScript. Generate TypeScript from OpenAPI specs with OpenAPI to TypeScript. Generate JSON schemas with the JSON Schema Generator.
Frequently Asked Questions
- What SQL dialects are supported?
- This tool parses standard CREATE TABLE statements compatible with PostgreSQL, MySQL, SQLite, and SQL Server. It handles column types, NOT NULL constraints, and DEFAULT values.
- How are SQL types mapped to TypeScript?
- INT/SERIAL → number, VARCHAR/TEXT → string, BOOLEAN → boolean, TIMESTAMP/DATE → Date, JSONB → Record<string, unknown>, BYTEA/BLOB → Buffer, UUID → string, and arrays like TEXT[] → string[].
- How are nullable columns handled?
- By default, nullable columns get "| null" added to their type. You can toggle "Optional for nullable fields" to use "?" instead, which is better for insert types where you want to omit nullable fields.
- Is my data safe?
- Yes. All SQL parsing and TypeScript generation happens entirely in your browser. No data is sent to any server.
Use this tool from AI agents.
The CodeTidy MCP Server lets Claude, Cursor, and other AI agents
use this tool and 46 others directly. One command: npx @codetidy/mcp