pgtui is a CLI tool for viewing and dumping PostgreSQL schemas into a readable directory structure. It generates TypeScript model definitions and directory-based schema representations from a live PostgreSQL connection. The current stable version is 1.7.0, released on an irregular cadence. It differentiates itself from pg_dump by producing human-readable and navigable output, and by integrating with Docker for containerized environments. Useful for documentation, migration reviews, and type generation.
npm install pgtuiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Install pgtui globally or as devDep, then connect to a Postgres database to view schema interactively or dump it to files. Shows basic CLI usage for three main commands.
Use environment variables PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE or pass flags --host, --port, --user, --password, --database.
Use dump-to-dir for non-interactive environments like CI.
Explicitly set --host to reachable address or use --add-host host.docker.internal:host-gateway on Linux.
Use --host host.docker.internal on Docker, or provide actual IP address.
Pass --password <password> or set PGPASSWORD environment variable.
Run 'npm install -g pgtui' or use 'npx pgtui' from a directory with pgtui as devDependency.