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:
- Open the Designer — Click "Start Designing" to open the canvas
- Start Fresh or Use a Template — Create your first table or pick a template (Blog, SaaS, E-commerce)
- Add Columns — Click on a table and use the inspector panel to add columns
- Create Relations — Drag from one column to another to create a foreign key
- 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
idcolumn (UUID with auto-generation) created_atandupdated_attimestamp 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:
- Hover over the source column (the one that will have the foreign key)
- Click and drag from the connection handle on the right side
- 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 TYPEstatements for enumsCREATE TABLEstatements 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 = ONfor 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
@updatedAtfor updated_at columns
Drizzle Export
The Drizzle exporter generates TypeScript schemas with:
pgTabledefinitions 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:
@Entitydecorators with table name mapping@Columndecorators with full type configuration@PrimaryGeneratedColumnfor auto-generated IDs@ManyToOne,@OneToMany,@OneToOnerelations@CreateDateColumnand@UpdateDateColumn- Proper TypeScript types for all properties
Undo/Redo
SchemaFlow supports full undo/redo functionality:
- Undo:
⌘Z(Mac) orCtrl+Z(Windows/Linux) - Redo:
⌘⇧Z(Mac) orCtrl+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:
- Click the "Import SQL" button in the toolbar
- Paste your
CREATE TABLEstatements - Click "Import Schema"
The parser supports:
- PostgreSQL, MySQL, and SQLite syntax
- Inline foreign key constraints
ALTER TABLE ADD FOREIGN KEYstatements- 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.jsonfile - Load: Imports a previously saved schema
Note: Importing will replace your current schema. Use undo if needed.
Supported Column Types
| Category | Types |
|---|---|
| Identifiers | UUID, Serial, BigSerial |
| Numeric | Integer, BigInt, SmallInt, Decimal, Numeric, Real, Double |
| Text | Varchar, Text, Char |
| Date/Time | Date, Time, Timestamp, Timestamp with Time Zone |
| JSON | JSON, JSONB |
| Other | Boolean, 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
| Action | Mac | Windows/Linux |
|---|---|---|
| Undo | ⌘Z | Ctrl+Z |
| Redo | ⌘⇧Z | Ctrl+Y |
| Zoom In | ⌘+ or scroll | Ctrl+ or scroll |
| Zoom Out | ⌘- or scroll | Ctrl- or scroll |
| Pan Canvas | Click + drag on background | Click + drag on background |
Need Help?
If you have questions or run into issues, please open an issue on GitHub or reach out on Twitter.