Chen diagram

Read this page in the documentation

Chen diagram ER in Chen notation: entities as boxes, relationships as diamonds, attributes as ovals. 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 ChenDiagram --> <svg xmlns="http://www.w3.org/2000/svg" width="697" height="337" viewBox="0 0 697 337"><rect width="697" height="337" fill="#ffffff"/><text x="48" y="48" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="26" font-weight="bold" fill="#000000">Blog (Chen notation)</text><line x1="198" y1="252" x2="348" y2="252" stroke="#000000" stroke-width="1"/><line x1="348" y1="252" x2="498" y2="252" stroke="#000000" stroke-width="1"/><polygon points="348,215 413,252 348,289 283,252" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><text x="348" y="257" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="14" font-weight="bold" fill="#000000" text-anchor="middle">writes</text><text x="246" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="13" font-weight="bold" fill="#000000" text-anchor="middle">1</text><text x="450" y="244" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="13" font-weight="bold" fill="#000000" text-anchor="middle">N</text><line x1="198" y1="252" x2="107.89318838178774" y2="182.99999999999997" stroke="#000000" stroke-width="1"/><ellipse cx="107.89318838178774" cy="182.99999999999997" rx="52" ry="24" fill="#ffffff" stroke="#000000" stroke-width="1"/><text x="107.89318838178774" y="186.99999999999997" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#000000" text-anchor="middle" text-decoration="underline">id</text><line x1="198" y1="252" x2="288.1068116182123" y2="183" stroke="#000000" stroke-width="1"/><ellipse cx="288.1068116182123" cy="183" rx="52" ry="24" fill="#ffffff" stroke="#000000" stroke-width="1"/><text x="288.1068116182123" y="187" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="400" fill="#000000" text-anchor="middle">email</text><line x1="498" y1="252" x2="407.89318838178775" y2="182.99999999999997" stroke="#000000" stroke-width="1"/><ellipse cx="407.89318838178775" cy="182.99999999999997" rx="52" ry="24" fill="#ffffff" stroke="#000000" stroke-width="1"/><text x="407.89318838178775" y="186.99999999999997" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#000000" text-anchor="middle" text-decoration="underline">id</text><line x1="498" y1="252" x2="588.1068116182123" y2="183" stroke="#000000" stroke-width="1"/><ellipse cx="588.1068116182123" cy="183" rx="52" ry="24" fill="#ffffff" stroke="#000000" stroke-width="1"/><text x="588.1068116182123" y="187" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="400" fill="#000000" text-anchor="middle">title</text><rect x="123" y="219" width="150" height="66" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><text x="198" y="257" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="17" font-weight="bold" fill="#000000" text-anchor="middle">User</text><rect x="423" y="219" width="150" height="66" fill="#f0f0f0" stroke="#000000" stroke-width="1"/><text x="498" y="257" font-family="ui-sans-serif, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="17" font-weight="bold" fill="#000000" text-anchor="middle">Post</text></svg> </div> Chen notation is more common in data-modelling and academic contexts than crow’s foot; the information is the same. 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