orm2erd
v1.2.1
Published
Generate ERD diagrams (Mermaid, DBML, PlantUML, D2) straight from your ORM's models/schema — no manual diagramming.
Maintainers
Readme
orm2erd
You already built the app — your ORM models are the schema. orm2erd reads them and generates an
ERD (Entity-Relationship Diagram) for you, instead of you drawing and maintaining one by hand.
Status: early development — see the tables below for what's supported today vs. planned.

What it does
orm2erd scans your project, figures out which ORM you're using, and turns your existing
models/schema into diagram code — Mermaid, DBML, PlantUML, D2, and more. No manual diagramming,
no drift between your code and your docs.
detect ORM → resolve entry point(s) → parse/introspect → normalize to IR → emit diagram code(s) → write file(s)Supported ORMs
| | ORM | Status | | --- | --- | --- | | | Prisma | ✅ Supported | | | Sequelize | ✅ Supported | | | TypeORM | 🚧 Planned | | | Drizzle | 🚧 Planned |
Output formats
| | Format | Status | | --- | --- | --- | | | Mermaid | ✅ Supported | | | DBML | ✅ Supported | | | PlantUML | 🚧 Planned | | | D2 | 🚧 Planned |
Installation
Run without installing (recommended — always gets the latest version):
npx orm2erdOr install globally:
npm i -g orm2erd
orm2erdUsage
Interactive:
npx orm2erd┌ orm2erd
│
◇ Detected: prisma
◆ Entry point for prisma:
│ prisma/schema.prisma
◆ Output format(s):
│ mermaid
◆ Output path:
│ erd.mermaid
◆ Type labels:
│ Canonical
│
◇ Written to erd.mermaid
│
└ DoneNon-interactive (CI-friendly):
npx orm2erd --orm prisma --entry ./prisma/schema.prisma --format mermaid,dbml --out ./erdYou can select multiple output formats in a single run — the schema is parsed once and reused
across every format you pick. --out accepts either a bare name (erd, gets each format's
extension appended) or a full filename (erd.md, used exactly as given when there's only one
output format).
By default, field types are emitted in a canonical, portable form (e.g. string, int). Pass
--type-mode native to emit the ORM's own type names instead (e.g. Prisma's String, Int):
npx orm2erd --orm prisma --entry ./prisma/schema.prisma --format mermaid --type-mode nativeWhy
Diagrams drawn by hand go stale the moment the schema changes. Your ORM already has an accurate,
structured picture of your data model — orm2erd just reads that instead of asking you to
redraw it.
Contributing
See CLAUDE.md for architecture, the adapter/emitter contract, and design decisions.
