Skip to content

jacksonkasi1/tiger-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

332 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


Tiger SQL

PostgreSQL Schema Visualizer & Designer with AI-Powered Assistance
Secure โ€ข Simple โ€ข Smart

View Demo ยป

Report Bug ยท Request Feature ยท Discussions

Sponsor Stars Forks License

Tiger SQL

๐ŸŽฏ Overview

Tiger SQL is a powerful, modern PostgreSQL schema visualizer and designer that combines intuitive visual design with AI-powered assistance enhanced by the Model Context Protocol (MCP). Built with Next.js 15 and React 19, it offers a seamless experience for designing, visualizing, and managing database schemas without requiring any installations or sensitive credentials.

๐Ÿ”Œ MCP Integration (Model Context Protocol)

Tiger SQL now features a scalable, multi-server MCP architecture that provides the AI assistant with up-to-date PostgreSQL knowledge and best practices:

  • ๐Ÿง  PostgreSQL Expertise - Access to official PostgreSQL documentation via semantic search
  • ๐Ÿ“š Best Practices - Curated PostgreSQL patterns and recommendations
  • ๐Ÿ”„ Always Up-to-Date - Live knowledge from MCP servers (no outdated training data)
  • ๐ŸŽฏ Intelligent Routing - Automatically decides when to use MCP based on request complexity
  • ๐Ÿ”ง Extensible - Add your own MCP servers via configuration
  • โšก Production-Ready - Built-in connection management, retry logic, and health checks

๐Ÿ˜ Built-in: pg-aiguide by Timescale

Tiger SQL comes with pg-aiguide pre-integrated - an AI-optimized PostgreSQL knowledge base created by Timescale. This MCP server provides:

Tool Description
pg_view_skill Get curated PostgreSQL best practices on specific topics
pg_list_skills Browse all available PostgreSQL knowledge topics
pg_semantic_search_postgres_docs Semantic search across official PostgreSQL documentation

No setup required! pg-aiguide works out of the box. The AI assistant automatically uses it when you ask about PostgreSQL best practices, optimization, or schema design patterns.

User Controls: Users can control MCP behavior with special commands:

  • [use-mcp] - Force MCP usage for this request
  • [skip-mcp] - Skip MCP, use direct execution
  • [mcp-verbose] - Show detailed MCP queries
  • [use-server:server-id] - Use specific MCP server only
  • [exclude-server:server-id] - Exclude specific server

Learn more about MCP: Vercel AI SDK MCP Documentation

โœจ Features

๐ŸŽจ Visual Schema Designer

  • ๐Ÿ–ฑ๏ธ Drag & Drop Interface - Create and connect tables effortlessly
  • ๐Ÿ”„ Undo/Redo Support - Full history management with keyboard shortcuts (Cmd/Ctrl+Z)
  • ๐ŸŽฏ Smart Auto-Layout - Automatic table arrangement using Dagre algorithm
  • ๐ŸŒˆ Random Table Colors - Beautiful, randomized color schemes for tables
  • ๐Ÿ“ธ Export to Image - Save your schema as PNG
  • ๐Ÿ” Zoom & Pan - Smooth navigation with minimap support

๐Ÿค– AI-Powered Assistant (Enhanced with MCP)

  • ๐Ÿ’ฌ Interactive Chat - AI assistant to help with schema design
  • ๐Ÿง  Smart Suggestions - Get recommendations powered by PostgreSQL best practices via MCP
  • ๐Ÿ“ Context-Aware - Understands your current schema state and uses up-to-date PostgreSQL knowledge
  • ๐Ÿš€ Powered by Multiple LLMs - Support for OpenAI and Google AI
  • ๐Ÿ”Œ MCP Integration - Access to real-time PostgreSQL documentation and expertise
  • ๐Ÿ“š Best Practices - Automatic guidance from curated PostgreSQL patterns

๐Ÿ” Connection Modes

Create relationships between tables by dragging from one column to another. Choose between two validation modes:

๐Ÿ”“ Flexible Mode (Unlock Icon)

  • Connect any column to any column without type restrictions
  • Perfect for quick prototyping and sketching
  • Ideal for custom types or extensions
  • Maximum flexibility in schema design

๐Ÿ” Strict Mode (Lock Icon)

  • Only allows connections between type-compatible columns
  • Validates PostgreSQL data type compatibility
  • Prevents invalid relationships
  • Production-ready schema design
Type Compatibility Groups
Category Compatible Types
UUID uuid
Integer integer, int, int2, int4, int8, smallint, bigint, serial, smallserial, bigserial
Numeric numeric, decimal
Float real, float4, double precision, float8
String text, varchar, char, character, character varying
Boolean boolean, bool
Date date
Time time, timetz
Timestamp timestamp, timestamptz
JSON json, jsonb
Binary bytea

๐Ÿ’พ Data Management

  • ๐Ÿ“ฆ Import SQL - Load existing schemas from SQL files
  • ๐Ÿ’ฟ Export SQL - Generate SQL DDL for your schema
  • ๐Ÿ”„ LocalStorage Persistence - Your work is automatically saved
  • ๐Ÿšช No Login Required - Start designing immediately

๐Ÿ›ก๏ธ Security & Privacy

  • ๐Ÿ”’ Client-Side Only - All processing happens in your browser
  • ๐Ÿ‘€ No Sensitive Data - Only uses public API keys
  • ๐Ÿ” No Database Passwords - Secure by design
  • ๐Ÿšซ No Server Storage - Your data stays on your device

๐ŸŽฎ User Experience

  • โšก Lightning Fast - Built with modern React and Next.js
  • ๐ŸŽจ Beautiful UI - Powered by Tailwind CSS and shadcn/ui
  • ๐Ÿ“ฑ Responsive Design - Works on all screen sizes
  • โŒจ๏ธ Keyboard Shortcuts - Power-user friendly
  • ๐ŸŒ™ Dark Mode Support - Easy on the eyes

๐Ÿš€ Getting Started

Online (Recommended)

Simply visit Tiger SQL and start designing your schema immediately!

With Supabase

  1. Go to Supabase Dashboard
  2. Select your Project
  3. Navigate to Settings โ†’ API
  4. Copy your URL and anon/public key
  5. Paste them into Tiger SQL
  6. Click "Fetch Schema"
  7. Start visualizing! ๐ŸŽ‰

Import Existing Schema

  1. Click "Import SQL" button
  2. Paste your SQL DDL or drag & drop a .sql file
  3. Watch your schema come to life!

๐Ÿ› ๏ธ Built With

Tiger SQL is built with modern, cutting-edge technologies:

๐Ÿ’ป Local Development

Prerequisites

  • Bun runtime (v1.0+)

Installation

  1. Clone the repository

    git clone https://github.com/jacksonkasi1/tiger-sql.git
    cd tiger-sql
  2. Install dependencies

    bun install
  3. Set up environment variables (Optional - for AI features)

    cp .env.example .env.local

    Add your API keys:

    OPENAI_API_KEY=your_openai_key_here
    GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_key_here
  4. Configure MCP Servers (Optional - for custom MCP servers)

    cp .mcp-config.example.json .mcp-config.json

    The built-in pg-aiguide MCP server works out of the box. Add custom servers in .mcp-config.json:

    {
      "version": "1.0.0",
      "servers": [
        {
          "id": "my-custom-mcp",
          "name": "My Custom MCP Server",
          "transport": {
            "type": "http",
            "url": "https://mcp.example.com"
          },
          "enabled": true,
          "priority": 50,
          "tags": ["custom"],
          "toolNamespace": "custom_"
        }
      ]
    }
  5. Run the development server

    bun dev
  6. Open your browser

    Navigate to http://localhost:3000

Available Scripts

  • bun dev - Start development server
  • bun run build - Build for production
  • bun start - Start production server
  • bun run lint - Run ESLint
  • bun run typecheck - Run TypeScript type checking
  • bun run analyze - Analyze bundle size
  • bun run test:memory - Run memory leak tests

๐Ÿ”Œ MCP Architecture

Tiger SQL features a scalable, configuration-driven MCP architecture designed for production use:

Key Features

  • Multi-Server Support - Connect to multiple MCP servers simultaneously
  • Configuration-Driven - Add/remove servers via JSON config files
  • Intelligent Routing - Automatic tool selection based on request complexity
  • Connection Management - Built-in retry logic, timeouts, and health checks
  • Tool Namespacing - Avoid conflicts with prefixed tool names (e.g., pg_, custom_)
  • Lifecycle Hooks - Monitor connections and tool usage
  • Graceful Degradation - App works even if MCP servers are unavailable

Adding Custom MCP Servers

  1. Via Configuration File (Recommended)

    Create .mcp-config.json in the project root:

    {
      "version": "1.0.0",
      "servers": [
        {
          "id": "my-mcp",
          "name": "My Custom MCP",
          "transport": {
            "type": "http",
            "url": "https://mcp.example.com"
          },
          "enabled": true,
          "priority": 50,
          "tags": ["custom"],
          "toolNamespace": "custom_"
        }
      ]
    }
  2. Via Code (For Built-in Servers)

    Edit src/lib/mcp/config.ts and add to BUILTIN_MCP_SERVERS:

    {
      id: 'my-builtin-mcp',
      name: 'My Built-in MCP',
      transport: {
        type: 'http',
        url: 'https://mcp.example.com',
      },
      enabled: true,
      priority: 50,
      tags: ['builtin'],
      toolNamespace: 'builtin_',
    }
  3. Environment Variables

    Override defaults:

    MCP_CONFIG_PATH=./custom-mcp-config.json
    MCP_DISABLE_BUILTIN=false
    MCP_AUTO_CONNECT=true
    MCP_TIMEOUT=10000
    MCP_RETRY_ATTEMPTS=2

MCP Transport Types

  • HTTP (Recommended for production) - RESTful API endpoint
  • SSE - Server-Sent Events for streaming
  • Stdio - Local servers via stdin/stdout (development only)

Learn More

๐Ÿค Contributing

Contributions make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated!

How to Contribute

  1. Fork the Project
  2. Create your Feature Branch
    git checkout -b feature/AmazingFeature
  3. Commit your Changes
    git commit -m 'feat: Add some AmazingFeature'
  4. Push to the Branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Commit Convention

We follow Conventional Commits:

  • feat: - New features
  • fix: - Bug fixes
  • docs: - Documentation changes
  • style: - Code style changes (formatting, etc.)
  • refactor: - Code refactoring
  • test: - Adding or updating tests
  • chore: - Maintenance tasks

๐Ÿ—บ๏ธ Roadmap

  • MCP Integration - Multi-server architecture for PostgreSQL knowledge
  • Additional MCP Servers (pgvector, PostGIS, Supabase)
  • Multi-schema support
  • Multi-project support connected to GitHub repository
  • Collaborative editing
  • Schema versioning
  • More export formats (JSON, YAML)
  • Database connection for live schema sync
  • Template library
  • Advanced AI features (query generation, optimization)
  • MCP Server UI management (enable/disable servers from UI)

See the open issues for a full list of proposed features and known issues.

๐Ÿ“Š Performance

Tiger SQL is optimized for performance with:

  • โšก Virtual scrolling for large schemas
  • ๐Ÿง  Efficient state management with Zustand
  • ๐Ÿ”„ Optimized re-renders with React 19
  • ๐Ÿ’พ Smart caching strategies
  • ๐Ÿ“ฆ Code splitting and lazy loading
  • ๐ŸŽฏ Memory leak prevention (tested with MemLab)

๐Ÿ™ Acknowledgements

Special thanks to:

  • Supabase - For the inspiration and type generation approach
  • React Flow - Excellent flow diagram library
  • shadcn/ui - Beautiful component library
  • Vercel - Hosting and deployment
  • All contributors who have helped improve Tiger SQL

๐Ÿ’– Support the Project

If you find Tiger SQL helpful, consider supporting its development:

Your support helps maintain and improve Tiger SQL for everyone! โญ

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE.txt for more information.

Not associated with Supabase.

๐Ÿ“ง Contact

Jackson Kasi - @jacksonkasi0

Project Link: https://github.com/jacksonkasi1/tiger-sql


Made with โค๏ธ by Jackson Kasi

โญ Star this repo if you find it useful!

About

Tiger SQL - PostgreSQL Schema Visualizer & Designer with AI-powered assistance

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Contributors

Languages