Skip to content
Postgres to Mermaid

A Mermaid erDiagram you never have to redraw.

GitHub, GitLab, Notion, Obsidian and Confluence render Mermaid natively. Taavik gives you a Mermaid erDiagram that matches your live PostgreSQL schema, regenerated on every scan. Paste it into a README, an ADR, a runbook. It stays right for as long as the doc lives.

Live

Not a hand-drawn diagram

Every export is emitted from the last agent scan. Drop it into a README, forget it. The next update is one click away.

Portable

Renders where your docs live

GitHub and GitLab render Mermaid inline. Notion, Obsidian, Slab, GitBook: same. No image assets to upload, no dead link the next time the schema changes.

AI friendly

The format your agent already speaks

Claude, Cursor, GitHub Copilot, ChatGPT: they all emit and parse Mermaid natively. Hand the export straight to the agent, it grounds the reasoning on the actual schema.

Compact

One text file, no dependencies

A single .mmd file with the entity shapes and the relations. No SVG, no PNG, no library to install. Fits in a README, in a PR description, in a Slack message.

Faithful

Columns, PK, FK, UK marked

Primary keys, foreign keys, unique constraints, data types. Cardinality inferred from the FK metadata: one-to-many, one-to-one when the FK column is unique.

Private

No row data crosses the wire

The on-premise agent scans your Postgres and sends schema metadata only. The Mermaid never contains a row of your data, and neither does anything else Taavik cloud can see.

Example output

What the Mermaid erDiagram looks like.

A snippet emitted by Taavik for a two-table domain. Drop it into any Markdown surface that renders Mermaid inline.

%% Auto-generated by Taavik.
%% Regenerated on every schema scan: do not edit by hand.
erDiagram
    PUBLIC_USERS {
        uuid id PK
        varchar email UK
        timestamptz created_at
    }
    PUBLIC_ORDERS {
        uuid id PK
        uuid user_id FK
        varchar status
        bigint total_cents
        timestamptz created_at
    }
    PUBLIC_USERS ||--o{ PUBLIC_ORDERS : "user_id"

FAQ

Postgres to Mermaid erDiagram exporter: render in any Markdown

Where can I paste the Mermaid diagram? +

Anywhere that renders Mermaid inline. GitHub and GitLab render it directly in a fenced mermaid block. Notion, Obsidian, Slab, GitBook, Confluence, and most static site generators support it out of the box.

Are primary keys, foreign keys, and unique constraints marked? +

Yes. Columns are annotated with PK for primary keys, FK for foreign keys, UK for unique constraints. Cardinality is inferred from the FK metadata: one-to-many by default, one-to-one when the FK column is unique.

Is there a size limit on the diagram? +

Mermaid handles hundreds of entities before rendering slows down on GitHub. For very large schemas, Taavik lets you export a filtered subset from the ERD canvas so the diagram stays readable in the target surface.

Can I feed the Mermaid to Claude Code or Cursor? +

Yes, and it is a good idea. Every mainstream AI coding agent parses Mermaid natively, so the diagram grounds the assistant on the actual schema without exposing the database connection or any row data.

What happens with enums, JSON columns, and array types? +

Enum columns render with the underlying type (usually varchar) and a comment listing the labels. JSON and JSONB columns keep their type. Postgres array types render as the base type followed by the array marker.

Does the output include cross-schema tables? +

Yes. Table names are namespaced with the schema prefix when it is not the default (public), so hr.employees becomes HR_EMPLOYEES and stays distinct from public.employees. Cross-schema relations are drawn between the correct entity names.

Ready to export

Get a Mermaid erDiagram that never goes out of date.

Install the agent, run a scan, click Export Mermaid. Under ten minutes end to end. Free for one connection, forever.