BASE

Mermaid

Mermaid

Diagrams from text · Free

Builds flowcharts, sequence, ER, state, and other diagrams from text descriptions. Diagrams can be kept beside code and changed with documentation or rendered in a web application.

Resource illustration: Mermaid

Open resource ↗

What you can use for free

The MIT renderer and local diagram creation are free, including commercial projects.

Paid features and costs

Paid external editors and hosted Mermaid services are separate products.

Access and limitations

The MIT renderer and local diagram creation are free, including commercial projects. Paid external editors and hosted Mermaid services are separate products.

Use cases

  • Describe architecture and API call sequences
  • Maintain a database diagram alongside the project

Example workflow

A possible workflow; this is not a report of hands-on testing.

Example workflow with Mermaid: Describe architecture and API call sequences.

Before you start

  • One process or set of components, and verified relationships between them.
  • Labels for participants, states, or entities, and an appropriate diagram type.

Steps

  1. Describe a minimal diagram in text and render it.
  2. Compare link directions and names with the actual architecture.
  3. Save the diagram alongside the documentation and update it when the solution changes.

Check your result

  • The diagram contains no invented relationships; its type and syntax are supported by the chosen version.
  • Renderer settings are safe for user input; the diagram is readable at its actual size.

Choosing Mermaid

Describe architecture and API call sequences

Choose this when

  • Describe architecture and API call sequences
  • Maintain a database diagram alongside the project

Consider alternatives when

  • When choosing for this topic, compare Mermaid with Excalidraw. A candidate to compare under the topic: Boards and diagrams. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
  • When choosing for this topic, compare Mermaid with tldraw. A candidate to compare under the topic: Boards and diagrams. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

Requirements

  • Set securityLevel when embedding diagrams, taking the text's source into account.

Things to consider

  • Costs and limits of free use: Paid external editors and hosted Mermaid services are separate products.
  • Terms of use: MIT.
  • Switching from strict to loose/antiscript changes the HTML and clicks allowed; sandbox may limit interactivity.

Frequently asked questions

What can you use for free in Mermaid?

The MIT renderer and local diagram creation are free, including commercial projects.

What additional costs might arise with Mermaid?

Paid external editors and hosted Mermaid services are separate products.

What terms of use matter for Mermaid?

MIT.

Which environment can you use Mermaid in?

Tech stack: JavaScript, SVG.

How do you get started with Mermaid?

Describe a minimal diagram in text and render it. Compare link directions and names with the actual architecture. Save the diagram alongside the documentation and update it when the solution changes.

What should you consider when choosing Mermaid?

An agent can easily generate diagram text, but connections and labels need human review. Use secure renderer settings for user input; diagram-type support depends on the version.

How do Mermaid securityLevel settings differ when rendering other people's diagrams?

strict is the default: HTML tags in text are encoded, and click functionality is disabled. loose allows HTML and clicks; antiscript removes script elements while retaining HTML and clicks. sandbox renders in a sandboxed iframe and restricts interactive features, including scripts/popups/links. Choose a mode based on your trust in the diagram source.

Related tasks and approaches

  • Excalidraw

    A candidate to compare under the topic: Boards and diagrams. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

  • tldraw

    A candidate to compare under the topic: Boards and diagrams. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

Tech stack

  • JavaScript
  • SVG

License

MIT.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Usage details

An agent can easily generate diagram text, but connections and labels need human review. Use secure renderer settings for user input; diagram-type support depends on the version.

Technologies and topics

  • Diagrams
  • Markdown
  • SVG
  • JavaScript

Sources

Other resources