A lightweight wrapper around node-postgres that provides a simplified promise-based API for common PostgreSQL operations such as querying, inserts, updates, transactions, streaming, and schema management. Version 1.3.2 is the latest stable release; the project is in maintenance mode with infrequent updates. Key differentiators include automatic loading and caching of SQL files from a folder, support for multiple database connections via separate config paths, and explicit transaction helpers with isolation level control. Compared to raw pg or knex, it reduces boilerplate for CRUD and transactions but lacks active development or TypeScript support.
npm install handy-postgresNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize handy-postgres with a config object and execute a simple query using promises.
Set the 'sql' config path to the folder containing .sql files, and reference them by filename without extension.
Migrate to a library that supports async/await natively and has TypeScript definitions.
Use separate stream queries for each statement, or use query() for multiple statements.
Use require('handy-postgres') or default import with bundler.Run 'npm install handy-postgres' and use const HandyPg = require('handy-postgres');Ensure PostgreSQL is running on localhost:5432 and config matches.
Pass a valid config object or config path to HandyPg({...}).Ensure the sql config path is set and the SQL file exists, or provide a raw SQL string.