pgtui

Crates.iopgtui
lib.rspgtui
version0.9.0
created_at2025-04-26 10:27:00.93276+00
updated_at2026-01-20 22:34:39.70495+00
descriptionA Postgres TUI client that utilizes your terminal text editor for inserts & updates.
homepage
repositoryhttps://codeberg.org/kdwarn/pgtui
max_upload_size
id1650137
size239,363
Kris Warner (kdwarn)

documentation

README

pgtui

My favorite user interface on a computer is probably the terminal-based text editor. I enjoy typing, syntax highlighting, spellchecking, the navigation, etc. So why not use that as a simple way to insert and update data in a database? That's the goal here, wrapped in a TUI that has additional functionality and which provides the interface to the database overall. All you have to do is provide the connection string via environment variables and voilà! No browser! No forms! No oauth! Just your terminal, your terminal-based editor, and your database.

To insert or update a record in the database, your default terminal editor will open a templated-out TOML file, where each Postgres data type is mapped to a corresponding TOML type.1 Edit as necessary, save and close, and its values are parsed and used in the insert/update query. You can also abandon the insert/update after a file has already been opened by simply uncommenting a line for that purpose. (And, by saving that file elsewhere before abandoning it, you can save it as a draft for submitting later.)

Various usage notes:

  • All available commands can be shown in-app via the ? key.
  • You can use locally or via a connection tunneled over ssh. Naturally, the tunneled one is a bit slower.
  • It's still kind of clunky, but coming along.
  • If you are entering a multi-line string, toml allows you to surround it with """ or '''. The first requires escaping special characters, while the latter does not. See the specification for more details.

Installation:

  • The recommended way is via Rust's cargo: cargo install pgtui.
  • You may also use pre-built binaries, which are available for Linux and Windows at https://codeberg.org/kdwarn/pgtui/releases. Download the version for your operating system and remove the OS name from the binary, e.g. rename pgtui-windows.exe to pgtui.exe.
  • A .deb package is also available on the releases page for Debian and derivatives. Install with apt-get install <path to it>. (And please let me know about your experience doing so.)

Format for the environment variable in a .env file: DATABASE_URL="postgres://user:password@host:port/database"

Extra disclaimer, beyond the AGPL license: This is very much a work in progress and in active development, so don't use it on a database you care about/haven't first backed up.

Footnotes

  1. Not all Postgres types are yet handled, and may never be. However the basic ones are - boolean, text, integers, floats, arrays (of text), etc.

Commit count: 132

cargo fmt