Configuration Reference

You can configure the generator by adding fields to the generator erd { ... } block in your schema.prisma.

Options Table

Option Type Default Description
output string ./prisma/ERD.svg The path and filename for the output file. Supports .svg, .png, .pdf, and .md.
theme string default The visual theme for the diagram. Options: default, forest, dark, neutral.
mmdcPath string node_modules/.bin Custom path to the mermaid-cli binary (mmdc).
tableOnly boolean false If true, hides columns and attributes, showing only table names and relationships.
ignoreEnums boolean false If true, Enum types will not be rendered in the diagram.
ignoreViews boolean false If true, Database Views will not be rendered.
ignorePattern string undefined A comma-separated list of patterns to exclude tables (e.g. sys_*,Temp).
includeRelationFromFields boolean false If true, explicitly renders relation fields (foreign keys) inside the table structure.
disableEmoji boolean false If true, replaces emojis (🗝️, ❓) with text labels (PK, nullable).
disabled boolean false If true, skips generation entirely.
erdDebug boolean false Enables debug logging and artifacts.
mermaidConfig string undefined Path to a custom Mermaid configuration file (.js or .json).
puppeteerConfig string undefined Path to a custom Puppeteer configuration JSON file.

Detailed Examples

Changing Output Format

To generate a PNG instead of an SVG:

generator erd {
  provider = "prisma-erd-generator"
  output   = "../diagrams/schema.png"
}

Theming

Use the forest theme for a greener look:

generator erd {
  provider = "prisma-erd-generator"
  theme    = "forest"
}

Filtering Tables (Ignore Patterns)

You can filter out internal or system tables using wildcards.

  • *: Matches any characters.
  • ?: Matches a single character.
generator erd {
  provider      = "prisma-erd-generator"
  // Hides tables starting with 'sys_', 'Internal', exactly 'Session', or starting with '_'
  ignorePattern = "sys_*,Internal*,Session,_*"
}

Simplified Diagram (Table Only)

For very large schemas, hiding columns makes the diagram more readable.

generator erd {
  provider  = "prisma-erd-generator"
  tableOnly = true
}

Custom Mermaid Configuration

If the built-in themes aren't enough, you can provide a config file to customize Mermaid.js behavior.

schema.prisma:

generator erd {
  provider      = "prisma-erd-generator"
  mermaidConfig = "./mermaid-config.js"
}

mermaid-config.js:

/** @type {import('mermaid').MermaidConfig} */
const config = {
    theme: 'base',
    themeVariables: {
        primaryColor: '#ff0000'
    }
}
module.exports = config