Skip to content

Generate D2 ERD

1. Install D2 CLI

# With --dry-run the install script will print the commands it will use
# to install without actually installing so you know what it's going to do.
curl -fsSL https://d2lang.com/install.sh | sh -s -- --dry-run
# If things look good, install for real.
curl -fsSL https://d2lang.com/install.sh | sh -s --

Check installations for more details

2. Generate D2 ERD content

2. Export to SVG

3. Embedded into Markdown

# Sample D2 ERD

![d2](./target/output.svg)

Sample Output:

d2