ER in Chen notation: entities as boxes, relationships as diamonds, attributes as ovals.The code#
new ChenDiagram({
title: 'Blog (Chen notation)',
entities: [
{ name: 'User', attributes: [{ name: 'id', key: true }, { name: 'email' }] },
{ name: 'Post', attributes: [{ name: 'id', key: true }, { name: 'title' }] },
],
relationships: [
{ name: 'writes', from: 'User', to: 'Post', fromCardinality: '1', toCardinality: 'N' },
],
}).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.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.diagram.save('docs/schema.svg');
Models — the definitions these are drawn from Modified at 2026-10-04 00:40:16