Skip to content

mikro-orm-markdown

Mermaid ERD and Markdown schema docs, generated straight from your MikroORM entities. No database connection required.

npm install -D mikro-orm-markdown
/**
* Blog post authored by a registered user.
* @namespace Blog
*/
@Entity()
export class Post {
@PrimaryKey({ type: 'integer' })
id!: number;
/** Post title */
@Property({ type: 'string' })
title!: string;
@Property({ type: 'text', nullable: true })
body?: string;
@ManyToOne({ entity: () => Author })
author!: Author;
}
/**
* Blog post authored by a registered user.
* @namespace Blog
*/
export const PostSchema = new EntitySchema({
name: 'Post',
properties: {
id: { type: 'integer', primary: true },
/** Post title */
title: { type: 'string' },
body: { type: 'text', nullable: true },
author: { kind: 'm:1', entity: 'Author' },
},
});
/**
* Blog post authored by a registered user.
* @namespace Blog
*/
export const PostSchema = defineEntity({
name: 'Post',
properties: (p) => ({
id: p.integer().primary(),
/** Post title */
title: p.string(),
body: p.text().nullable(),
author: () => p.manyToOne(AuthorSchema),
}),
});

ERD.md

npx mikro-orm-markdown --config ./mikro-orm.config.ts --out ./ERD.md
An ERD and column tables

A Mermaid ER diagram plus per-entity tables with real DB column names, keys, nullability, descriptions, indexes, and constraints.

Driven by JSDoc

Descriptions, sections (@namespace, @erd, @describe), and visibility (@hidden) come from the comments already in your entity files.

MikroORM-aware

Embeddables, single table inheritance, @Formula, and EntitySchema / defineEntity() entities render as first-class concepts.

No database needed

Reads entity metadata through MikroORM discovery. Works with MikroORM 6 and 7 on SQLite, PostgreSQL, MySQL, and MariaDB drivers.

  • Quick start — add a script and generate your first ERD.md.
  • CLI options — every flag, with defaults.
  • Examples — real documents generated from sample entities.