{"id":42881,"library":"is-postgres","title":"is-postgres","description":"A simple utility to check if a PostgreSQL database server is running. The latest stable version is v0.2.0, released in 2014. It provides both callback and promise APIs, as well as a CLI tool. No longer actively maintained; considered feature-complete for its narrow scope. Alternatives include more comprehensive database health-check libraries.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"git@github.com:charliedowler/is-postgres","tags":["javascript","database","postgres"],"install":[{"cmd":"npm install is-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add is-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add is-postgres","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM named default import. The package does not ship TypeScript types.","symbol":"isPostgres","correct":"import isPostgres from 'is-postgres'"},{"note":"CommonJS require; avoid local path as it's an npm package.","wrong":"const isPostgres = require('./is-postgres')","symbol":"isPostgres","correct":"const isPostgres = require('is-postgres')"},{"note":"Named import works in ESM, but typically a default import is used. Both are supported.","wrong":"import { isPostgres } from 'is-postgres'","symbol":"isPostgres","correct":"import { isPostgres } from 'is-postgres'"}],"quickstart":{"code":"const isPostgres = require('is-postgres');\n\n// Check if Postgres is running (callback)\nisPostgres((db) => {\n  console.log('Running:', db.running); // true or false\n  if (db.running) {\n    console.log('Type:', db.type); // 'postgres'\n  }\n});\n\n// Promise-based\nisPostgres().then((db) => {\n  console.log('Running:', db.running);\n});","lang":"javascript","description":"Shows both callback and promise usage to check if PostgreSQL is running."},"warnings":[{"fix":"Use a more comprehensive tool like pg-ping or a full database connection test for production checks.","message":"The package only checks if PostgreSQL is listening on the default port (5432); it does not verify database connectivity or authentication.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use the promise-based API: isPostgres().then(...) or use async/await.","message":"Callback API is deprecated in favor of Promises, though still supported in current versions.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Use npx is-postgres to avoid global install, or check the package.json bin entry.","message":"The CLI command is 'is-postgres' but global installation is required; may conflict with other packages using the same command name.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2014':24 'activ':40 'altern':50 'api':31 'callback':28 'check':8,57 'cli':36 'complet':45 'comprehens':53 'consid':42 'databas':12,54,60 'featur':44 'feature-complet':43 'health':56 'health-check':55 'includ':51 'is-postgr':1 'javascript':59 'latest':17 'librari':58 'longer':39 'maintain':41 'narrow':48 'postgr':3,61 'postgresql':11 'promis':30 'provid':26 'releas':22 'run':15 'scope':49 'server':13 'simpl':5 'stabl':18 'tool':37 'util':6 'v0.2.0':21 'version':19 'well':33","created_at":"2026-06-05T16:57:07.083549+00:00","updated_at":"2026-06-05T16:57:07.083549+00:00","problems":[{"fix":"Run 'npm install is-postgres' in your project directory.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'is-postgres'"},{"fix":"Use 'const isPostgres = require(\"is-postgres\");' or 'import isPostgres from \"is-postgres\";'.","cause":"Incorrect import: using a named import when a default import is required.","error":"isPostgres is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/charliedowler/is-postgres","github":"git@github.com:charliedowler/is-postgres","docs":null,"changelog":null,"pypi":null,"npm":"is-postgres","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}