DEV Community

Thomas Karner
Thomas Karner

Posted on

Mermerd - Generate your ERD blazingly fast

Link to the project is here

Why would I need it / Why should I care?

Documenting stuff and keeping it updated is hard and tedious, but having the right documentation can help to make the right decisions. Mermerd was designed to be able to export an existing database schema in a format that can be used to prototype and plan new features based on the existing schema. The resulting output is an ERD in Mermaid-Js format that can easily be updated and extended.

How does the Mermaid format look like?

You write your diagrams in plain text and Mermaid will create them for you. All the details can be found on the official website here

For example, a simple ERD can look like this

erDiagram
    CUSTOMER }|..|{ DELIVERY-ADDRESS : has
Enter fullscreen mode Exit fullscreen mode

which will result in a diagram like this (you can click on the image to test it out yourself)

ERD

Why do I need Mermerd when Mermaid already exists?

Mermerd is a small cli tool which generates a Mermaid diagram from an existing database. It supports an interactive cli, command line arguments and predefined run configurations. You can watch a small demo here

Example usages would be

# all parameters are provided via the interactive cli
mermerd

# same as previous one, but show all constraints even though the table of the resulting constraint was not selected
mermerd --showAllConstraints

# ERD is created via the provided run config
mermerd --runConfig yourRunConfig.yaml

# specify all connection properties so that only the table selection is done via the interactive cli
mermerd -c "postgresql://user:password@localhost:5432/yourDb" -s public

# same as previous one, but use all available tables without interaction
mermerd -c "postgresql://user:password@localhost:5432/yourDb" -s public --useAllTables

# same as previous one, but use a list of tables without interaction
mermerd -c "postgresql://user:password@localhost:5432/yourDb" -s public --selectedTables article,article_label
Enter fullscreen mode Exit fullscreen mode

If you are interested you can check out the project: mermerd

Top comments (0)