@sbtools/plugin-erd
v0.5.0
Published
ERD diagram generation plugin for supabase-tools.
Readme
@sbtools/plugin-erd
Plugin for supabase-tools that generates Mermaid ERD diagrams for each public table. Connects to the database to introspect columns, primary keys, and foreign keys.
Quick Start
# Ensure database is running (sbt start)
npm run sbt -- generate-erd
# Output: docs/entity-relations/<table>.mdCommands
| Command | Description |
|---------|-------------|
| generate-erd | Generate Mermaid ERD diagrams for all public tables |
Configuration
Plugin config goes in plugins[].config:
{
"plugins": [{
"path": "@sbtools/plugin-erd",
"config": {
"erdOutput": "docs/development/entity-relations",
"displayColumns": ["name", "email", "full_name", "slug", "title"]
}
}]
}| Key | Default | Description |
|-----|---------|-------------|
| erdOutput | <docsOutput>/entity-relations | Output directory for .md files |
| displayColumns | ["name", "email", "full_name", "slug", "title"] | Column names to display on referenced entities |
Dependencies
| Type | Requirement |
|------|-------------|
| Database | DATABASE_URL or config.db.url; DB must be running and accessible |
Project Structure
packages/plugin-erd/
├── src/
│ ├── index.ts # Plugin entry, generate-erd command
│ └── builder.ts # Mermaid generation, column mapping
├── package.json
├── tsconfig.json
└── README.md