Every time I needed to run a quick SELECT, inspect an index, or check foreign key constraints, I found myself waiting 15+ seconds for heavy GUI clients like DBeaver or DataGrip to launch.
By the time the splash screen disappeared, my laptop fans were spinning and my RAM had swallowed 1.5 GB+ of memory just to show a 4-row SQLite table.
Even worse? The constant dread of accidentally executing a destructive UPDATE or DELETE statement without a WHERE clause on a production database.
I wanted something different:
- Instant cold boot (under 120 ms).
- Lightweight footprint (~25 MB of RAM).
- Keyboard-driven workflow (no mouse hunting across menus).
- Built-in safety guard against accidental data loss.
So I built GhostBase 👻.
⚡ What is GhostBase?
GhostBase is an open-source, keyboard-driven terminal database studio built with Python and Textual. It connects natively to SQLite, PostgreSQL, and MySQL.
No Java runtimes. No Electron wrapper. Zero telemetry.
🛡️ Key Features
1. Production Safety Guard & Safe Mode (Ctrl + S)
GhostBase inspects queries before execution. If it detects a dangerous statement (DELETE or UPDATE without a WHERE clause, DROP TABLE, TRUNCATE), it intercepts it immediately and demands double confirmation. In Safe Mode, all destructive operations are strictly blocked.
2. 1-Key SQL Beautifier (Ctrl + B)
Messy, one-line queries? Hit Ctrl + B to auto-capitalize keywords (SELECT, FROM, WHERE, JOIN, ORDER BY) and indent sub-clauses instantly.
3. 1-Key Query Plan Inspector (Ctrl + P)
Press Ctrl + P to execute an instant EXPLAIN QUERY PLAN on any query to detect missing indexes and table scan bottlenecks.
4. Zero-Config .env Auto-Connect
Run ghostbase in any project folder; it automatically discovers your DATABASE_URL from your local .env file without typing credentials.
5. Multi-Format Exports
Export any query results directly from the terminal:
- SQL INSERTs (
Ctrl + I): Generates executableINSERT INTOstatements. - Markdown Tables (
Ctrl + M): Ready to paste directly into GitHub Issues, PRs, or Notion. - CSV (
Ctrl + E) & JSON (Ctrl + J)
🚀 Quick Start
Install directly from PyPI:
pip install ghostbase-cli Launch it with your database:
# Auto-detect local .env ghostbase # Or connect directly ghostbase path/to/database.db ghostbase postgresql://user:password@localhost:5432/my_db ghostbase mysql://user:password@localhost:3306/my_db 🤝 Open Source & Feedback
GhostBase is completely open-source under the MIT License.
⭐ GitHub Repository: https://github.com/4yk5/GhostBase
If you find it useful, feel free to drop a star on GitHub! I'd love to hear your feedback, feature ideas, and suggestions in the comments below.