Erdus
Universal ER Diagram Converter
Also available in Spanish ✦ Demo ✦ Docs ✦ Contributing ✦ Roadmap
One IR to map them all. Erdus is the open-source universal converter for ER diagrams and database schemas.
It unifies ERDPlus, SQL DDL, Prisma, TypeORM, JSON Schema and more under a strict Intermediate Representation (IR).
Build once, convert everywhere.
https://github.com/user-attachments/assets/ad18f7ab-0b26-4033-9eae-6a9b209543b8
- 100% client side (privacy): files never leave the browser.
- Input:
.erdplus or .json files (format detected automatically).
- Output: file with the extension matching the desired target format (e.g.,
name-old.erdplus, schema.sql, schema.prisma).
- Relationships: draws a single link for each FK (including composites) and anchors it to the actual child columns.
Available modules
- ERDPlus Old ⇄ New (bundled)
- SQL (PostgreSQL DDL)
- Prisma
- TypeORM (IR → entity models)
- DBML (for dbdiagram.io)
- Mermaid ER (for documentation)
Project structure
Erdus/
├── src/ # Core application source
│ ├── converters/ # Format conversion modules
│ ├── components/ # React UI components
│ ├── pages/ # Application pages
│ ├── utils/ # Utility functions
│ ├── types/ # TypeScript definitions
│ └── docs/ # In-app documentation
├── examples/ # Example schemas & conversions
│ ├── blog/ # Blog system example
│ ├── ecommerce/ # E-commerce schema
│ └── school/ # Educational system
├── tests/ # Comprehensive test suite
├── docs/ # Documentation website (Docusaurus)
├── public/ # Static assets
└── assets/ # README images & media
graph LR
subgraph "Input"
A[ERDPlus Old]
B[ERDPlus New]
C[SQL DDL]
D[Prisma]
E[TypeORM]
end
subgraph "Core"
IR[Intermediate<br/>Representation]
end
subgraph "Output"
F[SQL DDL]
G[Prisma]
H[TypeORM]
I[DBML]
J[Mermaid]
end
A --> IR
B --> IR
C --> IR
D --> IR
E --> IR
IR --> F
IR --> G
IR --> H
IR --> I
IR --> J
| Format |
Input |
Output |
Use Case |
| ERDPlus |
✅ |
✅ |
Educational projects, visual design |
| SQL DDL |
✅ |
✅ |
Database creation, migrations |
| Prisma |
✅ |
✅ |
Modern Node.js development |
| TypeORM |
✅ |
✅ |
Enterprise TypeScript apps |
| DBML |
— |
✅ |
Documentation with dbdiagram.io |
| Mermaid |
— |
✅ |
README files, technical docs |
Demo
In ERDPlus (new version) choose Menu → Restore → Upload to open the converted file. Positions, types, constraints and connections remain intact.
ERDPlus module features
- Automatic detection of the input format (old or new).
- Old → New: tables → nodes, attributes → columns, simple or composite FKs → a single grouped edge with stable
foreignKeyGroupId.
- New → Old: edges → FK attributes and
connectors with fkSubIndex to preserve order.
- Deterministic IDs for columns in NEW (
c-<tableId>-<attrId>) allowing ERDPlus to anchor lines and tag columns as (FK).
- Private by design: all processing happens locally; there is no backend or file upload.
- Works on Windows, macOS and Linux. Vite’s dev server provides instant HMR.
## ERDPlus module: how it works
Old → New (identical visuals)
- Reads
shapes[] tables and creates nodes with id = t-<id> and columns id = c-<tableId>-<attrId>.
- Reconstructs FKs prioritizing
connectors[] (source of truth in Old).
- Groups by (child → parent), orders by
fkSubIndex and generates a single edge per composite FK.
- Uses the real child column ID in
foreignKeyProps.columns[].id; ERDPlus draws the line and labels (FK).
- Assigns a stable
foreignKeyGroupId based on the child, parent and ordered set of attributes.
New → Old (equivalent structure)
- Converts nodes and columns to tables and attributes preserving PK, UNIQUE, NULL and types.
- From each edge creates FK attributes in the child table with
references pointing to the parent’s PK and fkSubIndex following the edge column order.
- Creates
connectors per FK column so that legacy viewers can draw the connections.
Guarantees
- Round-trip old → new → old without loss: structure, keys, order and positions are preserved.
- Round-trip new → old → new: nodes, edges and FK columns are preserved.
- The “new” JSON may differ in internal invisible IDs but is visually and semantically equivalent.
SQL module features
- Auto-detects PostgreSQL
CREATE TABLE scripts.
- IR ⇔ SQL: converts the canonical IR to PostgreSQL DDL and parses SQL back to IR.
- Preserves PK, FK and unique constraints.
## SQL module: how it works
SQL → IR
- Scans
CREATE TABLE statements and builds tables and columns.
- Reads
FOREIGN KEY clauses to reconstruct relationships.
IR → SQL
- Iterates tables and columns to output
CREATE TABLE definitions.
- Emits
ALTER TABLE for composite FKs and indexes.
Prisma module features
- Auto-detects Prisma schema files.
- IR ⇔ Prisma: generates Prisma models from IR and parses schemas back.
- Maps SQL types to Prisma scalars and relations.
## Prisma module: how it works
Prisma → IR
- Parses
model blocks extracting fields, types and relations.
IR → Prisma
- Generates
model blocks with @id, @unique and @relation attributes.
TypeORM module features
- Auto-detects TypeORM entity classes.
- IR ⇔ TypeORM: generates entity models and parses them back to IR.
- Maps SQL types to TypeScript types and decorators, preserving relations and indexes.
## TypeORM module: how it works
TypeORM → IR
- Parses
@Entity classes to extract columns and relations.
- Reconstructs
@ManyToOne/@OneToMany links via @JoinColumn, marking optional fields.
IR → TypeORM
- Emits
@Entity classes with @Column, @PrimaryColumn and @PrimaryGeneratedColumn decorators.
- Generates
@ManyToOne/@OneToMany relations and @Index declarations.
- Maps SQL types to TypeORM types and adds nullable/unique options.
Open source & scalable
- MIT-licensed with a lightweight, modular core.
- New converters or exporters can plug in as simple modules.
- Ships a CLI and minimal API so it fits CI/CD pipelines, serverless functions or container clusters.
Quick Start
Web Interface (Recommended)
Get started in seconds with our web interface:
- Visit erdus-inky.vercel.app
- Upload your ER diagram or schema file
- Select your desired output format
- Download the converted result
Local Installation
For development or offline use:
# Clone and install
git clone https://github.com/tobiager/Erdus.git
cd Erdus
npm install --legacy-peer-deps
# Start development server
npm run dev
# → Open http://localhost:5173
Programmatic Usage
import { erdplusToIR, irToSQL, irToPrisma } from 'erdus';
// Convert ERDPlus to SQL
const erdplusData = JSON.parse(fileContent);
const schema = erdplusToIR(erdplusData);
const sqlScript = irToSQL(schema);
// Or convert to Prisma
const prismaSchema = irToPrisma(schema);
Development Resources
Testing the conversion
- Open the local app at
http://localhost:5173.
- Drag or select a
.erdplus file (old or new) and press Convert.
*-new.erdplus or *-old.erdplus will download automatically as appropriate.
- In ERDPlus new: Restore → Upload to verify the diagram is identical.
On Windows/PowerShell, if peer dependency conflicts appear, pin ESLint 8.57:
npm i -D [email protected]
npm i
Deploy on Vercel
- Import the repository (Framework: Vite).
- Build:
npm run build
- Output directory:
dist/
vercel.json already points to dist/.
Privacy & security
- Processing happens entirely in your browser.
- No files are sent to any server, not even Vercel.
- You can use it offline with
npm run build followed by npm run preview.
Known limitations
- ERDPlus (new version) may route lines differently (curves) but connections and cardinalities are correct.
- If your NEW file comes from another tool with proprietary IDs, the converter will not clone those IDs. They are invisible and do not affect rendering.
Roadmap — Universal Converter
Phase 0 – What exists today (base)
- ERDPlus old ⇄ new
- ✅ Full support for PK, FK, unique groups
- ✅ Lossless round-trip
- Audience: students, teachers, university exercises
Phase 1 – “Useful + viral” MVP
Goal: anyone can use it online and get value right away
- Canonical IR (v1) → core
- ✅ IR → PostgreSQL DDL → generate real
CREATE TABLE
- ✅ IR → Prisma schema → connect with Next.js/TypeScript
- ✅ Web demo (Vercel) → drag & drop, result tabs, loss report
- ✅ Simple CLI (
erdus convert ...)
- Attracts: fullstack devs, indie hackers, students → first stars
Phase 2 – Import & documentation
Goal: import existing models and document them
- ✅ PostgreSQL DDL → IR (robust parser)
- ✅ IR → dbml → use in dbdiagram.io
- ✅ IR → Mermaid ER → document in Markdown/repos
- ✅ Complete examples (blog, e‑commerce, school)
- Attracts: devs who document, OSS maintainers → visibility on GitHub
Phase 3 – Developer ecosystem
Goal: be useful in pipelines and serious projects
- IR → JSON Schema (APIs, validation)
- ✅ IR → TypeORM models
- IR → Sequelize models
- IR → Supabase schema (+ optional RLS policies)
- Diff/Migration plan: compare two IR → SQL
ALTER script
- Attracts: startups, SaaS projects → stars from productive folks
Phase 4 – Advanced / killer features
Goal: expand to NoSQL and modern APIs
- IR ↔ Mongoose schemas (MongoDB)
- IR ↔ OpenAPI schemas
- IR ↔ GraphQL SDL
- Visualizer: basic web editor with interactive ERD view
- Attracts: modern devs, API/GraphQL community
- This is where ERDUS could become the OSS standard
Recommended release order
- Phase 1 (MVP): Postgres + Prisma + web demo (fast value, viral)
- Phase 2: Documentation (dbml/Mermaid) → virality on GitHub/Reddit
- Phase 3: JSON Schema + Supabase + Diff → serious devs
- Phase 4: MongoDB + GraphQL + Visualizer → universal suite consolidation
Growth strategy
- Each phase = a release with changelog and post on Reddit/HN/Twitter
- README with short GIFs (drag & drop, instant output)
- CI badges + online demo → trust
- “Good first issues” to invite PRs → community
Contributing

Please read the Contributing Guide before getting started.
- Fork and create a
feat/my-improvement branch.
- Run
npm i and npm run dev.
- Include an example
.erdplus file when relevant.
- Open a PR — contributions are welcome!
Top Contributors
Thanks to everyone who contributes to the growth of this project. Your contribution can also be included here!
License
MIT — see LICENSE.
评论