@sbt/plugin-depgraph
Purpose
Visualizes all backend dependency relationships in Supabase as both an interactive HTML graph and Mermaid diagrams. Covers tables, RLS policies, functions, triggers, FK constraints, and enum/type usage.
Data Sources
- •
docs/backend-atlas-data.json— generated bysbt generate-atlas - •
supabase/current/types/— snapshot type SQL files for FK/column type info - •
src/integrations/supabase/types.ts— Supabase TypeScript types with FK relationships and enum usage
No running database is required.
Commands
code
sbt depgraph Generate both HTML and Mermaid dependency graphs sbt depgraph --html Generate only the interactive HTML graph sbt depgraph --mermaid Generate only the Mermaid flowchart sbt depgraph --json Output raw graph data as JSON sbt depgraph -h/--help Show help
Output Files
- •
docs/dependency-graph.html— Self-contained interactive HTML with force-directed graph layout, node filtering, search, zoom/pan, and click-to-highlight - •
docs/dependency-graph.md— Mermaid flowchart with styled subgraphs per node type
Relationship Types Detected
| Edge Label | Source | Target | Detection Method |
|---|---|---|---|
| fires on | trigger | table | trigger.table field |
| calls | trigger | function | trigger.function_name field |
| guards | policy | table | policy.table field |
| references | function | table | Parse function SQL body for table references |
| reads from | view | table | Parse view SQL for FROM/JOIN table references |
| uses enum | table | enum | Parse TypeScript types for enum column types |
| calls in check | policy | function | Parse policy.using and policy.with_check |
| FK to | table | table | Parse TypeScript types for FK relationships |
Atlas Integration
When sbt generate-atlas runs, this plugin contributes:
- •A "Dependency Graph" section with summary stat cards (total nodes, edges, relationship counts)
- •A link to open the full interactive graph
- •Relationship detail cards expandable in the Atlas HTML
Configuration
No configuration fields needed. Add to supabase-tools.config.json:
json
{
"path": "node_modules/@sbt/plugin-depgraph",
"config": {}
}