Generate from source

Generate an ER diagram from a Prisma schema.

A Prisma schema states relationships explicitly, which makes it one of the most reliable sources for an entity diagram that exists.

Download for macOS
v0.1.33 · .dmg · Apple Silicon & Intel
Signed & notarized by Apple · opens without a Gatekeeper warning
sha256 698955a0187bc039f4c74f5d05a9f10fbb27376a45788a0a241d1326b73873c7
Download for Windows instead
$curl -fsSL https://lucidtrain.com/install.sh | sh

What it reads

schema.prisma: the models, their fields and types, the relation attributes, and the enums. Unlike a raw SQL schema, relations here are declared as relations rather than implied by a foreign key, so both direction and cardinality are stated rather than derived. That removes essentially all of the guesswork.

How the schema becomes a diagram

Each model is an entity. Relation fields become edges, with cardinality read from whether the field is a list and optionality from whether it is nullable. Implicit many-to-many relations are recognised as such and drawn as a single relationship rather than exposing the join table Prisma manages for you, which keeps the diagram at the level you think in.

Why the layout can be trusted

The agent reads the files listed above and emits a semantic graph: components, the tier each belongs to, and the edges between them, with no coordinates anywhere. The ELK layout engine then computes positions and orthogonal edge routing. This is why the output cannot come back with boxes overlapping or arrows crossing through cards, which is the usual failure when a language model is asked to place things on a canvas itself.

Worth keeping in the repository

Because the schema is one file and the diagram is derived from it deterministically, regenerating on change is cheap enough to do routinely. An entity diagram in the README that is actually current is rare, and this is one of the few cases where keeping it current is not a discipline problem.

Your schema stays on your machine

It runs on your machine. With a local Ollama model nothing leaves the laptop at all, and with your own API key the file contents go to the provider you chose and never through us. For a source that is your actual codebase, that distinction is usually the deciding one.

Prisma to ER diagram

In the schemaIn the diagram
modelAn entity
Scalar fieldsAttributes with their types
@idThe identifying attribute
@relationA relationship with direction
List relation fieldOne-to-many
Optional relation fieldAn optional relationship
Implicit many-to-manyDrawn as one relationship, not a join table
enumA constrained attribute
@@index and @@uniqueNotes on access and constraints

The prompt

shell
$ Read schema.prisma and draw an entity relationship diagram with cardinality and optionality marked.
FAQ

Questions

Does it need a database connection?

No. It reads schema.prisma from disk.

Does it handle multi-file schemas?

Yes, the split-schema layout is read as one model.

Can it diagram Drizzle or TypeORM instead?

Yes. Prisma has its own page because its relation declarations are unusually explicit, which makes the resulting diagram unusually reliable.

Will it show the database as well as the entities?

Those are different diagrams. The entity model is about the domain; where it is deployed belongs on the architecture diagram, and combining them makes both harder to read.

Related