Transform your DBML files into beautiful, interactive database diagrams instantly.
Perfect for database architects, developers, and anyone working with database schemas. Turn text-based DBML into visual understanding with just one click.
- Blank Preview Fix: Fixed the preview panel showing up empty in the installed extension (v1.6.0)
- Relationship Handles Fix: A column that is both the source of one relationship and the target of another now keeps both connection points
- Optional Relationship Syntax: DBML's
?relationship modifier (>?,?>,<?,?<) is now supported instead of failing to parse - Multi-Schema Relationships Fix: Relationships between default-schema tables now render correctly in files that also use explicitly-named schemas
- One-Click Preview - Transform DBML files into interactive diagrams instantly
- Real-Time Updates - See changes as you save your DBML files
- Drag & Drop Tables - Customize layout with automatic position saving
- Smart Table Notes - Clean popup tooltips for table documentation
- Visual Connections - See foreign key relationships at a glance
- Interactive Tooltips - Click relationships for detailed information
- Clickable Navigation - Click table names in tooltips to navigate instantly
- Column-Level Precision - Exact source and target column identification
- Cardinality Display - Clear 1:1, 1:_, _:* relationship indicators
- Multi-Schema Files - Handle complex databases with multiple schemas
- Table Grouping - Visual organization with background containers
- Rich Column Details - Types, constraints, keys, and enum support
- Full DBML Specification - Complete support for all DBML features
- Flexible Theming - Choose VS Code theme inheritance or clean light theme
- Multiple Access Points - Command palette, context menu, keyboard shortcuts
- Side-by-Side Editing - Preview alongside your DBML file
- Quick Access -
Ctrl+Shift+D/Cmd+Shift+Dkeyboard shortcut
- PNG Export - High-resolution raster images for documentation
- SVG Export - Scalable vector graphics for presentations
- Configurable Quality - Adjust image quality and resolution
- Background Control - Export with or without background color
From VS Code:
# VS Code / Visual Studio Code
code --install-extension rizkykurniawan.dbml-previewerFrom VSCodium/Open VSX:
# VSCodium or other Open VSX compatible editors
codium --install-extension rizkykurniawan.dbml-previewerOr search "DBML Previewer" in your editor's Extensions panel (Ctrl+Shift+X)
Supported Editors:
- Visual Studio Code (via VS Code Marketplace)
- VSCodium (via Open VSX Registry)
- Eclipse Theia
- Gitpod
- Any VS Code compatible editor
- Open any
.dbmlfile in VS Code - Press
Ctrl+Shift+D(Windows/Linux) orCmd+Shift+D(macOS) - Done - Your database diagram appears instantly
Alternative Methods:
- Right-click file → "Preview DBML"
- Click preview button in editor title bar
- Command Palette → "DBML Previewer: Preview DBML"
Create a .dbml file with this sample content to try the extension:
Project sample_project {
database_type: 'PostgreSQL'
Note: 'Sample e-commerce database schema'
}
Table users [headercolor: #27AE60] {
id integer [primary key, increment]
username varchar(50) [not null, unique]
email varchar(100) [not null, unique]
created_at timestamp [default: `now()`]
Note: 'User accounts table'
}
Table orders [headercolor: #3498DB] {
id integer [primary key, increment]
user_id integer [not null, ref: > users.id]
total decimal(10,2) [not null]
status varchar(20) [default: 'pending']
created_at timestamp [default: `now()`]
Note: 'Customer orders'
}
Table order_items {
order_id integer [ref: > orders.id]
product_id integer [not null]
quantity integer [not null]
price decimal(10,2) [not null]
indexes {
(order_id, product_id) [pk]
}
}
This extension supports the full DBML specification including:
- Tables with columns, types, and constraints
- Primary Keys and Foreign Keys with visual indicators
- Relationships (
>,<,-,<>) with proper cardinality display, including the optional?modifier (e.g.>?,?>) - Unique Constraints and Not Null constraints
- Table Notes
- Indexes (simple and composite)
- Table Groups for schema organization
- Custom Colors for tables (
headercolor) and groups (color) - CHECK Constraints - Table-level and column-level check constraint support
- Multi-schema database support
- Default Values and Auto-increment fields
- Zoom: Mouse wheel or zoom controls in bottom-left
- Pan: Click and drag empty space to move around
- Fit View: Reset zoom to fit entire diagram
- Drag Tables: Click and drag table headers to reposition
- Group Movement: Drag table groups to move all contained tables
- Relationship Details: Click relationship lines for detailed information
- Navigate via Tooltips: Click table names in relationship tooltips to jump to that table
Ctrl+Shift+D/Cmd+Shift+D: Open DBML preview- Mouse wheel: Zoom in/out
- Space + drag: Pan diagram
- Escape: Close relationship tooltips
The extension works out of the box with sensible defaults and includes the following configuration options:
diagram.inheritThemeStyle(boolean, default:false)- Controls whether diagrams inherit VS Code theme styling
- When disabled, uses a clean light theme optimized for diagram readability
- Prevents issues with poorly designed VS Code themes
diagram.showCardinalityLabels(boolean, default:false)- Show cardinality labels (0, 1, N) on relationship edges
0= nullable one-side,1= non-nullable one-side,N= many-side- Useful for quickly reading relationship multiplicities without opening tooltips
diagram.edgeType(string, default:"smoothstep")- Customizes the visual style of relationship connections
- Available options:
"straight"- Direct straight lines between tables"smoothstep"- Smooth step edges with rounded corners (recommended)"bezier"- Curved bezier edges for organic appearance
-
diagram.exportQuality(number, default:0.95)- Image quality for PNG exports (0.1 to 1.0)
- Higher values produce better quality but larger file sizes
- Recommended: 0.95 for high-quality exports
-
diagram.exportBackground(boolean, default:true)- Include background in exported images
- When disabled, exported images have transparent background
- Useful for presentations and documentation
-
diagram.exportPadding(number, default:20)- Padding around the diagram in exported images (in pixels)
- Range: 0-100 pixels
- Provides visual breathing room around your diagram
-
diagram.bulkExport.outputFolder(string, default:"")- Path to the folder where bulk-exported files will be saved
- Relative paths resolve from the workspace root
- Leave empty to save into a
dbml-exportssubfolder inside the source folder
- Open VS Code Settings (
Ctrl+,/Cmd+,) - Search for "diagram" or "DBML Previewer"
- Adjust settings to your preference
- Changes apply immediately without restart
Via UI Buttons (recommended):
- Open any DBML file and preview it
- Look for export buttons in the top-right stats panel
- Click "Export PNG" or "Export SVG"
- Image downloads automatically with timestamped filename
Via Command Palette:
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Search for "Export Diagram to PNG" or "Export Diagram to SVG"
- Execute the command
- Image downloads automatically
Via Explorer context menu (recommended):
- Right-click any folder in the VS Code Explorer panel
- Select "Bulk Export DBML Files to PNG" or "Bulk Export DBML Files to SVG"
- All
.dbmlfiles in the folder are exported automatically
Via Keyboard Shortcuts:
Ctrl+Shift+Alt+E/Cmd+Shift+Alt+E: Bulk export to PNGCtrl+Shift+Alt+S/Cmd+Shift+Alt+S: Bulk export to SVG
Via Command Palette:
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Search for "Bulk Export DBML Files to PNG" or "Bulk Export DBML Files to SVG"
- Performance optimization toggles
- Advanced layout algorithm options
Want to contribute? Check out our Contributing Guide for detailed setup instructions, coding guidelines, and development workflow.
Quick Development Setup:
git clone https://github.com/kykurniawan/vscode-dbml-previewer.git
cd vscode-dbml-previewer
npm install && npm run buildArchitecture: React + React Flow + DBML Core + Dagre Layout
Love this extension? Help make it even better:
- Report Bugs - Found an issue? Let us know
- Request Features - Have ideas? Share them
- Star the Project - Show your support
- Code Contributions - Check our Contributing Guide
Quick Start: Fork → Branch → Code → Test → Pull Request
If you encounter any problems:
- Check existing issues on GitHub Issues
- Create a new issue with:
- Clear description of the problem
- Steps to reproduce
- Sample DBML file (if applicable)
- VS Code version and OS information
- Check our documentation
- Join discussions in GitHub Issues
- Contact us at contact.rizkykurniawan@gmail.com
- VS Code: 1.102.0+
- File Format:
.dbmlfiles (DBML v2 syntax) - Zero Setup: No additional dependencies required
This project is licensed under the MIT License - see the LICENSE file for details.
Built with amazing open source tools:
- DBML Community - Database Markup Language specification
- React Flow - Interactive diagram library
- VS Code API - Robust extension platform
- Zero Configuration - Works instantly with any DBML file
- Lightning Fast - Optimized for performance and responsiveness
- Professional Quality - Production-ready with enterprise features
- Community Driven - Built with real developer feedback
Star this project if it helps you visualize databases better.
Made by Rizky Kurniawan
"From DBML text to visual database understanding in seconds"
