Skip to main content

Editor

The relvista editor is a DBML code editor with a live entity-relationship diagram next to it. It runs entirely in your browser: there is no account and no server, and your files never leave your machine.

Open the editor →

What it does​

  • Code: syntax highlighting, live errors and warnings, completion, hover, go to definition, find references and quick fixes for DBML, powered by the official @dbml/parse. Projects split over several files with use / reuse open as tabs.
  • Diagram: updates as you type and keeps the last valid diagram while the code has an error. Drag tables, sticky notes and whole table groups; Shift+click or Shift+drag to select several; pin or collapse a table from its context menu; auto-layout everything that is not pinned. Click a table to jump to its code; put the cursor in a block to highlight its node. Refs are routed around the tables in their way.
  • Edit on the canvas: add and write sticky notes, set colours, mark refs inactive, collapse table groups and manage views without touching the code — each change is written into your DBML, and only the bytes of what you changed move.
  • Explore: search, relationship paths, detail levels and focus, and deep links to any of them.
  • Compare the document with another version: a schema diff on the diagram and in the code.
  • Export: SVG, PNG, a tiled or per-view PDF, print, the DBML file, the layout JSON, and SQL for PostgreSQL, MySQL, SQL Server, Oracle and Snowflake. New ▸ From SQL (or opening a .sql file) imports a SQL schema.
  • Light and dark themes, shared with this site. Works on a phone: below 768 px the code and the diagram become two tabs. On a touch screen, press and hold a table, note, group, ref or the empty canvas to open the menu a right-click opens.

Files and the layout sidecar​

DBML cannot store table positions, so the editor keeps them in a small file next to your schema: schema.dbml gets schema.dbml.layout.json (the layout file the Docusaurus plugin reads too). It is written only after you change the layout: opening and saving a file never creates one.

Open folder is the best way to work. The editor then reads and writes the sidecar silently, and multi-file projects resolve their use imports. The entry file is main.dbml if there is one, otherwise the only .dbml file at the top, otherwise you pick it. When you open a single file instead, the first save that needs a sidecar asks you once where to put it.

You can also open a file from a URL, drop files on the window, or start from one of the gallery examples.

Opening a URL​

Open › Open from URL… or a link to the editor with ?url= downloads a .dbml file from any server that allows cross-origin requests (CORS); GitHub blob links are rewritten to their raw file. Only the .dbml file is requested unless you ask for its layout too, because probing for a layout file that does not exist shows up as a 404 error in the browser console:

LinkLayout
/editor/?url=<file>none: tables are placed automatically
/editor/?url=<file>&layout<file>.layout.json next to it, if there is one
/editor/?url=<file>&layout=<layout file>that file (a full URL, or a path relative to the .dbml)

In the dialog, Also load its layout file does the same as &layout. Encode the file URL (encodeURIComponent) when it has its own query string.

Saving guarantees​

relvista never reformats your file. A file you open and save unchanged is written back byte for byte. When you edit it, only the lines you changed change: the byte order mark, CRLF, LF or mixed line endings and the presence of a final newline are kept. Every example in the repository is checked this way, in twelve variants (line endings, BOM, tabs, trailing whitespace, unicode), on every commit, together with a hand-written file that uses every DBML feature and edge cases such as empty files and a lone CR.

Your work is also autosaved in the browser (IndexedDB). Reloading the page brings back the text, the layout and the view; Open ▸ Restore previous session goes one step further back. If you try to leave with unsaved changes, the browser asks first.

Share copies a link that contains the whole schema, compressed into the part of the URL after #, plus the layout and the current view if you want. The link is never sent to a server: whoever opens it gets the diagram straight from the URL. Very large schemas make long links; past a few megabytes, save the file instead. A link carries one file, so for multi-file projects it shares the entry file only.

Every diagram in these docs has an Open in editor button that does the same thing.

Sticky notes​

Press Note in the diagram toolbar, choose Add note here in the canvas's context menu, or press N with the diagram focused: a new note appears and opens for writing. Double-click a note (or select it and press Enter or F2) to edit its text in place; Mod+Enter or clicking elsewhere keeps the text, Esc cancels. Drag a note's edges to resize it (the size goes into the layout file as w/h); Delete removes the selected notes. Notes are ordinary DBML Note blocks, so dbdiagram.io shows the same notes. Mod+Z in the code undoes a text change, on the diagram a layout change.

Colours and inactive refs​

Right-click a table, group or note (or open its menu with the keyboard) and choose Colour ▸: a palette of twelve swatches, Custom…, or Default to remove the colour. Tables get a headercolor, groups, notes and refs a color setting in the DBML, so the colours travel with the file. Right-click a ref for its colour and Mark inactive / Mark active (an inactive ref is drawn dashed). With several elements of one kind selected, the change applies to all of them. A ref written inline on a column ([ref: > users.id]) has no settings list to write to: its menu says Edit this ref in code.

Collapsing groups​

A collapsed TableGroup shows as one card with its name and table count, and refs to its tables attach to the card. Collapse or expand a group from its menu, by double-clicking its header, or all at once with Collapse all groups / Expand all in the Auto-layout menu. Collapsing them all packs the cards together (one undo step) and fits the view, so a large schema becomes a readable map of its areas; Expand all puts every table back where it was. The state is saved in the layout file (collapsed and the card's position on the group's entry), per view.

Views​

The view menu in the top bar lists the file's DiagramViews, with a filter field when there are more than seven, and manages them:

  • New view from selection — select tables, groups or notes, then name the view;
  • Edit view… — its name, and which tables (grouped by schema), groups, notes and schemas it shows, or All tables;
  • Delete view…;
  • on a table: Add to view ▸ and Remove from view.

Every view keeps its own layout; renaming or deleting a view renames or deletes its layout too. See Diagram views.

Search, path and focus​

Mod+K (or / with the diagram focused, or the magnifier) opens the search over the diagram: tables, columns, enums, groups, notes and views. Picking a result centres and lights it and shows its code without moving your cursor. Path mode lights the shortest chain of refs between two tables. The detail switch (or 1 / 2 / 3) shows table names only, keys, or every column, and is saved in the layout file. Show related ▸ 1 / 2 / 3 hops in a table's menu focuses on its neighbourhood. They work as in the docs: see Exploring diagrams.

The editor's address carries what you are looking at: #view=billing&table=invoices&vp=…. It is kept up to date as you work (without history entries) and applied again on reload, so you can bookmark a place in a schema. A link can combine it with ?url= to open a file and go straight to a table: /editor/?url=<file>#table=orders&hops=1. The keys are the ones of docs deep links. The Share dialog's Include position adds the current table and position to a share link.

Compare​

Compare… in the top bar (Mod+Alt+D) compares the document with another version of it, taken from a file, pasted text, a URL, or — for a file opened from GitHub — another Git ref (branch, tag or commit). The diagram then shows the schema diff: added, removed and changed tables, columns and refs in green, red and amber; a Changes panel lists them (filter, click to go to one); the code pane becomes a side-by-side diff. Edit on: the diff follows. Copy summary copies the changes as Markdown; export gives the toned picture; Esc or Exit compare goes back.

Export​

Export ▾ downloads the diagram as SVG or PNG, opens the PDF… dialog (tiled at print scale, or one page per view; A4 or Letter; see Export and print), prints, and saves the DBML file or the layout JSON. SQL exports go to PostgreSQL, MySQL, SQL Server, Oracle and Snowflake — multi-file projects too. Snowflake records but does not enforce foreign keys and has no enum type or secondary indexes: the export says so in comments and maps enums to VARCHAR. Records blocks become INSERT statements in single-file exports to the first four dialects; Snowflake exports and exports of multi-file projects leave them out (the editor tells you when that happens).

Keyboard shortcuts​

Mod is Cmd on macOS and Ctrl elsewhere. Press ? in the editor for the full list.

KeysAction
Mod+SSave
Mod+Shift+SSave as (Save folder as… for a folder)
Mod+OOpen file
Mod+Z / Mod+Shift+ZUndo / redo (text in the code, else layout)
Mod+Alt+LAuto-layout (keeps pinned tables)
Mod+K, / (diagram focused)Search tables, columns, views; relationship paths
Mod+Alt+DCompare with another version
Alt+1 / Alt+2Focus the code / the diagram
Arrows (Shift: 1 px)Move the selected tables (diagram focused)
EnterShow the focused table's code (diagram focused)
1 / 2 / 3Detail: names / keys / all columns (diagram focused)
NNew sticky note (diagram focused)
Enter / F2Edit the selected sticky note
Mod+Enter / EscFinish / cancel editing a note
Delete / BackspaceDelete the selected sticky notes
Shift+1, +, −Fit, zoom in, zoom out (diagram focused)
EscClose search, clear the highlight, exit focus or compare

Browser support​

BrowserOpen and save
Chrome, Edge, Opera, BraveSaves straight back to your files (File System Access API); recent files.
Firefox, SafariOpens through the file picker; Save downloads the file (same bytes).

Everything else (editing, diagram, share links, export) works the same in every current browser.