Wilmar Rojas Avendaño4k downloadsRender dbml code blocks as interactive entity-relationship diagrams with dbdiagram.io-style orthogonal routing.
Obsidian plugin that renders ```dbml code blocks as interactive entity-relationship diagrams, with orthogonal, dbdiagram.io-style routing (right-angle lines), crow's-foot notation (crow's foot / bar) and direct editing on the canvas.
dbml-erdYou write a ```dbml block with your tables and relationships and the plugin draws it as an SVG ERD, with automatic layout, cardinality markers and interactive editing. Every change you make from the diagram (rename, move, color, cardinality, delete…) is written back into the note's own dbml block — the block is the single source of truth.
dbml / DBML blocks to an SVG ERD.elk.layered) that minimizes crossings.│) if the FK is not null, or a circle (○) if it is nullable.NN badge for not null columns.TableGroup is drawn as an area: a box with a colored header bar and a light background that wraps its tables. The layout keeps the tables of an area together.+ / − / ⊡ (fit) buttons.Everything is saved back to the dbml block:
id primary key, in the middle of the view.table.col references).+ handle in the middle of a segment.The interface (menus, dialogs and notices) is available in English (default) and Spanish. Switch it under Settings → Community plugins → DBML ER Diagrams → Language.
Insert a code block with the dbml language:
```dbml
// height: 600
Table contract {
contract_id int [pk]
contract_name varchar(120) [not null]
client_id int [not null]
status varchar(20)
}
Table client {
client_id int [pk]
name varchar(100) [not null]
}
Ref: contract.client_id > client.client_id
```
Table name { ... } (keyword in any case, and the short form name { ... }).name type [pk, not null, note: '...', ref: > other.col], one per line.Ref: a.col > b.col line (optionally named, Ref fk_name: ...), the long form Ref { a.col > b.col }, inline ref: > b.col, or the direct form a.col <> b.col.> (many→one), < (one→many), <> (many↔many), - (one↔one).Table name [headercolor: #2E7D32] { ... }.TableGroup name [color: #2E7D32] { table1 table2 }, one table name per line. A table belongs to the first area that lists it; names that don't match a table are ignored.Note: '...', note: '...') are accepted and kept in the block, but not drawn in the diagram.// height: N directive (canvas height in px).// and /* ... */ comments.indexes { }, enum, Project and sticky Note blocks are accepted and ignored.TableGroup sales [color: #2E7D32] {
client
contract
}
A deliberate subset of DBML, enough for controlled schemas. It does not yet include enums or composite keys.
The plugin stores the visual state as comments inside the block; you don't need to edit them by hand:
// @pos <table> <x> <y> — position of a moved table.// @view <x> <y> <zoom> — pan and zoom.// @size <w> <h> — canvas size.// @edge <from> <fromCol> <to> <toCol> <x1> <y1> … — vertices of a hand-edited route.// @group <area> collapsed — a collapsed work area.sql-to-dbml skill)So you don't have to write the DBML by hand there is a Claude Code skill, sql-to-dbml, that converts SQL CREATE TABLE scripts (ANSI, SQL Server, PostgreSQL or MySQL) — or tables you define during the conversation — into DBML compatible with this plugin (it degrades to what the plugin draws, never emitting syntax it can't understand).
Paste the resulting block into a note inside ```dbml and the plugin renders it.
main.js, manifest.json and styles.css from the latest release.<vault>/.obsidian/plugins/dbml-erd/.npm install
npm run dev # build with inline sourcemaps
npm run build # minified production build
npm test # parser, block mutators, work areas and layout tests
Code structure:
src/main.ts — plugin, block rendering and the Diagram class (SVG, interaction, persistence).src/parser.ts — DBML parser (subset) and block mutators (rename, types, cardinality, delete).src/layout.ts — layout with elkjs and geometry constants.src/areas.ts — work areas (table groups) without DOM: boxes, cardinality marks and edges to collapsed areas.src/edits.ts — structural block edits without DOM (create tables and areas, edit areas, move tables between areas, pin positions).src/i18n.ts — interface strings (English/Spanish) and the t() lookup.test/ — tests with Node's built-in runner; npm test bundles the modules with esbuild first.styles.css — styles integrated with Obsidian's theme variables.Releases are produced with GitHub Actions (.github/workflows/release.yml).
To publish a new version: bump version in manifest.json and package.json,
add the entry to versions.json and CHANGELOG.md, create a tag with that exact
number (no v prefix) and push it:
# use the exact number from the manifest, without the v prefix
git tag 0.1.19
git push origin 0.1.19
The workflow compiles and attaches main.js, manifest.json and styles.css to the release.
MIT © 2026 Wilmar Rojas Avendaño