SQL DDL to TypeScript
Parses CREATE TABLE across PostgreSQL, MySQL and SQLite spellings. NOT NULL, PRIMARY KEY and SERIAL columns are required; everything else is nullable. Constraint lines are skipped.
SQL DDL to TypeScript — Free Online Tool
Converts SQL CREATE TABLE statements into TypeScript interfaces, mapping SQL types to string, number, boolean, Date and Buffer across PostgreSQL, MySQL and SQLite spellings, marking nullable columns as optional or union with null, converting snake_case columns to camelCase properties, and turning table names into PascalCase interface names.
How to use the SQL DDL to TypeScript
- Open the tool above — it runs entirely in your browser, so your input never leaves this page.
- Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
- Copy the result from the output area with the copy button orCtrl/Cmd + C.
- No signup, no upload, and no tracking — repeat as often as you need.
Frequently asked questions
Which SQL dialects does it understand?
PostgreSQL, MySQL/MariaDB and SQLite spellings all parse — SERIAL, AUTO_INCREMENT, BYTEA, JSONB, TIMESTAMPTZ, NVARCHAR and the rest map onto the closest TypeScript type. Constraint lines such as FOREIGN KEY and CHECK are skipped rather than treated as columns.
Why is a column optional when the database allows NULL?
That is the default because most query builders omit null columns from a row object. Switch to the T | null style when your driver always returns the key with an explicit null — pg and mysql2 both do.
Why is a JSON column typed unknown?
The DDL says only that the column holds JSON, not what shape. unknown forces you to narrow it at the point of use rather than trusting an invented interface — replace it with the real type once you know it.
Free & private — why use this SQL DDL to TypeScript
The SQL DDL to TypeScript runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.