SQL to ER Diagram
Home › TypeORM

TypeORM to ER Diagram

Visualize your TypeORM entities as an interactive ER diagram. Paste the entity classes as they are — @Entity, @Column, @ManyToOne and @ManyToMany are read directly — or paste the SQL TypeORM generates if you want every database-level detail.

Open the diagram tool →
No signup · nothing uploaded · export PNG / SVG / Mermaid / DBML · shareable link
ER diagram of the TypeORM example schema: User and Post (2 tables, 1 relationship)
The TypeORM example below, drawn by the tool: User and Post (2 tables, 1 relationship).

At a glance

What it is
SQL to ER Diagram is a free, open-source browser tool that turns TypeORM entities into an interactive entity-relationship (ER) diagram.
Input
Decorator-style TypeORM entity classes (@Entity, @Column, @ManyToOne, @ManyToMany…), EntitySchema definitions, or the SQL TypeORM generates from them.
Output
An interactive ER diagram you can rearrange, then export as PNG, SVG, Mermaid, DBML or PlantUML, or share as a link.
Cost
Free. MIT-licensed open source. No account or signup.
Privacy
Runs entirely in your browser. The schema is never uploaded, and share links carry the diagram in the URL fragment, which is not sent to a server.
Limits
It never connects to your database itself: you paste schema text, or run one read-only catalog query in your own client and paste the result. There are no accounts, so there is no real-time multi-user editing; diagrams are kept in your browser, as a saved file, or as a share link. Layout stays smooth at around 300 tables.

How it works

  1. Copy your entity classes — one file or several pasted together.
  2. Paste them into the editor (or drop the .ts file on the page). TypeORM is detected automatically.
  3. Each @Entity becomes a table; @ManyToOne / @OneToOne become foreign keys and @ManyToMany with @JoinTable becomes a junction table.
  4. Arrange, hide tables, then export PNG/SVG or convert to Mermaid/DBML.

Example

Paste TypeORM entities like these:

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  email: string;
}

@Entity()
export class Post {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  title: string;

  @ManyToOne(() => User)
  author: User;
}

…and you get User and Post with a relation from Post.authorId → User.id. Try it with your own →

Guide

TypeORM entities are decorators over classes — @Entity(), @PrimaryGeneratedColumn(), @Column(), @ManyToOne(() => User, u => u.posts) — and while this page works from the SQL TypeORM generates, that's the more reliable path anyway: the generated SQL is the ground truth of what's in your database, including column types resolved from your database driver, explicit constraint names, and join tables created by @ManyToMany(() => Tag, tag => tag.posts).

The two easiest ways to get that SQL:

Both produce standard Postgres/MySQL DDL with ALTER TABLE … ADD CONSTRAINT foreign keys, which the parser stitches back onto the right tables. NestJS projects work identically — the entities are plain TypeORM under the hood.

Why use it

TypeORMSQLPrismaSequelize

FAQ

How do I get an ER diagram from TypeORM?

Paste your entity classes into the editor. Every class marked @Entity becomes a table, its @Column properties become columns, and its relations become foreign keys.

Which TypeORM features are read?

Decorator-style entities: @Entity, @PrimaryGeneratedColumn, @PrimaryColumn, @Column, the date and version columns, @ManyToOne, @OneToOne with @JoinColumn, and @ManyToMany with @JoinTable. EntitySchema definitions are read too. For exact database types, paste the SQL from typeorm migration:generate instead.

Is my schema uploaded anywhere?

No. Everything runs locally in your browser — your schema is never uploaded to or stored on any server.

Is it free?

Yes. It is completely free and open source, with no account or sign-up required.

Related