erdia
erdia copied to clipboard
CLI to generate mermaid.js ER diagram using TypeORM entity
ERDIA
erdia is create ER Diagram and Entity schema specification using by TypeORM and mermiad.js
Why erdia ?
erdia automatic generate DB entity specification, ER diagram. DB entity specification, ER diagram important document that are maintainence and develop process. But not so easy keep freshness. erdia help to easily keep freshness and easily generate beautiful document using ETA template engine.
Summary,
- ER diagram generate using mermaid.js syntax.
- Every document generate using ETA template engine
- Use TypeORM
Automate your database ER diagram drawing!
Table of Contents
- Getting started
- How it works?
- Installation
- Usage
- Requirement
- Example
- Showcase
- Documents
- Output Format
- Template
- TypeScript and Re-Map Paths
Getting started
npm install erdia --save-dev
npx erdia init
npx erdia build
erdia support initialization command. And you execute build command.
How it works?
graph LR
A[TypeORM Entity] --> erdia
subgraph erdia
direction TB
C[TypeORM Entity]-->|extract <br/>entity specification|B[erdia]
end
erdia-->|extract <br />specification|D
D[ETA<br />template<br />engine]-->E[html]
D-->F[markdown]
D-->G[pdf]
D-->H[image]
Installation
installation
npm i erdia --save-dev
initialization
npx erdia init
Usage
erdia build -d [your dataSource path] -o dist/entity --format html
Requirement
- TypeORM 0.3.x
Example
Showcase

Documents
- ER diagram png image format
- ER diagram & table pdf format
Output Format
erdia support html, markdown, pdf, svg, png. Database entity specification table only support html, markdown, pdf format.
# PDF document generate
erdia build -d [your dataSourcePath] -o dist/entity --format pdf
Template
erdia use ETA template for entity specification document and ER diagram. Template easily detach from erdia.
npx erdia eject
Detached template can change and every document customizable. The template can be found here.
TypeScript and Re-Map Paths
TS_NODE_PROJECT="./tsconfig.json" ts-node -r tsconfig-paths/register ./node_modules/.bin/erdia er -d [your dataSource path]
erdia load dataSource file using TypeORM module. If you use module resolution need additional parameter need for successfully execution. You have to pass tsconfig-paths/register. See ts-node paths and baseUrl section