Skip to content

Repository files navigation

Note

pgplex: The Postgres Toolchain for Humans and Agents - pgconsole · pgschema · pgtui · pgparser

Brought to you by Bytebase, open-source database governance platform.

pgtui

A simple terminal UI for PostgreSQL, written in Go with the Bubble Tea framework.

ReleaseBuild StatusLicenseGo Report Card

FeaturesInstallationQuick StartKeybindingsConfigurationDocs


Status: Beta — Core features are stable and ready for daily use. See Roadmap for planned features.

Why pgtui?

If you're anything like me, you love PostgreSQL but hate context-switching between your terminal and a heavy GUI client just to peek at some data. You want something that:

  • Stays in your terminal — no Electron, no browser tabs, just your good old terminal
  • Respects your muscle memory — Vim-style navigation because your fingers already know the way
  • Gets out of your way — connect, browse, filter, done

That's pgtui. Inspired by lazygit, built for developers who live in the terminal.

pgtui demo

Features

Database Navigation

Browse your databases, schemas, and tables with a familiar tree structure. Expand, collapse, and jump around with keyboard shortcuts you already know.

Navigation

Quick Search

Filter table rows instantly with /. Type your search term and watch results update in real-time — simple, fast, and familiar.

Filtering

JSONB Viewer

Native JSONB support with formatted display, tree navigation, and ready-to-use query snippets.

JSONB Viewer

Command Palette

Quick access to everything via Ctrl+K. Search commands, jump to tables, or access recent queries — all without leaving the keyboard.

Command Palette

SQL Editor

Write and execute SQL directly. Results appear in tabs, so you can run multiple queries and compare results.

SQL Editor

And More...

  • Query Favorites — Save and organize frequently used queries
  • Auto-Discovery — Automatically find local PostgreSQL instances
  • Mouse Support — Click, scroll, double-click when you want to
  • Connection History — Quick reconnect to recent databases
  • Vim Motionsgg, G, Ctrl+D, Ctrl+U, relative line numbers

Installation

Homebrew (macOS/Linux)

brew install pgplex/pgtui/pgtui

Go Install

go install github.com/pgplex/pgtui/cmd/pgtui@latest

Download Binary

Download the latest release from the Releases page.

Build from Source

git clone https://github.com/pgplex/pgtui.git
cd pgtui
make build
./bin/pgtui

Requirements

  • Go 1.24+ (for building from source)
  • PostgreSQL 12+ (for connecting)

Quick Start

  1. Launch pgtui

    pgtui
  2. Connect to a database

    • Press c to open the connection dialog
    • Select a discovered instance or enter connection details manually
    • Press Enter to connect
  3. Navigate your data

    • Use hjkl or arrow keys to move around
    • Press Enter to expand nodes or select tables
    • Press Tab to switch between panels
  4. Search and explore

    • Press / to search and filter rows
    • Press v on a JSONB cell to open the viewer
    • Press Ctrl+K to open the command palette
  5. Get help

    • Press ? to see all keyboard shortcuts

Keybindings

Global

KeyAction
Ctrl+KOpen command palette
Ctrl+EOpen SQL editor
TabSwitch panels
?Show help
qQuit

Navigation

KeyAction
hjklMove left/down/up/right
g / GJump to top/bottom
Ctrl+D / Ctrl+UPage down/up
EnterSelect / Expand
EscClose dialog / Cancel

Data View

KeyAction
/Search and filter rows
EscClear search
vOpen JSONB viewer (on JSONB cell)
pToggle preview pane
sSort by column
[ / ]Previous/Next tab

SQL Editor

KeyAction
Ctrl+SExecute query
Ctrl+OOpen in external editor
EscClose editor

Configuration

pgtui stores configuration in ~/.config/pgtui/:

FilePurpose
config.yamlUI and behavior settings
connection_history.yamlRecent connections (auto-saved)
favorites.yamlSaved SQL queries

Example Config (config.yaml)

ui:
theme: "default"mouse_enabled: truepanel_width_ratio: 25general:
default_limit: 100performance:
query_timeout: 30000

Documentation

Contributing

Contributions are welcome! Whether it's bug reports, feature requests, or pull requests — all are appreciated.

# Setup
git clone https://github.com/pgplex/pgtui.git
cd pgtui
make deps
# Development
make build # Build binary
make test# Run tests
make lint # Run linter
make fmt # Format code

Please read DEVELOPMENT.md before submitting a PR.

Star History

Star History Chart

Acknowledgments

pgtui wouldn't exist without these amazing projects:

Sponsor

Bytebase - open source, web-based database DevSecOps platform.

About

A simple terminal UI for PostgreSQL, written in Go with Bubble Tea

Topics

Resources

Stars

289 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages