See it as a diagram
Everything below, as a diagram you can edit. Describe yours and see it in seconds.
No account needed · Editable canvas, not a picture
schema.prisma is already the graph
Each model block is a node; each @relation, with its fields and references, is a typed edge; enums and composite keys are right there in the text. Because the file is the single source Prisma itself compiles, a diagram generated from it cannot disagree with the ORM's view of the world. Datadef's AI import accepts the pasted schema directly as a prompt, and the data model diagram generator owns that first-generation path.
One subtlety the file hides: implicit many-to-many relations. Two models with list fields pointing at each other get a join table in the database, named like _UserToTeam, that appears nowhere in schema.prisma. A good ERD either draws the join table explicitly or marks the edge as many-to-many; silently omitting it confuses everyone who later reads the actual database.
prisma-erd-generator: the in-repo alternative, honestly
There is a community package that solves part of this problem inside the repo, and it deserves a straight description. prisma-erd-generator hooks into prisma generate as a generator block: every generate run emits an ERD, Mermaid-based, SVG by default, with mermaid-cli and its headless browser as dependencies. For a small schema and a committed docs image, it is genuinely convenient, free, and zero new services.
Its limits are the limits of full-auto rendering. It draws every model with generated layout, so a forty-model schema becomes spaghetti with no way to curate zones, hide noise models, or annotate the tricky relations; the output is a static file you must regenerate and commit; and nothing about it helps the diagram live outside the repo. If your whole need is "an ERD image in the docs folder", use it. The living-diagram approach earns its keep when the diagram needs curation, annotations, and a wiki embed that updates itself.
// schema.prisma, the in-repo alternative:
generator erd {
provider = "prisma-erd-generator"
output = "../docs/erd.svg"
}
// runs on: npx prisma generate (requires mermaid-cli)Migrations are the change signal
Prisma gives schema changes a precise footprint: every prisma migrate dev run lands a new folder under prisma/migrations with a timestamped name and a migration.sql inside. A CI trigger filtered to that path fires exactly when the data model changes and never otherwise, which is the cleanest change signal in this whole guide series.
When you need to know what changed rather than just that something changed, prisma migrate diff compares schemas and databases in any combination, live database against schema file included, and emits the difference as SQL with --script. That output is a ready-made summary for the agent updating the diagram, and for the human reviewing the update.
The loop, and the README embed
On a merge touching prisma/migrations, one CI step hands schema.prisma to an agent connected to Datadef's MCP server (registry io.datadef/mcp): update the ERD, add the new model to its zone, redraw the changed relations, keep annotations. The connection needs an API key, available on paid plans. Datadef does not watch the repository; the trigger is your CI path filter, and the regeneration is that one invoked step.
Prisma projects usually want the ERD in the repo README, and GitHub strips iframes from READMEs, so the image URL form is the right embed: a Markdown image pointing at the diagram's public URL, which re-renders within minutes whenever the diagram changes. The GitHub specifics live in embed diagrams in a GitHub README.
What schema.prisma cannot say
The embed URL exists only for projects shared public, and a data model is often the most sensitive diagram a company has; for a private schema, the prisma-erd-generator committed-file approach may genuinely be the better fit, staleness and all. The diagram also shows the Prisma layer's view: database objects Prisma does not manage, views, triggers, tables owned by another service, are invisible to schema.prisma, and the database-side ERD workflow is the complement when those matter. Raw SQL migration streams without Prisma have their own page in a living diagram from SQL DDL.
Draw the invisible join tables
FAQ
How do I generate an ERD from schema.prisma?
Is prisma-erd-generator enough?
How do I keep the Prisma ERD up to date?
Do implicit many-to-many relations show up in the diagram?
Can the ERD live in the GitHub README and stay current?