Every model in one picture, with the foreign keys drawn between them. The one to reach for when explaining a schema to someone.The code#
import { ERDiagram } from 'ts-prorm-orm';
const svg = new ERDiagram({
title: 'Blog schema',
models: [User, Post, Tag], // the same option objects you pass to define()
columns: 3,
}).generate();
What it produces#
Generated by running the snippet above — this is the generator's real output,
rebuilt by scripts/build-diagram-examples.mjs, not a picture of it.Takes the same shape as define(), so you can generate one from the model definitions you already have. columns controls the grid width.Saving it#
generate() returns the SVG as a string; save(path) writes it straight to
disk.diagram.save('docs/schema.svg');
Models — the definitions these are drawn from Modified at 2026-10-04 00:40:16