New: TypeFire 7 and TypeFire for Chrome 2.0.
Free · Live examples · No sign-up

ER diagrams in Mermaid, for your database

An entity relationship diagram shows your tables and how they link. In Mermaid each relationship is one line of crow's foot notation, like CUSTOMER ||--o{ ORDER : places. Edit the example and it redraws.

Free in your browser. On a Mac, TypeFire opens every .md file like this, right from Finder.Download free for Mac

ER diagram.md
FileEditViewInsertFormatHelp
ER diagram.md

Orders schema

placescontainsappears inCUSTOMERstringnamestringemailORDERintiddateplacedLINE_ITEMPRODUCTstringskufloatprice
placescontainsappears inCUSTOMERstringnamestringemailORDERintiddateplacedLINE_ITEMPRODUCTstringskufloatprice

Try this

  • Add string phone inside the CUSTOMER block.
  • Mark a key: change int id to int id PK.
Loading the editor…Your files stay in your browser
  • Your files never leave your browser
  • Free, no sign-up
  • Download as Markdown, Word, a web page or a PDF

This editor comes from TypeFire, free for Mac

Your whole folder of Markdown notes in tabs, Quick Look previews in Finder, plus a text expander and a clipboard manager.

How it works

Write a Mermaid ER diagram

  1. 01

    Relate the entities

    Start with erDiagram, then one line per relationship: CUSTOMER ||--o{ ORDER : places.

  2. 02

    Read the ends

    Each end has two marks: the outer one is the most, the inner one is the fewest. { means many, | means one, o means zero.

  3. 03

    List attributes

    Add a block like ORDER { int id PK } with a type and a name on each line. PK, FK and UK mark keys.

Mermaid ER diagram text on the left becomes a drawn diagram of customer, order, product and line item tables
Free for Mac and Chrome

Diagrams in your notes? Get TypeFire.

On the Mac, every Mermaid block in your notes draws in TypeFire's colors. Open one full window to zoom in, resize it, link a box to another note, and save it as SVG or PNG.

Download free for MacAdd to Chrome7 day Pro trial, no card required.

Free text expander, markdown notes and a clipboard manager. $18 once for unlimited clips, notes sync and AI prompts.

At a glance

Crow's foot notation at a glance

Read each end of the line on its own.

||
Exactly one
|o or o|
Zero or one
}| or |{
One or more
}o or o{
Zero or more
A ||--o{ B : has
One A has zero or more B
A ||--|{ B : has
One A has one or more B

Drawn from the example above

What it does

ER diagram tips

  1. Name the relationship

    The text after the colon is the verb. Quote it if it has spaces: "appears in".

  2. Solid or dashed

    -- draws a solid line for a relationship that identifies the child. .. draws a dashed one for one that doesn't.

  3. Keys at a glance

    PK, FK and UK after an attribute mark primary, foreign and unique keys.

  4. Keep it to the question

    Draw the tables a change touches, not the whole schema, and the diagram stays readable.

A diagram drawn in the browser from its Mermaid text, nothing uploaded
Take it further

The same editor, without the browser tab

This editor comes from TypeFire, a free app for Markdown notes, a text expander and a clipboard manager. Here it works on the files you open. In the app, it opens your whole folder.

TypeFire for Mac with several Markdown notes open in one tab bar

TypeFire for Mac

  • Press Space on any .md file in Finder and read it rendered, with Quick Look.
  • Open a folder of Markdown, an Obsidian vault included, with tabs, search and links.
  • A text expander and a clipboard history in the same free app.
In a browser email, typing thx and a space expands into a whole thank-you reply

TypeFire for Chrome

  • This editor in its own tab, one click from the toolbar.
  • Your folder of .md notes in tabs, with search and links.
  • A text expander and your clipboard history on every site.

Frequently asked questions

Still not answered?

Write a Mermaid erDiagram in a code block marked mermaid, with one line per relationship and an optional block of attributes per entity.

Exactly one on the left, zero or more on the right.

CUSTOMER ||--o{ ORDER means one customer places zero or more orders.

Add PK after the attribute: int id PK. FK marks a foreign key and UK a unique one.

-- is an identifying relationship, drawn solid. .. is non-identifying, drawn dashed.

Yes. Put it in quotes at the end of the line: string email "login address".

Schemas next to the notes about them

TypeFire for Mac draws ER diagrams in your notes, with a viewer to zoom in on big schemas. Free.

Download free for MacAdd to ChromeSee what $18 adds7 day Pro trial, no card required.

Free text expander, markdown notes and a clipboard manager. $18 once for unlimited clips, notes sync and AI prompts.

your clips your snippets