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.5

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.5
File Size Uploaded Provenance Actions
ghostbase_cli-0.1.5.tar.gz 40.8 kB Without provenance Details for ghostbase_cli-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 65.5 kB

Release files / ghostbase_cli-0.1.5.tar.gz

Download URL ghostbase_cli-0.1.5.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
72b2aeeb349b93339134d235e45e38564e868841087014c0c1f088ae70b6b2bc
BLAKE2b-256 checksum
How to use checksums
a17114224f35ca596a242eefb2a4b577f1144f076a3489de4d8e2d8c642f263a
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.5-py3-none-any.whl

Download URL ghostbase_cli-0.1.5-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a01e82cafe2c2688f67b400ab62b83e80433c85093c1040ccd6f18d0a981d01
BLAKE2b-256 checksum
How to use checksums
7f049846c076f7320329e28da57b0c6dbbf2efbce52b616469d2142cc87ce37e
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.5

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