Five formats, every direction
Choose the source at the left and the target at the right. SQL DDL, TypeScript, Zod, Pydantic v2 and JSON Schema all parse and all generate, so any pair works — including SQL to Zod and Pydantic to TypeScript.
Five schema formats · any direction · no upload
Write the shape of your data once. SchemaForge reads SQL DDL, TypeScript types, Zod objects, Pydantic v2 models and JSON Schema, turns any of them into one neutral model, and writes the other four from it — while you type. Optional and nullable fields, defaults, VARCHAR lengths, numeric bounds, CHECK enums and doc comments are carried across instead of being flattened away. No account, no upload, no server call: the parser and the generators are JavaScript in this tab.
Nothing is uploaded. Conversion happens on every keystroke, and the diagnostics list shows what the neutral model could not hold.
Features
Six things, all without a server.
Choose the source at the left and the target at the right. SQL DDL, TypeScript, Zod, Pydantic v2 and JSON Schema all parse and all generate, so any pair works — including SQL to Zod and Pydantic to TypeScript.
Every field becomes a name, a type, whether it may be null, whether it may be omitted, its default, length, numeric bounds, pattern, enum values and comment. Generation reads that model, not the original text.
A column with DEFAULT is optional but not null; a nullable column is null but not omitted. Each target gets the right spelling: ? and | null, .optional() and .nullable(), Optional[...] and = None.
Keep the names as written, or convert every field to snake_case, camelCase or PascalCase in all targets at once. Identifiers that would be invalid in the target language are made valid and the change is reported.
VARCHAR(120) becomes .max(120) and max_length=120 and maxLength: 120. CHECK (status IN (...)) becomes a Zod enum, a TypeScript literal union, a Pydantic Literal and a JSON Schema enum.
A syntax error names the line and column it stopped at. Things the neutral model cannot hold — a foreign key, an unusual CHECK expression — are listed as warnings instead of disappearing.
How it works
The converter is one page and runs on every keystroke.
SQL, TypeScript, Zod, Pydantic or JSON Schema. Loading a sample shows the expected syntax for that format.
Paste the table, interface, z.object or model. Conversion runs as you type; nothing is submitted.
Pick the output format, the key case, and whether defaults and nullable fields become optional.
The result is syntax-highlighted text with a copy button and a download in the target's own extension: .ts, .py, .sql or .json.
Coverage
One model, five dialects. The notes say where a dialect stops.
| Format | Reads | Writes | Notes |
|---|---|---|---|
SQL DDL | CREATE TABLE with column types, NOT NULL, NULL, DEFAULT, PRIMARY KEY, UNIQUE, CHECK (col IN (...)), REFERENCES, -- and /* */ comments | CREATE TABLE per model, VARCHAR(n), NUMERIC, BOOLEAN, TIMESTAMP, DATE, UUID and JSON columns, CHECK IN for enums | Generic, PostgreSQL-flavoured syntax. Table names are the plural snake_case of the model name. |
TypeScript | export interface and type X = { … }, ? optional, | null, string-literal unions, T[] and Array<T>, inline nested objects, // and /** */ comments | export interface per model with JSDoc comments, primitives, arrays, literal unions and nested object types | Types describe JSON payloads, so a timestamp is string and an integer is number. |
Zod | z.object with .optional(), .nullable(), .default(), .min(), .max(), .int(), .regex(), .email(), .describe(), z.enum, z.array, z.literal | z.object chains plus an exported z.infer type alias per model | Zod v3 method names. Objects are .strict() when the strict option is on. |
Pydantic v2 | class X(BaseModel): with annotations, Optional[...], | None, Literal[...], list[...], dict[...], Field(...) with max_length, ge, le and pattern | BaseModel classes with Field(...) constraints, Literal unions and model_config = ConfigDict(extra="forbid") when strict | Pydantic v2 spelling (ConfigDict). v1’s class Config is not generated. |
JSON Schema | Draft 2020-12 objects: properties, required, type, enum, const, format, min/max, minLength/maxLength, pattern, items, $defs and local $ref | One Draft 2020-12 document, every extra model in $defs, the first model as the entry point | additionalProperties: false when the strict option is on; type arrays for nullable scalars. |
Anything a format cannot express is reported, not guessed: a foreign key, an unusual CHECK expression or a nested object written to a SQL table appears in the diagnostics list next to the output.
Under the hood
Each source is parsed into the same small model, and each target is written from that model.
The parsers are small hand-written readers, one per format. The SQL reader walks the statements of a CREATE TABLE, takes the type before the first option keyword and then reads NOT NULL, DEFAULT, PRIMARY KEY, UNIQUE and CHECK (col IN (...)) in any order. The TypeScript reader takes the brace-matched body of an interface or type alias and splits fields at top-level semicolons. The Zod and Pydantic readers follow method chains and indentation respectively, and the JSON Schema reader is a JSON parse followed by a walk over properties, $defs and $ref.
All five land on the same model: a list of models, each with a list of fields. A field carries a name, a type node, and three independent flags — required, nullable and optional — plus a default, a comment and any constraints the source expressed. Keeping required, nullable and optional apart is what lets OPTIONAL survive a trip from SQL (NOT NULL, DEFAULT NULL) to TypeScript (name?: string | null) and back.
Generation is the mirror image. Names are converted with the case option, defaults are turned into initialisers or left out, enums become the target's own construct, and comments become whatever documentation the target has — JSDoc for TypeScript and Zod, docstrings for Pydantic, -- lines for SQL and description for JSON Schema.
Questions
No. Parsing and generation are JavaScript in this page: there is no fetch, no XHR and no beacon in the tool, which you can confirm in your browser's network panel. Only the advertising script in the page head is loaded from outside. Your last schema and options are kept in this browser's localStorage so a reload does not lose your work; clear site data to remove them.
They answer different questions. Nullable asks whether the value may be null; optional asks whether the field may be missing altogether. A SQL column with a DEFAULT is normally optional but not nullable, and an API payload may have a key that is always present but may be null. Keeping them apart produces the right output — name?: string | null, z.string().nullable().optional(), Optional[str] = None — and the two options let you collapse them if your project treats them as one.
They are reported. A FOREIGN KEY, an unknown CHECK expression or an unsupported type is listed in the diagnostics list with the field name, so nothing is silently dropped. Foreign keys are the clearest case: a table relation is not a value shape, so SchemaForge does not invent a reference type for it.
SQL has no portable enum, so CHECK (col IN ('a','b')) is read as an enum and written back the same way. In between it becomes a Zod z.enum, a TypeScript string-literal union, a Pydantic Literal[...] and a JSON Schema enum. A VARCHAR with no CHECK stays a plain string.
For the constructs listed in the coverage table, yes — the same model is produced from generated code as from the original. Outside that set it does not: vendor-specific types, table options, indexes, constraints in prose and Pydantic validators are not part of the model, so they do not come back. Treat the output as a starting point and diff it against your original before committing.
A generic one that leans PostgreSQL: VARCHAR(n), NUMERIC(p,s), BOOLEAN, TIMESTAMP, DATE, UUID and JSON columns, quoted identifiers, several statements separated by semicolons. It will not read every vendor extension, and it writes no dialect-specific clause that another database would reject silently.
Honest limits
CREATE TABLE is read. ALTER TABLE, views, indexes, sequences, generated columns and dialect-specific types are not, and a file containing them should be reduced to the CREATE TABLE statements you care about.
Foreign keys are reported as warnings rather than turned into references, because none of the other four formats describes a database relation. Composite keys are read but only the primary-key flags survive.
A timestamp becomes string in TypeScript, datetime in Pydantic and format: date-time in JSON Schema; an object nested in a row becomes a JSON column in SQL. Sensible defaults, but your project may want different ones.
Table names are pluralised with English rules, field order follows the source, and the output is formatted for reading. Check names against your conventions, then run your own type checker or linter over the result.