SchemaFlex

Point it at a database.
Get back an ERD you can just open.

SchemaFlex is a command-line tool that connects to a relational database, reads its schema, and writes a single self-contained HTML file with an interactive Entity-Relationship Diagram viewer. Open it in any browser — no server, no account, no install for the person you send it to.

Windows, Linux and macOS. PostgreSQL, SQL Server, MySQL/MariaDB and SQLite are all supported today. All platforms →

> schemaflex --connection "Host=localhost;Username=postgres;Database=mydb"

What it does

A diagram, not a dashboard

Run SchemaFlex from a terminal against a connection string and it produces an .html file — erd.html by default. That file is the whole deliverable: the schema is read once, serialized to JSON, and embedded directly alongside a bundled viewer, so the result is fully portable. Email it, commit it to a wiki, drop it in a ticket — whoever opens it sees your tables, columns, keys and relationships without connecting to anything.

Supported databases

Auto-detected from the connection string

No --provider flag to remember — SchemaFlex works out which database it's talking to from the shape of the connection string you give it.

PostgreSQL via Npgsql
SQL Server via Microsoft.Data.SqlClient
MySQL / MariaDB via MySqlConnector
SQLite via Microsoft.Data.Sqlite

What's included

Everything the viewer needs to explain your schema

For every table in the target schema, SchemaFlex reads:

Tables & columns

Names, data types, nullability and default values for every column.

Primary keys

Marked on every table so the identity of each row is obvious at a glance.

Foreign keys & relationships

Drawn as edges between tables, so the diagram is a real ERD, not just a table list.

Indexes

Including which columns each index covers and whether it's unique.

Check constraints

The rule text is shown next to the column it constrains.

Triggers

Listed against the table they fire on, so side effects aren't a surprise later.

Enum types

Where the provider supports them, with every member value listed.

One self-contained file

The schema and the viewer that renders it ship together — nothing else to host.

Export PNG

One click rasterizes the whole diagram — not just the visible viewport — to a downloadable image.

View DDL

CREATE TABLE/ALTER TABLE statements reconstructed in the source database's own dialect, ready to copy or download as .sql.

Use cases

Where a portable ERD actually helps

Tracking schema drift in CI/CD

Generate the ERD as a build step and publish it as an artifact on every merge.

Onboarding new developers

Hand new hires one file to explore before their database access is even approved.

Reviewing migration PRs

Attach a regenerated diagram so reviewers see the resulting schema, not just the diff.

Snapshots before a refactor

Archive a dated diagram before a big migration or vendor switch, for later reference.

Briefing non-technical stakeholders

Share a link so anyone with a browser can see how the data fits together.

Attaching to support tickets

Drop the file into a ticket instead of describing the schema over chat.

Reaching a database behind a bastion host

Tunnel over SSH with --ssh-host to diagram a database that's only reachable from inside a private network.

Grounding AI coding assistants

Give an AI tool an accurate schema to work from instead of pasted-in migration files.

Example output

Real output, generated by SchemaFlex

This isn't a mockup — it's the actual output of schemaflex, run against a small sample database (customers, orders, products, categories, with foreign keys, check constraints, indexes and two triggers). Pan, zoom and click a table below, exactly as you would with a diagram generated from your own schema.

Install

Windows, Linux and macOS

SchemaFlex ships as a single self-contained executable for each platform — no .NET runtime to install first. Grab the build for your OS from the latest release (Apple Silicon for macOS — Intel Mac support is on the way).

# Windows
schemaflex.exe --connection "<your connection string>"

# Linux / macOS
./schemaflex --connection "<your connection string>"

Usage

Options

OptionRequiredDefaultDescription
--connectionYes—The database connection string. The provider is auto-detected.
--outputNoerd.htmlPath to write the generated HTML file to.
--schemaNoprovider defaultThe schema to inspect — public (PostgreSQL), dbo (SQL Server), the database name (MySQL/MariaDB), or main (SQLite).
--include-tablesNo(all tables)Only include tables matching these comma-separated patterns. * and % both match any run of characters.
--exclude-tablesNo(none)Exclude tables matching these comma-separated patterns (same wildcard syntax). Applied after --include-tables.

Examples

# PostgreSQL, writing to the default erd.html
schemaflex --connection "Host=localhost;Username=postgres;Password=secret;Database=mydb"

# SQL Server, writing to a custom path
schemaflex --connection "Data Source=localhost;Initial Catalog=MyDb;Integrated Security=true;TrustServerCertificate=true" --output diagrams/mydb-erd.html

# SQLite
schemaflex --connection "Data Source=app.db" --output app-schema.html

# MySQL, with an explicit schema
schemaflex --connection "Server=localhost;Uid=root;Pwd=secret" --schema mydb --output mydb.html

# Limit the diagram to a set of tables, excluding audit/temp tables
schemaflex --connection "Data Source=app.db" --include-tables "user*,order*" --exclude-tables "%_audit"

SSH tunnel options

For a database that's only reachable through a jump host (not applicable to SQLite, and the connection string's host/port must be reachable from the SSH host itself):

OptionDefaultDescription
--ssh-host—SSH jump host.
--ssh-port22SSH port.
--ssh-user—SSH username. Required when --ssh-host is set.
--ssh-key—Path to a private key file. Use this or --ssh-password.
--ssh-key-passphrase—Passphrase for --ssh-key, if it has one.
--ssh-password—SSH password. Use this or --ssh-key.
schemaflex --connection "Host=10.0.4.12;Username=postgres;Password=secret;Database=mydb" \
  --ssh-host bastion.example.com --ssh-user ec2-user --ssh-key ~/.ssh/id_ed25519

Privacy

Nothing leaves your machine

SchemaFlex is a local CLI tool with no server component. It makes no network request other than the database connection you give it, and sends no telemetry. The connection string, the schema, and everything read from your database stay on your machine — the only thing it writes anywhere is the HTML file you asked for. Read the full privacy notice.

Support

Free to use, always

SchemaFlex costs nothing and there's no catch coming later. If it saved you time chasing down a schema, a coffee is always appreciated but never expected.