ErdDocs

Prisma to PlantUML

Paste schema.prisma and copy PlantUML: entities with their keys, nullability and crow’s foot relations, ready for a .puml file. No CLI, no generator block, nothing uploaded.

Your schema

Replace the example with your schema, then Export → PlantUML.

What comes out

The real export of the schema above, trimmed to one entity and the relations around it. cancelled_on has no asterisk, which is PlantUML’s way of saying a column is optional.

@startuml
' Generated with erddocs.com — paste SQL, get an ER diagram and a data dictionary
hide circle
skinparam linetype ortho

entity "subscriptions" as subscriptions {
  *id : Int <<PK>>
  --
  *account_id : Int <<FK>>
  *plan_id : Int <<FK>>
  *started_on : DateTime
  cancelled_on : DateTime
  *seats : Int
}

subscriptions }o--|| accounts : account_id
subscriptions }o--|| plans : plan_id

A package, or a paste

ErdDocs converts what you paste, with nothing installed and nothing added to the project. The existing answers are packages you install: prisma-uml as a CLI, prisma-generator-plantuml-erd as a generator block followed by prisma generate, and a VS Code extension for the same job.

The awkward cases are the ones where the schema is not yours to modify: a file in a review, an attachment, a repository you are still deciding about. Another is when adding a dependency to answer one question costs more than the answer is worth. ErdDocs covers those. The file goes into a browser tab, and the schema stays on your machine while you read it.

The database, not the file

A Prisma schema is not shaped like the database it produces, and the export follows the database. @@map and @map names win. Relation fields give way to the scalar foreign key columns Prisma actually writes. Optional fields become nullable columns without an asterisk. An implicit many-to-many arrives as the join table Prisma really creates. You can hand the result to someone writing SQL.

FAQ

Is this the PRISMA flow diagram for systematic reviews?

No, that is a different PRISMA entirely. ErdDocs works on Prisma the ORM. It turns the schema.prisma file that describes a database into a PlantUML ER diagram. The PRISMA 2020 flow diagram used in systematic reviews is an unrelated standard, and a paper needs a different tool for it.

How is this different from prisma-uml?

prisma-uml and prisma-generator-plantuml-erd are packages you install. One is a CLI. The other is a generator block in schema.prisma followed by prisma generate. This page needs neither. It covers a schema you were sent, a file in a pull request, or a laptop where installing a toolchain to read one file is not worth it. Paste it and copy the PlantUML.

What does the generated PlantUML contain?

One entity per table, primary keys first and separated by a rule, then the rest. Keys carry <<PK>>, <<FK>> and <<UK>> markers, mandatory columns carry PlantUML’s asterisk, and types keep the size and precision the schema gives them. Relations are crow’s foot lines labeled with the foreign key column, and enums become enum blocks. The header sets hide circle and orthogonal routing, so it reads as an ER diagram rather than a class diagram.

Does it show the tables Prisma creates rather than the models I wrote?

Yes. @@map and @map names win because the database uses them. Relation fields are replaced by the scalar foreign key columns behind them. An implicit many-to-many appears as the join table Prisma really creates.

Is it free?

Copying PlantUML is free at any schema size, with no account. The 25-table limit is on what gets drawn, not on what gets converted. The text carries one comment line naming ErdDocs. Paying $9 once removes it and lifts the limit.

Related