Context
Quervex is a command-line assistant designed to simplify accessing and managing PostgreSQL databases. This versatile tool allows you to execute SQL queries, quickly inspect schemas and tables, export data samples to CSV format, and manage views. It also features graphical visualization of input/output (I/O) flows including cardinality management.
Challenge
Exploring a PostgreSQL database usually means memorising psql meta-commands or opening a heavy GUI. The goal was an interactive console that a beginner can pick up in minutes and a professional can trust on a real database: discoverable, readable, safe by default and free, with no account, no subscription and no telemetry.
Solution
- Discoverable: typing / opens a live command menu (arrows to navigate, Tab to complete), and typos get a did you mean…? suggestion.
- Readable: results are rendered as tables that fit the terminal; wide tables switch automatically to a vertical record view.
- Nano-like SQL editor: multi-line queries with syntax placeholders, Ctrl+R to run, Ctrl+W to recall the previous query, and PostgreSQL errors pinpointed in red with a suggested fix.
- Guided management: wizards to add connections, create databases and tables (identity primary key and named constraints added for you), a query history and transactions handled either automatically or manually (BEGIN / COMMIT / ROLLBACK).
- Bilingual: the whole assistant is available in English and French.
Schema exploration
Schema exploration is where Quervex goes beyond a classic client. /print table shows columns, types, keys and every constraint, then draws the relationship graph with Merise (min,max) cardinalities (0,n · 0,1 · 1,1) and runs best-practice checks. /explore starts a local web page with a draggable, zoomable entity–relationship diagram that refreshes by itself when the schema changes. The structure can be exported as a replayable SQL script or a Mermaid diagram, and query results as Excel-ready CSV.
Security
- Read-only by default: SQL runs one statement at a time inside a transaction that is always closed; destructive statements (DROP, TRUNCATE, DELETE or UPDATE without WHERE) must be confirmed by retyping the table name.
- No injection: values are always sent as bound parameters, and table and column names are checked against the database catalog before being escaped.
- Protected secrets: passwords are typed hidden, never written to the history, and stored only on request in the system vault (Windows DPAPI, macOS Keychain, Linux Secret Service).
- Safe outputs: CSV formulas are neutralised, terminal escape sequences coming from the database are stripped, and /explore listens on 127.0.0.1 only behind a secret token, exposing the schema but never the data.
Deployment
Quervex ships as standalone executables with Node.js embedded for Windows, Linux and WSL, and as a dependency-free npm package (Node.js ≥ 22) for every system. Installation needs no administrator rights: the one-line installers verify the SHA-256 fingerprint of every download, and each release includes an SBOM. On startup, Quervex checks the local PostgreSQL installation and offers to install it (winget, Homebrew, apt, dnf), run it in Docker or connect to a remote server. The project is published under the MIT licence.
$ npm install -g quervex