Skip to main content
   ____ _               _   ____                 
  / ___| |__   ___  ___| |_| __ )  __ _ ___  ___ 
 | |  _| '_ \ / _ \/ __| __|  _ \ / _` / __|/ _ \
 | |_| | | | | (_) \__ \ |_| |_) | (_| \__ \  __/
  \____|_| |_|\___/|___/\__|____/ \__,_|___/\___|
                                                 

GhostBase 👻

A fast, keyboard-driven terminal database studio for SQLite, PostgreSQL, and MySQL.
No Java runtimes. No 1.5GB RAM bloat. Built-in production safety guard, instant SQL beautifier & zero-config .env connect.

CI PyPI Python: 3.10+ License: MIT UI: Textual

GhostBase Terminal Studio


⚡ Why GhostBase?

Opening DBeaver or DataGrip just to run a quick SELECT, inspect an index, or check foreign keys is painful:

  • ❌ 1.5 GB+ RAM bloat: Heavy Java/Eclipse runtimes that spin your laptop fans.
    👉 GhostBase idles at ~25 MB RAM.
  • ❌ 15-Second Cold Starts: Splash screens, driver updates, and workspace indexing.
    👉 GhostBase starts in under 120 ms directly in your terminal.
  • ❌ Accidental Destructive Queries on Production: Running DELETE or UPDATE without a WHERE clause can wipe production tables.
    👉 GhostBase intercepts destructive queries automatically with double-confirmation and one-key Read-Only Safe Mode (Ctrl + S).
  • ❌ Messy, Unformatted Queries: Manually formatting and indenting long SQL statements.
    👉 GhostBase auto-formats and beautifies messy SQL queries with one keypress (Ctrl + B).
  • ❌ Tedious Connection Setup: Typing credentials into multi-tab dialogs.
    👉 GhostBase auto-detects DATABASE_URL from your local .env file.
  • ❌ Seeding & Migrating Data: Manually writing INSERT INTO statements to replicate test rows.
    👉 GhostBase exports query results directly into executable SQL INSERT statements (Ctrl + I).
  • ❌ Exporting for GitHub / Jira / Notion: Exporting CSV, then finding a website to convert to Markdown.
    👉 One-key instant Markdown table export (Ctrl + M) directly into clean GitHub Flavored Markdown.

🚀 Killer Features

  • 🛡️ Production Safety Guard & Safe Mode (Ctrl + S):
    • Intercepts dangerous statements (DELETE/UPDATE without WHERE, DROP TABLE, TRUNCATE).
    • In Safe Mode, all destructive operations are strictly blocked.
    • In normal mode, requires explicit double-confirmation before execution.
  • ✨ 1-Key SQL Beautifier (Ctrl + B):
    • Instantly cleans up whitespace, capitalizes SQL keywords, and indents sub-clauses (FROM, WHERE, AND, OR, JOIN, ORDER BY).
  • ⚡ 1-Key Query Plan (Ctrl + P):
    • Run instant execution plans (EXPLAIN QUERY PLAN / EXPLAIN) on any query to see index usage and bottlenecks.
  • 🔌 Universal Database Support: Connects natively to SQLite, PostgreSQL, and MySQL.
  • 🔑 Zero-Config .env Auto-Connect: Just run ghostbase in any project folder; it automatically picks up DATABASE_URL or standard database environment variables.
  • 🔍 Real-time Table Search (Ctrl + F): Type in the search bar to filter dozens of tables and views instantly.
  • 📊 Explorer with Tables & Views: Browse tables and views with live row counts.
  • 📋 Instant Schema & Foreign Keys: See primary keys, column types, nullability, and foreign key references at a glance.
  • 💾 Multi-Format Exports: Instant SQL INSERTs (Ctrl + I), Markdown (Ctrl + M), CSV (Ctrl + E), and JSON (Ctrl + J).
  • 📜 Query History: Cycle through your last 20 queries with Ctrl + ↑ and Ctrl + ↓.
  • 🎨 Clean Cyberpunk Aesthetic: Fast, high-contrast, zero-flicker terminal interface.

📦 Installation & Quick Start

Via pip

pip install ghostbase-cli

From Source

git clone https://github.com/4yk5/GhostBase.git
cd GhostBase
pip install -r requirements.txt

💻 How to Use

1. Auto-connect to current project (.env)

# Automatically finds DATABASE_URL or DB_HOST in your current directory's .env
ghostbase

2. Connect to SQLite

ghostbase path/to/database.db

3. Connect to PostgreSQL

ghostbase postgresql://user:password@localhost:5432/my_database

4. Connect to MySQL

ghostbase mysql://user:password@localhost:3306/my_database

5. Launch in Safe / Read-Only Mode

ghostbase postgresql://prod-db:5432/main --read-only

⌨️ Keyboard Shortcuts

Shortcut Description
Ctrl + R Execute SQL Query (runs the query with safety validation)
Ctrl + P 1-Key EXPLAIN (instant query execution plan and performance inspector)
Ctrl + B Beautify SQL (auto-formats, capitalizes keywords and indents clauses)
Ctrl + S Toggle Safe Mode (enable/disable destructive query protection)
Ctrl + N New Query (clears editor for a clean query)
Ctrl + F Find Table (focuses table search filter)
Ctrl + I Export to SQL INSERTs (generates executable INSERT INTO statements)
Ctrl + M Export to Markdown (GitHub / Jira / Notion ready table)
Ctrl + E Export to CSV (exports current table/query to CSV)
Ctrl + J Export to JSON (exports current table/query to JSON)
Ctrl + ↑ / Ctrl + ↓ Query History (cycle through previous queries)
Tab / Shift + Tab Navigate between explorer, search, editor, and data table
Ctrl + Q Quit GhostBase

🤝 Contributing

Contributions, feedback, and pull requests are very welcome! Feel free to open an issue for bug reports or feature requests.


📄 License

Released under the MIT License.

Metadata

Release files for ghostbase-cli 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghostbase-cli 0.1.4
File Size Uploaded Provenance Actions
ghostbase_cli-0.1.4.tar.gz 37.8 kB Without provenance Details for ghostbase_cli-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ghostbase-cli 0.1.4
File Interpreter ABI Platform Actions
ghostbase_cli-0.1.4-py3-none-any.whl Python 3 none any Details for ghostbase_cli-0.1.4-py3-none-any.whl

Total release size: 60.9 kB

Release files / ghostbase_cli-0.1.4.tar.gz

Download URL ghostbase_cli-0.1.4.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0a02f34494ca56c7f00deceb7640f57b5f1a9397762fbba498ecc28a8cd3f47e
BLAKE2b-256 checksum
How to use checksums
c6d650b599ef5c5f32bb73bb52d8518f9ba379776a63407543e501b82922f29a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / ghostbase_cli-0.1.4-py3-none-any.whl

Download URL ghostbase_cli-0.1.4-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32d239a5633d74dc6abdf4c7c2e1818f91d10561e3db40e4aa367666a2b4da0c
BLAKE2b-256 checksum
How to use checksums
c7a894b0a29c0048cbab09225cf8886b9db5113a1f2927cbbcc244060a0d1ae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for ghostbase-cli 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page