Documentation

Everything you need to know about designing database schemas with SchemaFlow.

Quick Start

SchemaFlow is a visual database schema designer that runs entirely in your browser. Here's how to get started in under a minute:

  1. Open the Designer — Click "Start Designing" to open the canvas
  2. Start Fresh or Use a Template — Create your first table or pick a template (Blog, SaaS, E-commerce)
  3. Add Columns — Click on a table and use the inspector panel to add columns
  4. Create Relations — Drag from one column to another to create a foreign key
  5. Export — Click the export button and choose your format

Using Templates

SchemaFlow includes pre-built schema templates to help you get started quickly:

  • 📝 Blog — Users, posts, categories, comments with proper relationships
  • 🚀 SaaS — Multi-tenant with organizations, members, projects, and subscriptions
  • 🛒 E-commerce — Customers, products, categories, orders, and order items

Templates appear in the empty state when you first open the designer, or you can start fresh and build from scratch.

Creating Tables

To create a new table, click the "Add Table" button in the left sidebar. A new table will appear on the canvas with:

  • A default id column (UUID with auto-generation)
  • created_at and updated_at timestamp columns

You can rename the table by clicking on its name in the inspector panel or by double-clicking the table header on the canvas.

Adding Columns

Select a table by clicking on it, then use the inspector panel on the right to:

  • Add new columns with the "Add Column" button
  • Set the column name and type
  • Configure constraints (primary key, nullable, unique)
  • Set default values

Creating Relations

Relations represent foreign key constraints between tables. To create a relation:

  1. Hover over the source column (the one that will have the foreign key)
  2. Click and drag from the connection handle on the right side
  3. Drop on the target column (usually a primary key in another table)

The relation will be created with default settings (one-to-many, ON DELETE CASCADE). You can modify these settings in the inspector panel when the relation is selected.

PostgreSQL Export

The PostgreSQL exporter generates standard SQL DDL statements including:

  • CREATE TYPE statements for enums
  • CREATE TABLE statements with all columns and constraints
  • Primary key and unique constraints
  • Foreign key constraints with ON DELETE/ON UPDATE actions
  • Default values and NOT NULL constraints
  • Indexes for foreign key columns

MySQL Export

The MySQL exporter generates MySQL-compatible SQL with:

  • InnoDB engine by default
  • UTF8MB4 character set and collation
  • Inline ENUM types
  • AUTO_INCREMENT for serial columns
  • Proper type mappings (TINYINT for boolean, DATETIME for timestamp)

SQLite Export

The SQLite exporter generates lightweight SQL with:

  • PRAGMA foreign_keys = ON for foreign key enforcement
  • CHECK constraints for enum validation
  • AUTOINCREMENT for serial columns
  • TEXT storage for dates and UUIDs

Prisma Export

The Prisma exporter generates a complete schema.prisma file including:

  • Model definitions with proper field types
  • Relation directives (@relation)
  • Field attributes (@id, @unique, @default)
  • Enum definitions
  • @updatedAt for updated_at columns

Drizzle Export

The Drizzle exporter generates TypeScript schemas with:

  • pgTable definitions with all columns
  • Full type imports from drizzle-orm/pg-core
  • Relations using relations() helper
  • Proper constraint methods (.primaryKey(), .notNull(), etc.)
  • Default value helpers (.defaultRandom(), .defaultNow())

TypeORM Export

The TypeORM exporter generates entity classes with:

  • @Entity decorators with table name mapping
  • @Column decorators with full type configuration
  • @PrimaryGeneratedColumn for auto-generated IDs
  • @ManyToOne, @OneToMany, @OneToOne relations
  • @CreateDateColumn and @UpdateDateColumn
  • Proper TypeScript types for all properties

Undo/Redo

SchemaFlow supports full undo/redo functionality:

  • Undo: ⌘Z (Mac) or Ctrl+Z (Windows/Linux)
  • Redo: ⌘⇧Z (Mac) or Ctrl+Y (Windows/Linux)

You can also use the undo/redo buttons in the toolbar. SchemaFlow keeps track of the last 50 states.

SQL Import

Already have a database? Import your existing schema by pasting SQL:

  1. Click the "Import SQL" button in the toolbar
  2. Paste your CREATE TABLE statements
  3. Click "Import Schema"

The parser supports:

  • PostgreSQL, MySQL, and SQLite syntax
  • Inline foreign key constraints
  • ALTER TABLE ADD FOREIGN KEY statements
  • Common column types and constraints

Image Export

Export your schema diagram as an image for documentation or sharing:

  • PNG: High-resolution raster image (2x pixel ratio)
  • SVG: Scalable vector graphic for presentations

Find these options in the Export dropdown menu in the toolbar.

Import/Export JSON

Save and restore your schemas using JSON:

  • Save: Downloads your schema as a .schema.json file
  • Load: Imports a previously saved schema

Note: Importing will replace your current schema. Use undo if needed.

Supported Column Types

CategoryTypes
IdentifiersUUID, Serial, BigSerial
NumericInteger, BigInt, SmallInt, Decimal, Numeric, Real, Double
TextVarchar, Text, Char
Date/TimeDate, Time, Timestamp, Timestamp with Time Zone
JSONJSON, JSONB
OtherBoolean, Bytea, Enum

Enums

You can create custom enum types for columns. Enums are defined globally and can be used by any column in any table. The exporter will generate the appropriate enum definition for each target format.

Relationship Types

  • One-to-One — Each record in table A relates to exactly one record in table B
  • One-to-Many — Each record in table A can relate to multiple records in table B (most common)
  • Many-to-Many — Records in table A can relate to multiple records in table B and vice versa (requires a junction table)

Keyboard Shortcuts

ActionMacWindows/Linux
Undo⌘ZCtrl+Z
Redo⌘⇧ZCtrl+Y
Zoom In⌘+ or scrollCtrl+ or scroll
Zoom Out⌘- or scrollCtrl- or scroll
Pan CanvasClick + drag on backgroundClick + drag on background

Need Help?

If you have questions or run into issues, please open an issue on GitHub or reach out on Twitter.