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

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.3
File Size Uploaded Provenance Actions
ghostbase_cli-0.1.3.tar.gz 37.0 kB Without provenance Details for ghostbase_cli-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 59.6 kB

Release files / ghostbase_cli-0.1.3.tar.gz

Download URL ghostbase_cli-0.1.3.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a056ecb008df3091b8324e65768d50ec2253d72ef8895c531989cd209efb4e6c
BLAKE2b-256 checksum
How to use checksums
b5bb2f1c82d31483ca29aa737fc0a872a9b6e05acca6566130288a4324ba3ada
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.3-py3-none-any.whl

Download URL ghostbase_cli-0.1.3-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9a8e7eb20ee386ca975ef5bd31a4a888316f2e1d91be7821f322a1b89d6cc04
BLAKE2b-256 checksum
How to use checksums
23213004c77f1aa3dc15caca979a256cbd703a7893e258c0dcac5bb4942be019
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.3

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