< We're launched Liam ERD!

Learn More

Prisma

If you’re using Prisma, in most cases you can automatically generate a useful ER diagram with Liam ERD. This page provides instructions and tips for generating an ER diagram in a Prisma project.

Prisma and schema.prisma

When a Prisma project manages migrations using the Prisma CLI, the latest database structure is typically described in schema.prisma.

When using Liam CLI, specify --format prisma and --input path/to/schema.prisma as follows:

npx @liam-hq/cli erd build --format prisma --input prisma/schema.prisma

If the above command runs without issue, you should see an ER diagram generated.

Handling Multiple Prisma Schema Files

If you use the prismaSchemaFolder option in your Prisma configuration, you can still generate the ER diagram by specifying a glob pattern to include all .prisma files in the folder.

For example, if you have multiple .prisma files in the prisma/schema/ directory, use the following command:

npx @liam-hq/cli erd build --format prisma --input "prisma/schema/*.prisma"

This allows you to generate the ER diagram.

Under the Hood

Liam CLI analyzes the content of your schema.prisma file using a dedicated parser that relies on @prisma/internals to build the ER diagram.

On this page