Creating Entity Relationship Diagrams with Mermaid

Entity Relationship Diagram

I my last blog article I wrote about how relationships between different tables can be formally expressed and visualised in entity relationship diagrams. In this article I will illustrate how such diagrams can actually be created and which tools can be used in order to do so.

Sketching with Excalidraw

As a first go-to drawings can be sketched with Excalidraw. Excalidraw is versatile and well equipped to create relatively simple diagrams such as entity relationship diagrams. It is possible enough to create the necessary shapes by yourself. And it becomes a lot more easy by adding the Shapes for UML & ER Diagrams library from BjoernKW to your Excalidraw toolbox.

Entering Mermaid

But there is another option if you like to code and want have your diagrams reproducible. This tool is an extension for the markup language Markdown and is called Mermaid . It basically means that there is a simple own language close to plain text just for creating diagrams.
Mermaid takes a little longer to learn than Excalidraw but you can store your source code of your diagram away quickly and reproduce it later easily. Also Mermaid does that in an open fashion so as long as Javascript and plain text can be parsed you shouldn’t into problems.

Coding a diagram

To create an entity relationship diagram model with mermaid it is recommended to use the online editor. For one, it visualises the diagram you created so far so you don’t have to visualise it mentally. It also helps you to learn the language since you immediately see the results of your code and invidual code changes in the process.
Also there are many templates or “Sample Diagrams” which give you nice basic structure you can then adapt to you scenario.
If you want to know specific details or just more you can read the well designed documenation.
Once your source code and diagram are ready you can copy the source code and paste it into Notion. Both Notion and Mermaid are build around Markdown and therefore compatible with each other. Happy Coding!

Author:
Aaron Holstein
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab