Desktop app · PostgreSQL · MySQL · SQL Server · SQLite

Your database, as a living diagram.

xdiagram connects to your database, writes the DBML for you and draws an ER diagram you can edit. Then it shows what the database actually does: the joins your queries make, live activity, and the relationships nobody declared.

Windows 10 and 11 · installers on GitHub Releases · read-only by design

Connects to
  • PostgreSQL
  • MySQL / MariaDB
  • SQL Server
  • SQLite
Imports DDL from
  • pg_dump
  • Oracle
  • Snowflake
  • Rails schema.rb

Features

From a connection string to a diagram you can work with

The diagram is drawn from DBML, the open database markup language. The text is the source of truth, so every change you make on the canvas is an edit to it.

The diagram and the DBML stay in sync

Connect, and the schema is written out as DBML: tables, enums, indexes, checks and notes.

  • Edit the text with autocomplete that knows your tables and columns, plus go to definition and find usages.
  • Or edit the canvas: rename tables and columns, recolour headers, add columns, drag a column onto another to add a relationship.
  • Every edit is one undo step, from the editor or the canvas.
  • Automatic layout. Positions, hidden tables and zoom are remembered for each database.

X-ray · PostgreSQL

Not just the schema you declared: the one you actually use

Every diagram tool draws foreign keys. X-ray reads PostgreSQL's own statistics and overlays what really happens: which tables are joined, how often, and which tables are busy or idle right now.

  • Relationships found in queries. The workload in pg_stat_statements is parsed, and joins that no foreign key backs appear as dashed edges, weighted by how often they run. One click adds the Ref to your DBML.
  • Live activity. Tables glow with reads and writes per second. Idle tables fade, and large tables that are mostly scanned sequentially are flagged.
  • Facts on hover. Row counts, scan patterns, how often each foreign key is joined, and its de facto cardinality: "declared 1:N, in the data 1.0 per parent".
  • Index suggestions. Unindexed foreign keys and discovered joins, columns filtered on large tables, unused and duplicate indexes. Each comes with the SQL.

Check data before you add a constraint. It counts orphan and NULL rows (with examples), then writes the safe migration: CREATE INDEX CONCURRENTLY, the foreign key NOT VALID, then VALIDATE. xdiagram never runs it. You review it and copy it.

Schema lint

Design problems, found before they cost you

Checks that run on the DBML alone, so they work for every engine and for files too.

  • Foreign keys whose type differs from the key they reference, or that point at columns that are not unique.
  • Missing primary keys, unindexed foreign keys, duplicate and redundant indexes.
  • Columns like customer_id with no relationship: add the Ref with one click.
  • Reserved words, names that break the schema's naming style, and very wide tables. Each rule can be switched off.

Explore the data

Look inside the tables without writing SQL

A read-only data panel under the diagram, for every engine.

Browse

Page through rows, sort and filter. Foreign key values are links to the referenced row, "Referenced by" opens the rows that point back, and a trail lets you return.

Profile

Nulls, distinct values, ranges and the most common values of every column, from a sample. Columns that look like personal data (emails, phones, card numbers, IBANs) are flagged and masked.

Query builder

Pick tables and they are joined along the shortest relationship path, outlined on the diagram. Choose columns and filters, copy the SQL, run it read-only.

Export & import

Take the schema anywhere

  • Documentation: one self-contained HTML file with a clickable diagram and search, or GitHub Markdown with a Mermaid diagram.
  • SQL DDL: CREATE scripts for PostgreSQL, MySQL, SQL Server or Oracle. Types, defaults, checks and indexes are translated to the target dialect.
  • Sample data: INSERT scripts with fake but consistent rows that respect foreign keys, keys and unique columns.
  • Import: open a .sql dump or a Rails schema.rb and get the diagram, with no database needed. PNG, SVG and .dbml exports too.

Privacy & safety

Read-only by design

xdiagram looks at your database. It does not change it.

It only reads

Browsing, profiling and X-ray send SELECT queries only, inside read-only transactions with time limits where the engine supports them.

SQL you review

Migrations, index suggestions, DDL and sample data are shown, copied or saved. xdiagram never runs them.

Passwords in your keychain

If you choose to remember a password, database or SSH, it goes to the operating system's credential store. It is never written to a file.

Stays on your machine

No account and no telemetry. Besides the databases you connect to, the app only checks the release feed for new versions, and you can turn that off.

Everything in the box

All the features

  • Four enginesPostgreSQL, MySQL / MariaDB, SQL Server and SQLite. Paste a connection URL, pick schemas, choose SSL modes.
  • SSH tunnelsReach databases behind a bastion host, with a password or a private key. Host keys are checked.
  • Tabs & sessionsSeveral databases and files open at once, each with its own undo; they come back next time.
  • Save & watch filesSave .dbml files in place; changes made by other programs are picked up.
  • DBML editorHighlighting, autocomplete, go to definition, find usages, inline errors.
  • Canvas editingRename, recolour, add columns and tables, drag relationships, undo.
  • Remembered layoutsAutomatic layout; positions, hidden tables and zoom are kept for each database.
  • X-rayJoins found in real queries, live activity, de facto cardinality (PostgreSQL).
  • FK & index advisorOrphan checks, safe migration SQL, index suggestions (PostgreSQL).
  • Schema lintEleven rules, badges on the diagram, one-click fixes for missing relationships.
  • Data browserPaging, sorting, filters, links that follow foreign keys.
  • Column profilesSampled statistics, with personal data flagged and masked.
  • Query builderJoins along relationship paths; SQL in your database's dialect.
  • Command paletteCtrl+K for tables, columns and commands.
  • Big-schema toolsMinimap, detail levels, focus mode, saved views stored in DBML.
  • DocumentationSelf-contained HTML, or Markdown with a Mermaid diagram.
  • ImagesPNG and SVG exports of the diagram.
  • SQL DDL exportPostgreSQL, MySQL, SQL Server and Oracle, translated to the target.
  • Sample dataINSERT scripts that respect foreign keys and unique keys, with a repeatable seed.
  • DDL importpg_dump output, MySQL, SQL Server, SQLite, Oracle, Snowflake, Rails schema.rb.
  • Light & darkFollows your system's theme, or pick one in Settings.
  • Automatic updatesNew versions install in one click, verified against the release signing key.

Download

Get xdiagram for Windows

Installers are published on GitHub Releases: a setup program (.exe) and an .msi package.

  • System Windows 10 or 11, 64-bit
  • Runtime Microsoft Edge WebView2, included with Windows 11 and current Windows 10
  • Version 0.1.0
  • macOS / Linux Built with Tauri, so it can be built from source; these platforms are not tested yet.

FAQ

Questions

Does xdiagram change my database?

No. It reads the catalog and, when you browse, profile or use X-ray, runs read-only SELECT queries with time limits. Anything that would change the database (migrations, index suggestions, DDL, sample data) is only shown to you as SQL to review, copy or save.

Which databases and versions are supported?

PostgreSQL 11 or later, MySQL 8 and MariaDB, SQL Server with SQL logins (Windows authentication is not supported yet), and SQLite files. Without a database, you can open DBML files or import SQL scripts and Rails schema.rb.

What does X-ray need?

A PostgreSQL connection. Live activity, table facts and cardinality work on any PostgreSQL 11+. Finding relationships in queries needs the pg_stat_statements extension, which managed services usually provide. To see other roles' queries, the connecting role needs pg_read_all_stats.

Where are my passwords stored?

Only if you tick "Remember password", and then in your operating system's credential store (Windows Credential Manager). Connection details without passwords are saved in the app's data folder.

Does it work offline?

Yes. Everything runs on your machine. The only network traffic is to the databases you connect to.