Sqltemple
SQLTemple is a modern, AI-powered SQL IDE built with Electron and React. It provides intelligent query assistance, execution plan visualization, and a VS Code-like development experience for database work.
Install / Use
/learn @vicotrbb/SqltempleQuality Score
Category
Development & EngineeringSupported Platforms
README
SQLTemple
<p align="center"> <img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" /> <img src="https://img.shields.io/badge/Electron-2B2E3A?style=for-the-badge&logo=electron&logoColor=9FEAF9" /> <img src="https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB" /> <img src="https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white" /> <img src="https://img.shields.io/badge/OpenAI-412991?style=for-the-badge&logo=openai&logoColor=white" /> </p>SQLTemple is a modern, AI-powered SQL IDE built with Electron and React. It provides intelligent query assistance, execution plan visualization, and a VS Code-like development experience for database work.
IMPORTANT DISCLAIMER: This app is not yet notorized by a valid Apple Developer ID, thus might have problems when installing on latest MacOS computers.
✨ Features
🚀 Core Database Features
- Modern SQL Editor: Powered by Monaco Editor (VS Code's editor) with syntax highlighting and auto-completion
- Multi-tab Interface: Work with multiple queries simultaneously with tab management
- Advanced Schema Explorer: Browse databases, schemas, tables, columns with unified explorer interface
- Query Execution: Execute full queries or selected portions with real-time feedback
- Enhanced Results Grid: View query results with virtualization for large datasets, column resizing, and adjustable row heights
- Query History: Track and reuse previous queries with full history management
- Connection Management: Save and manage multiple database connections with secure credential storage
- Export Capabilities: Export query results to multiple formats (CSV, JSON, Excel, etc.)
🤖 AI-Powered Intelligence
- Natural Language Query Generation: Generate SQL queries from plain English descriptions
- Query Explanation: Get detailed explanations of complex SQL queries with step-by-step breakdowns
- Query Optimization: AI-powered query optimization based on execution plans and database schema
- Execution Plan Analysis: Intelligent analysis of query performance with specific recommendations
- Data Analysis: AI-powered insights and pattern recognition from query results
- Smart Completions: Context-aware SQL completions based on your database schema
- Multiple AI Models: Support for GPT-4, GPT-4o, GPT-3.5, and O1 models
- Autonomous Agent Sidebar: ReAct-style AI agent that can explore schemas, run tools, and stream answers while keeping a full conversation history
📊 Advanced Visualization & Analysis
- Execution Plan Visualizer: Interactive tree view of query execution plans with performance metrics
- Table Topology Viewer: Visual relationship mapping with Mermaid diagrams showing foreign key relationships
- Column Statistics: Real-time statistics and data type information with hover tooltips
- Relationship Discovery: Automatic detection and visualization of table relationships
- Results Analysis Modal: Deep dive analysis of query results with AI insights
- Foreign Key Navigation: Click-through navigation between related records
🔍 Search & Navigation
- Spotlight Search: Powerful fuzzy search across connections, tables, columns, and database objects
- Quick Navigation: Jump to any database object with keyboard shortcuts
- Schema Browsing: Expandable tree view with lazy loading for large schemas
- Object Filtering: Filter and search within schema explorer
⚡ Performance & Productivity
- Virtualized Data Grids: Handle millions of rows with smooth scrolling performance
- Background Query Execution: Non-blocking query execution with progress indicators
- Customizable Keyboard Shortcuts: Fully configurable shortcuts with recording capability
- Resizable Panels: Drag-to-resize interface components for optimal workflow
- Dark Theme: Beautiful VS Code-inspired dark theme optimized for long coding sessions
- Query Limiting: Automatic query result limiting to prevent browser crashes
🛠️ Developer Experience
- TypeScript Architecture: Fully typed codebase with comprehensive error handling
- Hot Reload Development: Fast development cycle with webpack hot module replacement
- Secure Context Isolation: Electron security best practices with IPC communication
- Local Storage: SQLite-based local storage for connections, history, and settings
- Cross-Platform: macOS app bundle ready today, with Windows and Linux installers produced via our CI builds
🖥️ Supported Databases
- PostgreSQL (including Supabase, Neon, etc.)
- More databases coming soon!
📋 Requirements
- macOS 10.15 or later (for the prebuilt DMG)
- Node.js 18 or later (for development/build tooling)
- OpenAI API key (for AI features)
🚀 Installation
Option 1: Homebrew (macOS)
brew tap victorbona/sqltemple https://github.com/vicotrbb/sqltemple
brew install --cask sqltemple
- If macOS Gatekeeper blocks the first launch, right-click the app in Finder and choose Open (current build is not yet notarized).
- Homebrew will download the signed/notarized DMG once it is published to the GitHub release matching the version in
Casks/sqltemple.rb.
Option 2: Download Pre-built App
- Visit the SQLTemple Releases page
- Download the installer for your platform:
.dmgfor macOS.exe/.msifor Windows.deb/.rpm/.AppImage(when available) for Linux
- Install as you would any native application for that platform
- Launch SQLTemple from Applications / Start Menu / your desktop environment
Option 3: Build from Source
# Clone the repository
git clone https://github.com/vicotrbb/sqltemple.git
cd sqltemple
# Install dependencies
npm ci
# Run in development mode
npm start
# Build for macOS
npm run make
🎯 Getting Started
1. Connect to a Database
- Click "Connect" in the toolbar
- Enter your database credentials:
- Name: A friendly name for your connection
- Host: Database host (e.g.,
db.example.com) - Port: Database port (default: 5432)
- Database: Database name
- Username: Your database username
- Password: Your database password
- SSL: Enable for secure connections
2. Configure AI Features
- Click "⚙️ AI" in the toolbar
- Enter your OpenAI API key
- Select your preferred model (recommended: gpt-4o-mini)
- Click "Save"
3. Write and Execute Queries
- Write SQL in the editor
- Press
Cmd+Enterto execute the entire query - Select text and press
Cmd+Enterto execute only the selection - Right-click for more options
⌨️ Keyboard Shortcuts
File Operations
| Action | macOS | Windows/Linux |
| ------------- | ------------- | -------------- |
| New Tab | Cmd+T | Ctrl+T |
| Open Query | Cmd+O | Ctrl+O |
| Save Query | Cmd+S | Ctrl+S |
| Save Query As | Cmd+Shift+S | Ctrl+Shift+S |
| Preferences | Cmd+, | Ctrl+, |
Edit Operations
| Action | macOS | Windows/Linux |
| ---------- | ------------- | ------------- |
| Undo | Cmd+Z | Ctrl+Z |
| Redo | Cmd+Shift+Z | Ctrl+Y |
| Cut | Cmd+X | Ctrl+X |
| Copy | Cmd+C | Ctrl+C |
| Paste | Cmd+V | Ctrl+V |
| Select All | Cmd+A | Ctrl+A |
View & Navigation
| Action | macOS | Windows/Linux |
| -------------------- | ------------- | -------------- |
| Find | Cmd+F | Ctrl+F |
| Find & Replace | Cmd+Shift+F | Ctrl+Shift+F |
| Toggle History | Cmd+H | Ctrl+H |
| Toggle Agent Sidebar | Cmd+L | Ctrl+L |
| Spotlight Search | Cmd+K | Ctrl+K |
| Zoom In | Cmd++ | Ctrl++ |
| Zoom Out | Cmd+- | Ctrl+- |
| Reset Zoom | Cmd+0 | Ctrl+0 |
Tabs & Windows
| Action | macOS | Windows/Linux |
| --------------- | ----------- | ------------- |
| Switch to Tab 1 | Cmd+1 | Ctrl+1 |
| Switch to Tab 2 | Cmd+2 | Ctrl+2 |
| Switch to Tab 3 | Cmd+3 | Ctrl+3 |
| Execute Query | Cmd+Enter | Ctrl+Enter |
🤖 AI Features Guide
Setup AI Features
- Click the "AI" button in the toolbar
- Enter your OpenAI API key
- Select your preferred model:
- gpt-4o: Latest and most capable model (recommended)
- gpt-4o-mini: Fast and cost-effective
- o1-preview: Advanced reasoning model
- gpt-4-turbo: High performance model
- gpt-3.5-turbo: Fast and economical
Generate Query from Natural Language
- Click "Create Query" in the AI dialog
- Describe what you want in plain English (e.g., "Show me all users who signed up last month")
- The AI will create an optimized SQL query based on your database schema
- Click "Apply to Editor" to use the generated query
Explain Query
- Select a query (or portion of it) in the editor
- Right-click and choose "Explain Query with AI"
- Get a comprehensive explanation including:
- What the query does (high-level summary)
- Step-by-step breakdown of operations
- Key concepts and techniques used
- Potential issues or improvements
Optimize Query Performance
- Execute your query to get the execution plan
- In the plan visualizer, click "Analyze with AI"
- The AI analyzes performance bottlenecks and provides:
- Specific optimization recommendations
- Index suggestions
- Query rewriting opportunities
- Performance insights
Analyze Query Results
- After executing a query, click "AI Analysis" in the results t
