# ER Flow — Complete Documentation for LLMs > Online ER diagram modeler and database design tool with real-time collaboration, AI integration via MCP Server, and migration generation. Website: https://erflow.io App: https://app.erflow.io MCP Server endpoint: https://app.erflow.io/api/mcp/{uuid} --- ## What is ER Flow? ER Flow is a purpose-built, web-based tool for designing relational database schemas visually. It combines a visual canvas editor with real-time collaboration (powered by CRDTs/Yjs), AI integration via the Model Context Protocol (MCP), and automatic migration generation. Supported databases: PostgreSQL, MySQL, Oracle, SQL Server, SQLite. --- ## Core Features ### Visual ER Diagram Editor - Drag-and-drop canvas for creating and arranging tables - Click to add tables, columns, indexes, and foreign keys - Visual relationship lines with cardinality indicators - Zoom, pan, multi-select, undo/redo - Color-coded table groups for organizing large schemas - Canvas notes for documenting design decisions - Multiple diagrams per data model (different views of the same schema) ### Tables & Columns - Create tables with auto-increment primary keys - Column types specific to each database engine - Column properties: name, type, length, nullable, default, unique, unsigned, auto-increment - Composite primary keys - Column reordering ### Relationships & Foreign Keys - Visual foreign key creation by clicking source and target tables - One-to-one, one-to-many, many-to-many relationships - Cascade rules: ON DELETE and ON UPDATE (CASCADE, SET NULL, RESTRICT, NO ACTION) - Visual cardinality indicators on relationship lines ### Indexes - Create indexes on single or multiple columns - Unique indexes - Index type configuration per database engine ### Database Views - Create and edit SQL views - AI-assisted SQL generation for view definitions - Version history for views ### Stored Procedures - Create procedures with parameters (IN, OUT, INOUT) - SQL body editor - Security type (DEFINER, INVOKER) - SQL data access options (CONTAINS SQL, NO SQL, READS SQL DATA, MODIFIES SQL DATA) - Version history with diff viewing ### Triggers - Create triggers on tables - Event types: INSERT, UPDATE, DELETE - Timing: BEFORE, AFTER - SQL body editor - Version history with diff viewing ### Real-Time Collaboration - Multiple users can edit the same diagram simultaneously - Live cursors showing each collaborator's position - Presence indicators (avatars in toolbar) - Powered by CRDTs (Yjs) for conflict-free concurrent editing - Changes synced via WebSocket (Laravel Reverb) - Editor and Viewer permission levels - Share via link or email invite ### Migration Generation - Checkpoint-based schema diffing - Detects: table create/drop/rename, column add/drop/rename/modify, index add/drop, FK add/drop, PK set - Generates both up() and down() methods - Supported frameworks: Laravel, Phinx - Copy to clipboard, download as file, or apply (update baseline) ### SQL Import - Import from .sql files (drag & drop or file picker) - Paste SQL text directly - Supports CREATE TABLE with all constraints - Supports CREATE INDEX (standalone) - Handles foreign key references, auto-increment detection - Preview parsed tables before importing - Conflict handling (rename duplicates, create stub tables) ### Checkpoints & Versioning - Save complete schema snapshots as checkpoints - Name and describe each checkpoint - Diff any checkpoint against current state - Foundation for migration generation --- ## MCP Server (AI Integration) ### Overview The Model Context Protocol (MCP) is an open standard that lets AI coding assistants interact with external tools. ER Flow provides an MCP Server that exposes your data model to AI assistants like Cursor and Windsurf. ### Endpoint `https://app.erflow.io/api/mcp/{uuid}` The `{uuid}` is the data model's unique identifier, which also serves as the authentication token. ### Configuration for Cursor Create `.cursor/mcp.json` in your project root: ```json { "mcpServers": { "erflow": { "url": "https://app.erflow.io/api/mcp/YOUR_UUID_HERE" } } } ``` ### Available Tools (25+) **Schema Read:** - `get-data-model-dbml` — Returns the entire schema in DBML format. Always call this first. **Tables:** - `create-table` — Create a new table - `update-table` — Update table properties - `rename-table` — Rename a table - `delete-table` — Delete a table **Columns:** - `create-column` — Add a column to a table - `update-column` — Modify column properties - `rename-column` — Rename a column - `delete-column` — Remove a column **Indexes:** - `create-index` — Create an index - `update-index` — Modify an index - `rename-index` — Rename an index - `delete-index` — Remove an index **Foreign Keys:** - `create-foreign-key` — Create a foreign key relationship - `update-foreign-key` — Modify a foreign key - `delete-foreign-key` — Remove a foreign key **Primary Keys:** - `set-primary-key` — Set the primary key columns for a table **Views:** - `create-view` — Create a database view - `update-view` — Modify a view - `delete-view` — Remove a view **Triggers:** - `create-trigger` — Create a trigger - `update-trigger` — Modify a trigger - `delete-trigger` — Remove a trigger **Procedures:** - `create-procedure` — Create a stored procedure - `update-procedure` — Modify a procedure - `delete-procedure` — Remove a procedure **Batch:** - `batch-operations` — Execute multiple operations in a single request (recommended for creating entire schemas) ### Best Practices for AI 1. Always call `get-data-model-dbml` first to understand the current schema 2. Use `batch-operations` for creating multiple tables/columns/FKs at once 3. Changes appear in the visual editor in real-time 4. All AI changes are undoable from the editor (Ctrl+Z) --- ## Database Support ### PostgreSQL Column types: bigint, integer, smallint, serial, bigserial, varchar, char, text, boolean, date, time, timestamp, timestamptz, decimal, numeric, real, double precision, json, jsonb, uuid, bytea, inet, cidr, macaddr, money, xml, point, line, box, circle, interval, tsquery, tsvector, bit, varbit ### MySQL Column types: bigint, int, mediumint, smallint, tinyint, varchar, char, text, tinytext, mediumtext, longtext, boolean, date, time, datetime, timestamp, decimal, float, double, json, binary, varbinary, blob, tinyblob, mediumblob, longblob, enum, set, bit, year, geometry, point, linestring, polygon ### Oracle Column types: number, integer, float, varchar2, nvarchar2, char, nchar, clob, nclob, blob, date, timestamp, interval, raw, long, long raw, rowid, xmltype, bfile ### SQL Server (MSSQL) Column types: bigint, int, smallint, tinyint, bit, varchar, nvarchar, char, nchar, text, ntext, date, time, datetime, datetime2, datetimeoffset, smalldatetime, decimal, numeric, float, real, money, smallmoney, binary, varbinary, image, uniqueidentifier, xml, sql_variant, geography, geometry, hierarchyid ### SQLite Column types: integer, real, text, blob, numeric, boolean, date, datetime, timestamp, varchar, char, decimal, float, double --- ## Pricing ### Free Plan - 1 project - 3 public diagrams - 20 tables per diagram - Public diagrams only - Community support - Basic export (SQL) ### Pro Plan — $7.97/user/month (billed annually) or $9.97/month - Unlimited projects - Unlimited diagrams - Unlimited tables - Private diagrams - Real-time collaboration - Share & invite teammates - Checkpoints & versioning - Migration generation (Laravel, Phinx) - MCP Server (AI integration) - Triggers & Procedures - Priority support --- ## Guides ### Your First Diagram Create a project, add tables, define columns, set up relationships. Steps: sign up, create data model, add table, define columns, add second table with FK, arrange on canvas. ### Setting Up MCP Server Connect to Cursor/Windsurf: get UUID, configure .cursor/mcp.json, test with "show me the schema", use natural language to modify schema. ### Inviting Teammates Share modal → generate link or invite by email → set editor/viewer permissions → collaborate with live cursors. ### Importing SQL Toolbar → Import SQL → drag/drop file or paste text → preview parsed tables → import → handle conflicts. ### Generating Migrations Create checkpoint → make schema changes → open checkpoint → generate migration → choose Laravel/Phinx → copy/download/apply. ### Organizing with Groups & Notes Create groups on canvas → drag tables into groups → customize colors → add notes → use multiple diagrams for different views. --- ## Blog Topics Covered - What is Data Modeling and Why It Matters - A Complete Guide to ER Diagrams (entities, attributes, relationships, cardinality) - Normalization: 1NF to 3NF explained - Designing Foreign Keys and Relationships - How AI is Changing Database Design (MCP Server workflow) - Real-Time Collaboration in Database Design (CRDTs) - Vibe Coding and Database Design (AI-assisted schema creation for non-developers) - Best ER Diagram Tools comparison (dbdiagram.io, Lucidchart, draw.io, DBeaver, MySQL Workbench, pgModeler, ER Flow) - Database Design for Non-Developers (visual guide with analogies) - What is MCP Server and Why It Matters - ER Flow vs dbdiagram.io (detailed comparison) - ER Flow vs Lucidchart (specialist vs generalist) --- ## Use Cases ### Vibe Coding Non-developers use AI coding tools (Cursor, Bolt, Lovable) to build apps. ER Flow + MCP Server makes the database visible and manageable through natural language. ### Laravel Development Design schemas visually, generate Laravel migration files with up()/down() methods, checkpoint-based diffing for incremental migrations. ### Cursor AI Integration Configure MCP in .cursor/mcp.json, describe schema changes in natural language, AI calls ER Flow tools automatically, changes appear on canvas in real-time. --- ## Contact - Email: contact@erflow.io - Twitter/X: @erabordes - Website: https://erflow.io - App: https://app.erflow.io