VisuaSchema Designer
Quick Start
Create your first visual schema diagram in three simple steps:
- Open a database in the sidebar and right-click to select "Visual Schema Designer"
- Click Generate in the top-right corner to place every collection on the canvas and detect relationships, or drag collections from the left panel onto the canvas
- Review the result in the right panel: Relations lists every detected link and JSON Schema shows the generated validator for the collections on the canvas
This page covers the visual schema designer for MongoDB databases. For PostgreSQL, MySQL and other SQL databases, see SQL Visual Schema.
Canvas Navigation
The designer has the Collections list on the left, the canvas in the middle, and a collapsible right panel with Properties, Relations and JSON Schema tabs. The header shows the schema name next to Generate and Materialize, and the canvas has zoom controls in the bottom-left corner and a minimap in the bottom-right. Navigate and interact with the canvas using multiple interaction modes:
Interaction Modes
- Pan Mode - Click and drag the canvas to move around. Activate by pressing P or clicking the pan button in the toolbar. Hold CTRL/CMD and drag to pan without activating pan mode.
- Select Mode - Draw a rectangle to select multiple collections. Activate by pressing S or clicking the select button in the toolbar.
- Zoom - Use CTRL/CMD + Mouse Wheel to zoom in/out. Click the zoom reset button or use the percentage indicator to return to 100%.
- Grid Toggle - Show or hide the background grid for better alignment using the grid button in the toolbar.
Mouse Interactions
- Single Click (Collection) - Select a collection and view its properties in the right panel
- CTRL/CMD + Click - Multi-select collections
- Drag Collection - Move a collection card. Multi-selected collections move together.
- Right Click - Open context menu for collection actions (change color, find links, delete)
- Double Right Click - Zoom out from the clicked point
- Left Click - Zoom in to the clicked point (when CTRL/CMD is held)
Adding Collection Cards
Add collections to your schema canvas using multiple methods. Collections already on the canvas are marked with a checkmark in the left panel, and the panel footer shows the total number of collections:
Methods to Add Collections
- Drag and Drop - Drag collections from the left panel onto the canvas. Select multiple collections with CTRL/CMD + Click and drag them all at once.
- Generate - Click the Generate button to import all collections from the database at once, automatically arranged and linked.
- Create New Collection - Click "Create Collection" in the left panel to add an empty collection card that you can customize.
Collection Card Features
- Field Display - Each collection card shows fields with their BSON types (string, number, object, array, etc.)
- Nested Fields - Expand/collapse nested objects and arrays to view their structure
- Color Coding - Assign custom header colors to collections for visual organization
- Resize - Drag the bottom edge of a collection card to resize it
- Bring to Front - Click a collection to bring it to the front of overlapping cards
Creating Relationships
Connect collections to visualize relationships between your data models. Each line runs field to field and is labelled with its cardinality (1 or N) at each end:
Manual Relationship Creation
- Select Collection - Click a collection to select it and view its properties in the right panel
- Add Relation - Click the + button in the Relations section of the right panel
- Configure Connection - In the modal, select the target collection and specify source/target fields
- Connection Types - Choose between 1-1 (one-to-one), 1-N (one-to-many), or N-N (many-to-many) relationships
Automatic Relationship Detection
- Find Links (Single Collection) - Right-click a collection and select "Find Links" to auto-detect relationships with other collections on the canvas
- Find Links (All Collections) - Use the Auto Arrange and Create Relations button to detect all possible relationships across all collections
- Detection Logic - Automatically identifies _id references, foreign key patterns, and embedded document relationships
- Remove Links - Right-click a collection and select "Remove Links" to delete all its relationships
Managing Relationships
- View Relations - Open the Relations tab in the right panel to see every relationship on the canvas, with source and target collections, the linked fields and a cardinality badge such as 1-N. Use the filter box to narrow the list; the counter shows how many relations match
- Delete Relation - Click the trash icon next to a relationship in the right panel to remove it
- Visual Feedback - Relationship lines are drawn dynamically and update as you move collection cards
Auto-Generation Features
Automatically generate and organize your schema with intelligent automation. Generate reads every collection in the database, lays them all out on the canvas and creates the relationships it finds, so a full diagram appears in one click:
Auto-Generation Options
- Generate - Imports all collections from the database, analyzes sample documents to extract schemas, and automatically detects relationships
- Auto Arrange (Grid) - Arranges collections in a simple grid layout without creating relationships
- Auto Arrange (Connected Groups) - Uses graph theory to intelligently group related collections together and minimize line crossings for optimal layout
- Clear Canvas - Removes all collections from the canvas (requires confirmation)
Sample Size Configuration
When auto-generating schemas, VisualLeaf analyzes sample documents from each collection (default: 100 documents) to infer field types and structure. This ensures accurate schema detection while maintaining performance.
JSON Schema Panel
The JSON Schema tab in the right panel shows a $jsonSchema definition for every collection on the canvas, built from the fields and types on the cards. The header shows how many collections it covers, and you can Edit it, Copy it to the clipboard or download it as a file. It is a quick way to turn a diagram into validators you can apply with the JSON Schema editor.
Export & Save Options
Save and export your schema diagrams in multiple formats:
Save Options
- Save - Choose Save from the save menu in the canvas toolbar to store the schema definition to the database for later retrieval and editing
- Auto-Save - The canvas state (zoom, pan, collection positions) is automatically saved to local storage when you switch tabs
- Schema Naming - Click the edit icon next to the schema name to rename it. Only alphanumeric characters, spaces, underscores, hyphens, and periods are allowed.
- Export as PNG - Export the entire schema as a color PNG image. The canvas is automatically fitted to include all collections before export.
- Export as B&W PNG - Export as a black and white PNG image, ideal for printing or documentation
- Export as SVG - Export a scalable vector image (see below)
- Export as JSON - Download the complete schema definition as a JSON file, including collections, fields, relationships, and layout information
- Export as HTML - Export an editable HTML diagram (see below)
Import Schema
- Import JSON - Click the Import button to load a previously exported JSON schema file. The schema is restored with all collections, relationships, and positions.
Exporting Schema Diagrams
Beyond PNG and JSON, the Schema Designer can render your diagram to three shareable formats. Every export includes all collections, fields, and relationship lines currently on the canvas.
- PNG (1x / 2x / 4x) - Raster export at three pixel densities. Choose 1x for quick screenshots and Slack pastes, 2x for wikis and Confluence pages that render on Retina displays, and 4x when you plan to zoom in or print a poster.
- SVG - A scalable vector export intended for high-resolution documentation, decks, and print. Text, arrows, and cardinality markers stay crisp at any zoom level, and downstream tools (Figma, Illustrator, Inkscape) can re-style the diagram.
- Editable HTML - A self-contained HTML file with the diagram embedded and editable annotations. Open it in any browser, click a card or an arrow to add a note, and share the file (or host it on any static host) so teammates can annotate without VisuaLeaf installed.
- PNG - Best for wikis, Slack, chat, and anywhere you need a single-file image. Pick 2x or 4x when the target surface is Retina or the reader will zoom in.
- SVG - Best for long-form docs, printed handouts, whitepapers, and any surface that must remain sharp at arbitrary sizes. Also the format to reach for when a designer will re-style the diagram in Figma or Illustrator.
- Editable HTML - Best for shareable, interactive diagrams — onboarding, design reviews, and any workflow where reviewers should be able to leave inline notes on the diagram itself. The exported file is standalone; hand it to a teammate or drop it on any static host.
Keyboard Shortcuts
| Shortcut |
Action |
|
P
|
Toggle Pan mode (click and drag to move canvas) |
|
S
|
Toggle Select mode (draw rectangle to select multiple) |
|
Ctrl
+
A
|
Select all collections on canvas |
|
Delete
or
Backspace
|
Delete selected collections |
|
Ctrl
+
Wheel
|
Zoom in/out (cursor position is zoom center) |
|
Ctrl
+
Click
|
Multi-select collections or temporary pan mode |
Note: On macOS, use Cmd instead of Ctrl
Right-click on a collection card to access these quick actions:
- Change Color - Assign a custom header color to the collection. Choose from 11 preset colors or reset to default.
- Find Links - Automatically detect and create relationships between this collection and other collections on the canvas
- Remove Links - Delete all relationship lines connected to this collection
- Delete Collection - Remove the collection from the canvas (does not delete from database)
Multi-Selection: When multiple collections are selected, context menu actions (color change, find links, remove links, delete) apply to all selected collections.
Pro Tips
- Start with Generate - Use the Generate button to quickly import all collections and detect relationships, then fine-tune the layout and connections manually.
- Use Color Coding - Assign colors to related collections (e.g., all user-related collections in blue, all product collections in green) for better visual organization in complex schemas.
- Export for Documentation - Export your schema as a B&W PNG for technical documentation or as JSON to share the complete schema definition with your team.
- Multi-Select for Efficiency - Use CTRL/CMD + Click to select multiple collections, then drag them together or apply bulk operations via the context menu.
- Zoom for Detail - Use CTRL + Mouse Wheel to zoom in when working with collections that have many fields. The zoom is centered on your cursor position.
- Panel Management - Collapse the left and right panels to maximize canvas space when working with large schemas. Your panel state is preserved when switching tabs.
- JSON Schema Activity - Create and edit detailed JSON schemas with validation rules and BSON type definitions for individual collections
- Collection Activity - View and query the actual data in your collections to verify the schema matches reality
- SQL Visual Schema - Design and generate entity-relationship diagrams for SQL databases
- Index Management - Optimize your schema by creating indexes based on the field relationships you discover in the visual designer