Skip to content

Overview

mikro-orm-markdown is a MikroORM ERD generator. It creates Mermaid ER diagrams and Markdown database schema documentation from your MikroORM entities.

Use the CLI or the TypeScript API to document entity columns, relations, indexes, constraints, and JSDoc descriptions — without connecting to a live database.

  • Mermaid ERD diagrams generated from MikroORM entity metadata
  • Markdown schema documentation with per-entity column tables, actual DB column names, keys, nullability, descriptions, indexes, and constraints
  • JSDoc-driven grouping and visibility via @namespace, @erd, @describe, and @hidden
  • No live database connection required — uses MikroORM metadata discovery from your config
  • Works across common SQL drivers — covered by smoke tests for SQLite, PostgreSQL, MySQL, and MariaDB

Beyond what Prisma-based tools can express, mikro-orm-markdown also visualizes concepts unique to MikroORM:

  • Embeddable — a value object stored inside the owning entity’s table, either as flattened columns (e.g. address_street, address_city) or as a JSON column depending on the @Embedded options. No separate table is created.
  • Single Table Inheritance (STI) — subclasses like Dog and Cat share one animals table. A discriminator column (e.g. type) distinguishes which subclass each row belongs to. See Single table inheritance.
  • @Formula — a virtual column with no physical DB column. Its value is computed by a SQL expression at SELECT time (e.g. LENGTH(name)).

These show up in the generated output as annotations:

Annotation Meaning
formula: <expr> Mermaid comment for an @Formula computed column
[EmbeddableType] Flat column inlined from an @Embedded value object
discriminator STI discriminator column

Heavily inspired by prisma-markdown by @samchon.