ViewDB uses Google Analytics cookies to count visits and see which pages help. They are set only if you accept. Privacy policy

DBML ER diagrams from code

Write the schema.
See the diagram.

Model your database in DBML or in forms. ViewDB draws it as you type and exports PostgreSQL, MySQL, SQLite, Prisma or Drizzle.

Pro for 3 days on 1 project. No card needed.

Reads
PostgreSQLMySQLSQL Server.dbml.viewdb
Writes
PostgreSQLMySQLSQLitePrismaDrizzleDBMLPNGSVG
01 How it works

From the first table to a shared link.

Eight real screens from ViewDB Studio. Keep scrolling to move through the steps, or click one to jump to it.

viewdb.app/projects/e-commerceScroll
Open a projectOpen a projectSwitch to formsSwitch to formsEdit a tableEdit a tableSee the linksSee the linksAssistantAssistantExportExportHistoryHistoryShareShare
01 / 08Your schemas, with table and relation counts at a glance.
02 Features

Arrange it in one click. Then move what you want.

layout: enum(4)

Four layouts, one click

Left to right, top to bottom, snowflake or compact. Keys 1 to 4 pick one while the menu is open.

group: color

Groups and sticky notes

Frame related tables in a colored group and leave notes next to them on the canvas.

edit: forms

Edit without writing DBML

Forms for tables, columns, refs, enums and groups change only the lines they touch.

sync: code ↔ diagram

Code and diagram in step

Click a table to jump to its code. Move the cursor and the table lights up.

ref: >

Draw a relation by dragging

Drag from one column to another and the ref is written for you.

import: ≤ 900 KB

Start from the SQL you have

Paste CREATE TABLE statements from PostgreSQL, MySQL or SQL Server, up to 900 KB.

03 AI assistant

Ask about the schema. Approve every change yourself.

The assistant reads your current DBML. Ask it to explain the model, suggest improvements or fix errors. Changes come back as a proposal you compare line by line, and nothing is written until you press Apply. Ctrl+Z takes it back.

  • Pro includes 200 messages a month on the built-in Gemini model.
  • Bring your own Gemini, OpenAI or Anthropic key and there is no monthly cap. The key is stored encrypted.
04 Agents over MCP

Your coding agent can edit the schema too.

ViewDB runs an MCP server with 10 tools. Claude, Claude Code and Cursor can list your projects, read the schema, export code and change tables. ViewDB saves a version before the agent starts editing.

claude mcp add --transport http viewdb https://viewdb.app/api/mcp
ClaudeClaude CodeCursorOAuth

Connect with OAuth, or with a personal key that only reads or can also write.

claude-code — ~/shop
> Add a reviews table linked to products and customers.
● viewdb edit_schema
create_table reviews
upsert_relationship reviews.product_id > products.id
upsert_relationship reviews.customer_id > customers.id
Saved. 12 tables, 16 relationships.
● Added reviews with links to products and customers.
E-commerce diagram12 tables · 16 relationships
products
⚿idbigint
⛓category_idbigint
namevarchar(200)
customers
⚿idbigint
emailvarchar(255)
reviews
⚿idbigint
⛓product_idbigint
⛓customer_idbigint
ratingsmallint
bodytext?
Version saved before agent edits
05 Version history

Go back to how the schema looked this morning.

ViewDB saves 1 second after you stop typing and keeps a version every 10 minutes. It also keeps one before imports, restores, agent sessions and assistant changes.

  • Name the versions that matter
  • Compare any version with the current schema
  • Restore it, then undo if you change your mind
06 Sharing

Share the diagram. Nobody else can change it.

Turn on a public link and anyone can open the diagram and download the DBML, without an account. Or invite people by email and the project shows up under Shared with me.

  • Password and expiry date on Pro
  • Create a new link and the old one stops working
07 Pricing

Two plans. Try Pro for 3 days first.

Paying yearly costs the same as 10 months. Payments by Stripe, taxes included, cancel anytime.

Starter

For a few databases and the code to build them.

$7.50$9/month$9

$90 billed once a yearBilled every month

Subscribe to Starter
  • 10 projects
  • Export PostgreSQL, MySQL, SQLite, Prisma and Drizzle
  • Automatic layouts
  • PNG with a ViewDB watermark
  • Read-only share links

ProRecommended

For schemas you work on every week: AI, agents and history.

$15.83$19/month$19

$190 billed once a yearBilled every month

Start 3 days free
  • Unlimited projects
  • AI assistant, 200 messages a month or your own key
  • MCP for Claude, Claude Code and Cursor
  • Version history with compare and restore
  • SVG, and PNG without a watermark
  • Password and expiry on share links

Questions before you start.

Do I need to learn DBML?

No. Paste SQL and ViewDB writes the DBML for you. Forms edit tables, columns and refs without code, and the help page has a DBML guide when you want it.

Can ViewDB connect to my database?

Not yet. Export the CREATE TABLE statements from PostgreSQL, MySQL or SQL Server, then paste or upload them.

What happens when the trial ends?

Your account turns read-only. You can still open your projects, download DBML and .viewdb files, and your share links keep working. Choose a plan to edit again.

Where does my AI key go?

It is encrypted with AES-256-GCM before it is stored, and it is only used for your own assistant requests.

How do I cancel?

From Account, Billing, through the Stripe customer portal.

Paste your schema.
See it drawn in a second.

Pro for 3 days on 1 project. No card needed.