📁 Drag & drop .sql file here
Supports .sql files, all parsing happens locally
This tool automatically converts SQL CREATE TABLE DDL statements into TypeScript interface definitions, saving you from manually writing interfaces. It supports common MySQL and PostgreSQL data types, automatically handles nullable fields, default values, primary key constraints, and generates code ready for use in TypeScript projects.
1. Paste your CREATE TABLE statements in the input area, or click "Load Example" to auto-fill sample SQL. 2. Adjust options based on project needs: export keyword, nullable handling style, interface naming prefix, etc. 3. Click "Generate Interfaces" or see real-time preview as you type. 4. Click "Copy Code" to copy the result, or "Download .ts" to save directly. Supports Ctrl+Enter shortcut for quick generation.
After designing database table structures, quickly generate TypeScript interface definitions to maintain type consistency between frontend and backend, avoiding omissions and typos from manual writing.
Export DDL from existing databases, then batch-generate TypeScript interfaces as a type foundation for TypeORM, Prisma, and other ORM frameworks.
Generate interfaces from database schemas for use as request/response type definitions in Express/NestJS frameworks, improving code maintainability.
SQL to TypeScript type mapping is not one-to-one. SQL's DECIMAL/NUMERIC typically maps to number in TS, but precise calculation scenarios may need bigint or decimal.js. TIMESTAMP can map to Date or string (ISO format) depending on project preferences. JSON type maps to any for convenience but loses type safety — consider manually refining based on actual data structures. MySQL's UNSIGNED modifier has no direct TS equivalent and is usually ignored.
INT/BIGINT→number, VARCHAR/TEXT→string, BOOLEAN→boolean, DATE/TIMESTAMP→Date|string, JSON→any, DECIMAL→number and other common type mappings with customizable rules.
The tool auto-detects NOT NULL constraints. Nullable fields use optional property (?:) syntax by default. Enable "Nullable as |null" to use union type syntax instead.
Yes. Paste multiple CREATE TABLE statements and the tool generates a separate TypeScript interface for each table.
Yes. The generated TypeScript interfaces follow standard syntax and can be copied directly into .ts files. Adjust type mappings as needed.
Yes. The tool handles common DDL syntax from both MySQL and PostgreSQL, including AUTO_INCREMENT, SERIAL, UNSIGNED modifiers.
No. All SQL parsing and TypeScript generation happens locally in your browser. No data is ever sent to any server.