Skip to content

Mavdii/visual-db

Repository files navigation

πŸ—„οΈ Visual Database Designer

Visual Database Designer Logo

The Ultimate Visual Database Schema Designer & Query Builder

Made with React TypeScript Tailwind CSS React Flow License: MIT

Design database schemas visually, create relationships, and generate production-ready SQL for PostgreSQL, MySQL, and SQLite.

Live Demo β€’ Features β€’ Installation β€’ Documentation β€’ Contact


πŸ“Έ Screenshots

Visual Schema Designer

Visual Database Designer Interface

πŸ”— Relationship Visualization

Database Relationships

πŸ“ SQL Generation

SQL Code Generation

βœ‹ Drag & Drop Column Reordering

Drag and Drop Columns

✨ Features

🎨 Visual Schema Design

  • Intuitive Canvas - Drag, drop, and arrange tables on an infinite canvas with smooth pan and zoom
  • Beautiful Table Cards - Color-coded tables with expandable columns and relationship indicators
  • Smart Layouts - Auto-arrange tables with intelligent layout algorithms

πŸ”— Relationship Management

  • Visual Connections - Create relationships by drawing lines between tables
  • Multiple Types - Support for 1:1, 1:N, and N:M relationships
  • Referential Actions - Configure CASCADE, SET NULL, RESTRICT, and more

πŸ“Š Multi-Dialect SQL Support

  • PostgreSQL - Full support including JSONB, arrays, and advanced types
  • MySQL - Complete MySQL syntax with engine and charset options
  • SQLite - Lightweight SQLite schema generation

πŸš€ Advanced Features

Feature Description
πŸ“¦ Table Templates 18+ pre-built templates (Users, Products, Orders, Posts, etc.)
🎯 Drag & Drop Reorder columns with smooth drag-and-drop
πŸ’Ύ Import/Export JSON import/export for schema portability
πŸ“ TypeScript Types Auto-generate TypeScript interfaces from schema
πŸ” Real-time Preview Live SQL preview as you design
βͺ Undo/Redo Full history support with keyboard shortcuts
πŸŒ™ Dark Mode Beautiful dark theme by default
⌨️ Keyboard Shortcuts Power-user friendly with comprehensive shortcuts

πŸ“‹ Pre-built Table Templates

πŸ” Auth & Users

  • Users
  • Roles
  • Sessions

πŸ›’ E-Commerce

  • Products
  • Categories
  • Orders
  • Order Items

πŸ“ Content

  • Posts
  • Comments
  • Tags

πŸ‘₯ Social

  • Followers
  • Likes
  • Notifications

πŸ’° Finance

  • Transactions
  • Invoices

βš™οΈ General

  • Settings
  • Files
  • Audit Logs

πŸš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/Mavdii/visual-db.git

# Navigate to project directory
cd visual-db

# Install dependencies
npm install
# or
bun install

# Start development server
npm run dev
# or
bun dev

Open http://localhost:5173 in your browser.


🎯 Usage

Creating a Table

  1. Click "Add Table" in the left panel or on the canvas
  2. Choose from 18+ templates or start from scratch
  3. Configure columns with data types and constraints
  4. Drag and drop to reorder columns
  5. Click "Create Table" to add to canvas

Creating Relationships

  1. Click on a table's foreign key column
  2. Drag to the target table's primary key
  3. Configure relationship type (1:1, 1:N, N:M)
  4. Set referential actions (CASCADE, SET NULL, etc.)

Exporting SQL

  1. Open the SQL tab in the right panel
  2. Select your target dialect (PostgreSQL, MySQL, SQLite)
  3. Copy or download the generated DDL

πŸ› οΈ Tech Stack

React
React 18
TypeScript
TypeScript
Vite
Vite
Tailwind
Tailwind CSS
Zustand
Zustand
React Flow
React Flow
shadcn/ui
shadcn/ui
Framer Motion
Framer Motion

πŸ“– Documentation

Keyboard Shortcuts

Shortcut Action
Ctrl/Cmd + Z Undo
Ctrl/Cmd + Shift + Z Redo
Ctrl/Cmd + S Save schema
Delete Delete selected item
Escape Deselect all
Ctrl/Cmd + A Select all tables
+ / - Zoom in/out
0 Fit to view

Supported Data Types

Numeric Types
  • INTEGER - Standard integer
  • BIGINT - Large integer
  • SMALLINT - Small integer
  • SERIAL - Auto-incrementing integer
  • DECIMAL / NUMERIC - Exact decimal
  • REAL / FLOAT / DOUBLE - Floating point
Text Types
  • VARCHAR(n) - Variable-length string
  • CHAR(n) - Fixed-length string
  • TEXT - Unlimited text
  • UUID - Universally unique identifier
Date & Time Types
  • DATE - Calendar date
  • TIME - Time of day
  • TIMESTAMP - Date and time
  • TIMESTAMPTZ - Timestamp with timezone
Other Types
  • BOOLEAN - True/false
  • JSON / JSONB - JSON data
  • ARRAY - Array of values
  • BYTEA / BLOB - Binary data
  • ENUM - Enumerated values

πŸ—ΊοΈ Roadmap

  • Visual schema designer
  • Multi-dialect SQL generation
  • Relationship management
  • Table templates
  • Drag & drop column reordering
  • Query builder interface
  • Database reverse engineering
  • Team collaboration
  • Cloud sync & sharing
  • AI-powered schema suggestions

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ‘¨β€πŸ’» Developer

Umar

Full-Stack Developer & Database Architect

Telegram WhatsApp Discord Email


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Star this repo if you find it useful!

Built with ❀️ by Umar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages