Skip to main content

Getting Started with Diagrams

ChartDB provides multiple ways to create database diagrams. Whether you’re starting from scratch, using a template, or importing an existing schema, ChartDB makes it easy to visualize your database structure.

Creating a New Diagram

Starting from Scratch

To create a blank diagram:
1

Select Database Type

Choose your database type (MySQL, PostgreSQL, SQLite, SQL Server, MariaDB, etc.) when creating a new diagram.
2

Create Your First Table

Right-click on the canvas and select New Table from the context menu, or use the keyboard shortcut:
  • macOS: ⌘ + Click
  • Windows/Linux: Ctrl + Click
3

Name Your Diagram

Give your diagram a meaningful name to help organize your work.
ChartDB automatically saves your diagram as you work, so you don’t have to worry about losing your progress.

Using Templates

ChartDB provides over 40 pre-built database templates to help you get started quickly. These templates are based on real-world applications and popular frameworks.

Available Template Categories

Framework Templates

  • Laravel (Authentication, Permissions, Spark)
  • Django (Core, Axes)
  • Adonis ACL
  • Rails (Devise, Doorkeeper, Flipper)

Application Templates

  • WordPress
  • Flarum
  • BookStack
  • Monica (Personal CRM)
  • Koel (Music Streaming)

Domain Templates

  • Employee Management
  • E-commerce (Sylius)
  • Ticketing (Ticketit)
  • Accounting (Akaunting)

Example Apps

  • Twitter Clone
  • Airbnb Clone
  • Hacker News
  • Pokemon Database

Using a Template

1

Browse Templates

From the home screen or new diagram dialog, browse through the available templates.
2

Select Template

Click on a template to preview its structure. Each template shows:
  • Number of tables
  • Database type
  • Relationships
  • Description and source URL (if available)
3

Create from Template

Click Use Template to create a new diagram based on the selected template. You can then customize it to fit your needs.
Templates are fully editable. Use them as starting points and modify them to match your specific requirements.

Importing Existing Schemas

You can import your existing database schema into ChartDB using several methods:

Import from SQL DDL

Import your database schema from SQL Data Definition Language statements:
CREATE TABLE employees (
    emp_no INT PRIMARY KEY,
    birth_date DATE NOT NULL,
    first_name VARCHAR(14) NOT NULL,
    last_name VARCHAR(16) NOT NULL,
    gender ENUM('M', 'F') NOT NULL,
    hire_date DATE NOT NULL
);

CREATE TABLE departments (
    dept_no CHAR(4) PRIMARY KEY,
    dept_name VARCHAR(40) UNIQUE NOT NULL
);
1

Access Import

Right-click on the canvas and select Import SQL/DBML, or use the import button in the toolbar.
2

Paste SQL

Paste your SQL DDL statements into the import dialog.
3

Import

Click Import to create tables, fields, and relationships from your SQL schema.

Import from DBML

DBML (Database Markup Language) is a simple, readable DSL for defining database schemas:
Table employees {
  emp_no int [pk]
  birth_date date [not null]
  first_name varchar(14) [not null]
  last_name varchar(16) [not null]
  gender enum('M', 'F') [not null]
  hire_date date [not null]
}

Table departments {
  dept_no char(4) [pk]
  dept_name varchar(40) [unique, not null]
}

Ref: dept_emp.emp_no > employees.emp_no
Ref: dept_emp.dept_no > departments.dept_no
When importing, ensure your SQL dialect matches the selected database type for accurate field type mapping.

Import from Database Connection

Connect directly to your database to import the live schema:
Database connection import supports PostgreSQL, MySQL, MariaDB, and SQL Server.

Diagram Configuration

Database Type Settings

Each diagram is tied to a specific database type, which affects:
  • Available data types
  • SQL syntax for exports
  • Field attributes and constraints
  • Default schema naming
Supported Database Types:
  • PostgreSQL
  • MySQL
  • MariaDB
  • SQL Server
  • SQLite
  • Generic SQL

Database Edition

Some database types support multiple editions with different capabilities:
  • Standard PostgreSQL
  • PostgreSQL with specific extensions
  • SQL Server Express
  • SQL Server Standard
  • SQL Server Enterprise

Diagram Views

ChartDB supports both tables and database views:

Creating Views

Database views can be created alongside regular tables:
1

Create View

Right-click on the canvas and select New View.
2

Define View

Add fields to your view. Views are displayed with a different color (gray) to distinguish them from tables.
Views are marked with the isView property and can optionally be marked as isMaterializedView for databases that support materialized views.

Canvas Controls

  • Pan: Click and drag on empty canvas space
  • Zoom: Use mouse wheel or pinch gesture
  • Fit to Screen: Press ⌘0 (Mac) or Ctrl+0 (Windows) to view all elements

Canvas Context Menu

Right-click on the canvas to access:
  • Create new table
  • Create new view (if enabled)
  • Create new relationship
  • Create new area (for grouping)
  • Create new note
  • Import SQL/DBML

Schema Organization

For databases that support schemas (like PostgreSQL), you can organize tables into different schemas:
CREATE SCHEMA pokemon;

CREATE TABLE pokemon.types (
    type_id INT PRIMARY KEY,
    type_name VARCHAR NOT NULL
);
Schemas help organize large databases by grouping related tables together. ChartDB automatically assigns new tables to the default schema for your database type.

Best Practices

If you’re building a common type of application (e-commerce, blog, SaaS), start with a template and modify it. This saves time and ensures you don’t miss important tables.
Give your diagram a clear, descriptive name that indicates its purpose or the application it represents.
If you have an existing database, import it rather than recreating it manually. This ensures accuracy and saves time.
Select the correct database type at the start. While you can change it later, data types and features vary between databases.

Next Steps

Editing Schema

Learn how to add and modify tables and fields

Managing Relationships

Create and manage relationships between tables

Using Areas

Organize your diagram with areas

Templates

Explore all available templates