Introduction
Rainfrog is a terminal user interface (TUI) for managing databases, built in Rust with the ratatui framework. It provides an interactive, keyboard-driven experience for browsing schemas, running queries, and inspecting results directly in the terminal, aimed at developers who prefer staying in their CLI workflow.
What Rainfrog Does
- Connects to PostgreSQL, MySQL, and SQLite databases
- Displays database schemas with tables, columns, types, and relationships
- Runs SQL queries with syntax highlighting and result pagination
- Supports Vim-style keybindings for navigation and editing
- Exports query results for further processing
Architecture Overview
Rainfrog is a single Rust binary built on ratatui for the terminal UI and sqlx for async database connections. The application uses a component-based architecture where each panel (schema browser, query editor, results table) is an independent widget. Connection pooling and async queries ensure the UI stays responsive even on large result sets.
Self-Hosting & Configuration
- Install via
cargo install rainfrog, Homebrew, or download a prebuilt binary - Pass connection URL with
--urlor configure in~/.config/rainfrog/config.toml - Supports connection strings for PostgreSQL, MySQL, and SQLite file paths
- Customize keybindings and color theme in the config file
- Query history is persisted locally between sessions
Key Features
- Vim keybindings: navigate and edit queries without leaving the keyboard
- Schema browser: explore tables, columns, and types in a tree view
- Multi-database: supports PostgreSQL, MySQL, and SQLite from one tool
- Fast and lightweight: single binary under 10 MB, starts instantly
- Query history: recall and re-run previous queries
Comparison with Similar Tools
- pgcli — PostgreSQL CLI with auto-completion; text-only, no TUI panels
- DBeaver — full GUI database tool; requires a desktop environment
- lazysql — Go-based database TUI; similar concept, different stack
- usql — universal SQL CLI client; no interactive TUI
- DataGrip — JetBrains commercial IDE; full-featured but heavyweight
FAQ
Q: Does Rainfrog support SSH tunneling?
A: Not natively. Use an SSH tunnel (ssh -L) and connect to the forwarded local port.
Q: Can I use Rainfrog with a remote database? A: Yes. Provide the remote connection URL, and Rainfrog connects over the network.
Q: Is there auto-completion for SQL? A: Rainfrog provides basic keyword highlighting. Full auto-completion is a planned feature.
Q: How does Rainfrog handle large result sets? A: Results are paginated in the TUI. You can scroll through rows without loading everything into memory at once.