What it does
Parses CREATE TABLE statements (a tolerant common subset of Postgres, MySQL, and SQLite) into tables, typed columns, and foreign keys, then draws an ER diagram as SVG: one box per table with a title bar and one row per column (name TYPE, primary keys highlighted), plus orthogonal arrows from each referenced table down to the table that references it. The layout is deterministic — the same DDL always draws the same diagram, in every port. 100% client-side.
How to use it
- Paste DDL into CREATE TABLE DDL — a sample three-table schema is prefilled and its diagram is already drawn (it ships pre-rendered in the page itself).
- Referenced tables lay out above the tables that reference them; FK arrows are labeled with their column pair.
- Drag to pan; use − / + to zoom and Reset to fit.
- Statements that don’t parse (an
CREATE INDEX, a broken table) appear as chips above the diagram — the rest still draws. - Copy the SVG source or download it as
schema.svg.
Examples
Two tables, one FK — the sample, abridged →
CREATE TABLE users (id INTEGER PRIMARY KEY, email VARCHAR(255) NOT NULL);
CREATE TABLE posts (id SERIAL PRIMARY KEY, user_id INTEGER NOT NULL REFERENCES users(id), title TEXT);
users draws above posts; an arrow runs from the bottom of users to the top of posts, labeled user_id → id.
Tolerant parsing —
CREATE TABLE IF NOT EXISTS,TEMP/UNLOGGED, dotted names (dbo.things) all parse.- Quoted identifiers keep their text:
`order items`and"user id"draw literally. - Table-level
PRIMARY KEY (a, b)andFOREIGN KEY (a, b) REFERENCES u (x, y)mark and pair composites. DEFAULT …,ON DELETE CASCADE,COMMENT '…',CHECK (…),UNIQUE (…)are skipped silently; aREFERENCESwith no target column resolves to the referenced table’s primary key.
Good to know
- Private: parsing and drawing are local — nothing leaves the browser.
- Multi-word types (
TIMESTAMP WITH TIME ZONE,DOUBLE PRECISION) render whole; an unknown word after a type joins it (greedy rule, no type dictionary). - The same logic ships as a Go CLI twin (
cosmodevfoundation) held to the same test vectors — the SVG output is byte-identical across implementations. - Related tools: SQL Playground, CSV to SQL Importer, JSON to SQL INSERT.