dbTui

module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT

README ΒΆ

dbTui βš‘πŸ”Œ

Go Version License Platform Support CGO Free

dbTui is a blazing-fast, ultra-lightweight Terminal Database Client designed for seamless database management directly from your shell. Forget heavy, memory-hogging GUI applicationsβ€”manage PostgreSQL, MySQL, and SQLite databases instantly with high performance and zero bloat.

Why dbTui? Portable single-binary (~21MB), minimal memory footprint (~16MB idle), fully keyboard-driven, and packed with protective safety guardrails.


⚑ Key Features

  • πŸ”Œ Multi-Engine Support – Native, high-performance connectors for PostgreSQL, MySQL, and SQLite (CGO-free).
  • 🎨 Responsive TUI Layout – Clean, color-coded schema explorer showing connection βž” database βž” table structure.
  • ⌨️ Keyboard-Driven Workflow – Ergonomic shortcuts, global inputs, and multi-line SQL editor with command history.
  • πŸ—„οΈ Schema Navigator – Seamlessly explore columns, data types, indexes, and foreign keys without manual metadata queries.
  • πŸ› οΈ Visual Table Creator – Interactive form to build tables including column definitions, types, nullability, primary keys, and auto-increment.
  • πŸ›‘οΈ Built-in Safety Guardrails – Automated 1000-row limit safety to prevent Out-Of-Memory (OOM) crashes, along with protective execution timeouts.
  • πŸ’Ύ Self-Healing Config – All database profiles are stored in ~/.dbTui/config.json. Auto-repairs duplicate or corrupt connection IDs on startup.
  • πŸ“‹ Universal Clipboard Integration – Copy table/column/cell data to system clipboard. Features OSC 52 terminal copy fallback if no clipboard utility (xclip/wl-copy) is installed.
  • πŸ“€ Export to CSV – Instantly save query results to a CSV file with a single keyboard shortcut.

πŸ“¦ Installation & Distribution

1. Using go install (Fastest for Go Developers)

If you have Go 1.23+ installed, build and install the binary directly to your $GOPATH/bin with:

go install github.com/farhank15/dbTui/cmd/dbTui@latest
2. Using Automated Installer Script (curl | sh)

For Linux and macOS users, install dbTui instantly without installing Go or manual configuration:

curl -sSfL https://raw.githubusercontent.com/farhank15/dbTui/main/install.sh | sh

This script auto-detects your OS and CPU architecture, downloads the latest pre-built binary release, and installs it into /usr/local/bin (falls back to ~/.local/bin if run without root privileges).

3. Pre-Compiled Binaries (No Source Code)

Download pre-compiled binaries from the GitHub Releases page:

  1. Go to the repository's Releases page.
  2. Download the archive for your OS (e.g. dbTui_Linux_x86_64.tar.gz or dbTui_Windows_x86_64.zip).
  3. Extract and place the binary in your system PATH (e.g., /usr/local/bin or C:\Windows\system32).
4. Build from Source
# Clone the repository
git clone https://github.com/farhank15/dbTui
cd dbTui

# Clean and download dependencies
go mod tidy

# Run directly
go run ./cmd/dbTui

# Build local binary
go build -o dbTui ./cmd/dbTui

⌨️ Keyboard Shortcuts

🌐 Global Navigation
Shortcut Function
Tab Switch focus between panels (Sidebar ⇄ Query Editor ⇄ Result Table)
Esc Return focus to Sidebar / Close active modal dialog
Ctrl + N Open "New Connection" form dialog
Ctrl + D Disconnect the currently active database connection
Ctrl + H Toggle active help information modal
F5 Refresh the explorer tree sidebar
πŸ“ Explorer Sidebar
Shortcut Function
↑ / ↓ Select connection, database, or table nodes
β†’ / ← Expand / Collapse directories
Enter Connect/Disconnect or load table structure detail
/ Filter tables in database by name
y / Y Copy selected database or table name to system clipboard
v / V View Table DDL / schema DDL
f / F Search table rows matching a specific column value
d / D Disconnect selected connection node
Delete Remove connection from config / Drop database with confirmation modal
πŸ“ SQL Query Editor
Shortcut Function
Ctrl + J Execute the written SQL query
Ctrl + P / Ctrl + N Cycle backward / forward through query command history
Ctrl + T Open SQL templates / snippets list dialog
Ctrl + F Auto-format SQL query text
Tab Focus results table
πŸ“Š Result Table
Shortcut Function
↑ / ↓ / ← / β†’ Scroll through query results
Enter Inspect/View full cell value in a scrollable modal
e / E Edit selected cell value inline (performs database UPDATE)
Ctrl + E Export active query results to CSV
/ Filter columns by name (when viewing table detail metadata)

πŸ—οΈ Architecture

dbTui enforces clean architectural boundaries separating the TUI presentation layer from driver connectors:

dbTui/
β”œβ”€β”€ cmd/
β”‚   └── dbTui/main.go       # Application Entry Point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ tui/                 # 🎨 UI & Event Handlers (tview + tcell)
β”‚   β”‚   β”œβ”€β”€ app.go           # Central layout orchestrator & global shortcut listener
β”‚   β”‚   β”œβ”€β”€ sidebar.go       # Tree view schema navigator (Conn βž” DB βž” Table)
β”‚   β”‚   β”œβ”€β”€ query_panel.go   # Multi-line SQL text editor
β”‚   β”‚   β”œβ”€β”€ result_table.go  # Query result grid & metadata details viewer
β”‚   β”‚   └── dialogs.go       # Form modals: new connection, table creator, confirms
β”‚   β”œβ”€β”€ db/                  # πŸ—„οΈ Thread-Safe Database Drivers
β”‚   β”‚   β”œβ”€β”€ connector.go     # Universal driver interface
β”‚   β”‚   β”œβ”€β”€ postgres.go      # PostgreSQL adapter (via pgx)
β”‚   β”‚   β”œβ”€β”€ mysql.go         # MySQL adapter (via go-sql-driver)
β”‚   β”‚   └── sqlite.go        # SQLite CGO-Free adapter
β”‚   └── config/              # βš™οΈ Configuration Manager
β”‚       └── config.go        # JSON parser with unique ID Self-Healing validation

πŸ›‘οΈ Safety & Stability Features

Feature Technical Detail
Row Limit Safety Restricts MaxDisplayRows = 1000 to prevent terminal memory exhaust (OOM) on massive tables.
Query Timeout Automatic query execution timeout at 30 seconds to prevent hanging zombie database processes.
Connection Locks Safe concurrency operations under multiple background tasks using sync.RWMutex.
Self-Healing Config Automatically detects and repairs overlapping connection IDs in config.json on app startup.
OSC 52 Clipboard Copy data natively even on headless servers/containers or SSH sessions without xclip.

πŸ“Š Feature Comparison

Feature / Metric dbTui ⚑ DBeaver lazysql usql
Interface TUI (Terminal) GUI (Desktop) TUI (Terminal) CLI (Command Line)
Binary Size ~21 MB >300 MB ~15 MB ~25 MB
RAM (Idle) ~16 MB >500 MB ~20 MB ~10 MB
PostgreSQL & MySQL βœ… βœ… βœ… βœ…
SQLite (CGO-free) βœ… βœ… ❌ ❌
Visual Table Creator βœ… βœ… ❌ ❌
CSV Exporter βœ… βœ… ❌ βœ…
Auto-Healing Config βœ… ❌ ❌ ❌

πŸ“ License

Distributed under the MIT License. See the LICENSE file for more information.


Built with ❀️ using Go and tview. Fast, lightweight, and robust on any system!

Directories ΒΆ

Path Synopsis
cmd
dbTui command
internal
db
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL