Entity-Relationship Diagram Code Generator

Usage no npm install needed!

<script type="module">
  import nestorrenteErdiagram from 'https://cdn.skypack.dev/@nestorrente/erdiagram';



ERDiagram is a library that allows to define an entity-relationship diagram using the ERDiagram language, and then generate the database creation script, OOP classes, and more.

Table of contents

Live demo & CLI

You can try ERDiagram online using the ERDiagram playground application. There you will find some code examples that are very useful for learning the ERDiagram language.

There is also a work-in-progress CLI version of ERDiagram. Check it out! :slightly_smiling_face:


  • ERDiagram language: learn how to define entities and relationships.

  • ERDiagram library: installation, basic concepts, configuration and examples.

  • Entity-relationship model conversion:

    • Database model: learn how entities and relationships are modeled as tables and columns.
    • Class model: learn how entities and relationships are modeled as OOP classes.

Supported output formats

  • Database creation script (SQL)
    • MySQL
    • Oracle DB
    • PostgreSQL
    • SQLite
    • SQL Server
  • OOP classes
    • Java POJO (no JPA support so far)
    • TypeScript
  • Diagram
    • PlantUML (code & SVG image)
    • Nomnoml (code & SVG image)


This is a side project I'm working on during my spare time, so I'd be very happy if you want to contribute :grinning: bug report, suggestions, pull requests or any other kind of feedback are more than welcome.

If you want to create a PR, just be sure you're working on the develop branch and go ahead :slightly_smiling_face:

If you want to get in touch, you can find me on LinkedIn: @nestorpglez

Wish list

This is a small list of features/tools that I'll be very happy to have:

  • More database engines support.
  • More OOP languages support.
  • Syntax highlight for some text editors or IDEs (Sublime Text, Atom, IntelliJ IDEA, VS Code, ...).
  • XSD / JSON schema generation.
  • Liquibase files generation.
  • Any other cool stuff :stuck_out_tongue: