Schema documentation
Read this page in the documentation
Schema documentation A table rendered as documentation — columns, types, keys and descriptions in one block. The code 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. <div class="diagram-example"> <!-- Generated by ts-prorm-orm SchemaDocDiagram --> <svg xmlns="http://www.w3.org/2000/svg" width="876" height="366" viewBox="0 0 876 366"><rect width="876" height="366" fill="#ffffff"/><rect x="28" y="28" width="820" height="78" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><text x="50" y="64" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="24" font-weight="bold" fill="#000000">users</text><text x="50" y="86" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="bold" fill="#666666" letter-spacing="1.4">DATA DICTIONARY</text><text x="32" y="136" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="13" font-weight="bold" fill="#666666">1 table, 4 columns</text><rect x="28" y="156" width="820" height="40" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><rect x="28" y="156" width="4" height="40" fill="#000000"/><text x="46" y="183" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="18" font-weight="bold" letter-spacing="0.3" fill="#000000">users</text><text x="834" y="182" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" fill="#666666" text-anchor="end">People who can sign in</text><rect x="28" y="196" width="820" height="30" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><text x="38" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">COLUMN</text><text x="208" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">TYPE</text><text x="348" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">NULLABLE</text><text x="428" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">KEY</text><text x="488" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">DEFAULT</text><text x="618" y="216" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#000000" letter-spacing="1">DESCRIPTION</text><rect x="28" y="226" width="820" height="28" fill="#ffffff"/><text x="38" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">id</text><text x="208" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666">INTEGER</text><text x="348" y="244" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">YES</text><text x="428" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">PK</text><text x="488" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666"></text><text x="618" y="244" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">Surrogate key</text><line x1="28" y1="254" x2="848" y2="254" stroke="#000000" stroke-width="1"/><rect x="28" y="254" width="820" height="28" fill="#f0f0f0"/><text x="38" y="272" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">email</text><text x="208" y="272" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666">VARCHAR(255)</text><text x="348" y="272" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">YES</text><text x="428" y="272" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">UQ</text><text x="488" y="272" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666"></text><text x="618" y="272" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">Login identity</text><line x1="28" y1="282" x2="848" y2="282" stroke="#000000" stroke-width="1"/><rect x="28" y="282" width="820" height="28" fill="#ffffff"/><text x="38" y="300" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">name</text><text x="208" y="300" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666">VARCHAR(100)</text><text x="348" y="300" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">YES</text><text x="428" y="300" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000"></text><text x="488" y="300" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666"></text><text x="618" y="300" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666"></text><line x1="28" y1="310" x2="848" y2="310" stroke="#000000" stroke-width="1"/><rect x="28" y="310" width="820" height="28" fill="#f0f0f0"/><text x="38" y="328" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">orgId</text><text x="208" y="328" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666">INTEGER</text><text x="348" y="328" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">YES</text><text x="428" y="328" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#000000">FK</text><text x="488" y="328" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="12" fill="#666666"></text><text x="618" y="328" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" fill="#666666">Owning organisation</text><line x1="28" y1="338" x2="848" y2="338" stroke="#000000" stroke-width="1"/><rect x="28" y="196" width="820" height="142" fill="none" stroke="#000000" stroke-width="1"/></svg> </div> The closest thing here to a data dictionary — useful when someone outside the team has to read the schema. Saving it generate() returns the SVG as a string; save(path) writes it straight to disk. Related reading Diagram generators — every generator and its options Models — the definitions these are drawn from