A web-based SQL IDE for managing database connections, running queries, and comparing results side-by-side. It focuses on PostgreSQL today, with a connector architecture that is ready for other databases.
- PostgreSQL-first, extensible connectors: PostgreSQL support today; connector scaffolding for MySQL, SQLite, and MSSQL
- Connection management: create, edit, test, set default, delete; import/export JSON; encrypted credentials
- Tabbed query editor: multi-tab Monaco editor with Ctrl/Cmd+Enter execution and error line highlighting
- Split-screen mode: run two editors in parallel for faster comparisons
- Compare mode: compare two result sets by key, highlight field differences, export comparison to CSV
- Result pagination: infinite scroll with row counts, execution time, and total count when available
- Result export/import: export to CSV or SQL INSERTs; import INSERT statements; insert results into another connection
- Saved queries: folders, descriptions, duplication, and one-click execution
- Local persistence: tab state and layout stored in localStorage
- Responsive + dark mode
- Frontend: Next.js 14 (App Router), React 18, TypeScript
- Backend: Next.js Route Handlers (Node.js)
- Metadata Storage: SQLite via better-sqlite3 (
data/ide.db) - Database Connector: PostgreSQL (
pg) - UI: Tailwind CSS, Lucide React
- Editor: Monaco Editor
- Encryption: crypto-js (AES)
- Node.js 18+ and npm/yarn
- PostgreSQL database (for testing connections)
- Clone the repository:
git clone <repository-url>
cd browser-sql-ide- Install dependencies:
npm install- Set up environment variables (optional):
Create a
.env.localfile in the root directory:
ENCRYPTION_KEY=your-secure-encryption-key-hereImportant: In production, use a strong, randomly generated encryption key. The default key is only for development.
- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Click New Connection in the Connections panel
- Fill in the connection details (host, port, database, username, password, SSL)
- Click Create to save
- Use Test to verify connectivity
- Optionally mark a connection as Default for new tabs
Import/Export
- Export connections from the sidebar (passwords are not included for security)
- Import connections from JSON (see
connections.example.json)
- Use tabs to keep multiple queries open
- Toggle Split Screen to open a second editor
- Press Ctrl/Cmd+Enter to run the current statement
- Use Compare Mode to compare results from both editors (select a key column and optional fields)
- Results load with pagination (100 rows per page) and infinite scroll
- Export results to CSV or INSERT statements
- Import INSERT statements from a file
- Insert result rows into another connection (uses the query’s target table name when possible)
- Save queries with name, description, and folder
- Duplicate or execute saved queries directly
browser-sql-ide/
├── src/
│ ├── app/
│ │ ├── (main)/ # Main UI route
│ │ ├── api/ # API routes
│ │ │ ├── connections/ # Connection management endpoints
│ │ │ ├── queries/ # Saved queries endpoints
│ │ │ ├── query/ # Query execution + pagination
│ │ │ └── history/ # Query history endpoint
│ │ └── layout.tsx
│ ├── components/
│ │ ├── features/ # Feature modules (editor, results, etc.)
│ │ └── ui/ # Shared UI primitives
│ ├── lib/ # DB access, encryption, utils
│ ├── styles/ # Global styles
│ └── types/ # Shared TS types
├── data/ # SQLite metadata database (auto-created)
└── package.json
GET /api/connections- List all connectionsPOST /api/connections- Create a new connectionGET /api/connections/[id]- Get a specific connectionPUT /api/connections/[id]- Update a connectionDELETE /api/connections/[id]- Delete a connectionPOST /api/connections/[id]/test- Test a saved connectionPOST /api/connections/test- Test a connection payload (without saving)
GET /api/queries- List saved queries (optional:?connectionId=X)POST /api/queries- Save a new queryGET /api/queries/[id]- Get a specific queryPUT /api/queries/[id]- Update a queryDELETE /api/queries/[id]- Delete a query
POST /api/query/execute- Execute a SQL query (returns first 100 rows)POST /api/query/paginate- Load more rows for a query
GET /api/history- Get query history (optional:?connectionId=X&limit=50)
- Encryption: Passwords are AES-encrypted before storage (set
ENCRYPTION_KEYin production) - Local data: Metadata is stored locally in
data/ide.db - Trusted usage: Queries execute exactly as provided; treat the IDE as a trusted admin tool
- Support for MySQL, SQLite, and MSSQL connectors
- Query result charts and graphs
- Query autocomplete and suggestions
- Database schema browser
- Query performance analysis
- Collaborative features
- Export to additional formats (JSON, Excel)
- Query templates
- Keyboard shortcut cheatsheet
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintMIT
Contributions are welcome! Please feel free to submit a Pull Request.
