{"id":42839,"library":"hapi-postgres-pool","title":"hapi-postgres-pool","description":"Hapi plugin (v2.x) for connecting to multiple PostgreSQL databases using connection pools. Provides access via server and request objects, supports native pg bindings, and allows attaching queries based on URL params. Uses pg-pool under the hood. Last updated 2017, appears unmaintained (no recent releases).","status":"maintenance","version":"2.2.5","language":"javascript","source_language":"en","source_url":"https://github.com/doron2402/hapi-postgres-pool","tags":["javascript","pg","postgres","postgresql","pool","multiple connections"],"install":[{"cmd":"npm install hapi-postgres-pool","lang":"bash","label":"npm"},{"cmd":"yarn add hapi-postgres-pool","lang":"bash","label":"yarn"},{"cmd":"pnpm add hapi-postgres-pool","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"PostgreSQL client library","package":"pg","optional":false},{"reason":"Validation library used internally","package":"@hapi/joi","optional":false}],"imports":[{"note":"CommonJS only; no ES module export.","wrong":"import plugin from 'hapi-postgres-pool'","symbol":"default","correct":"const plugin = require('hapi-postgres-pool')"}],"quickstart":{"code":"const Hapi = require('@hapi/hapi');\nconst plugin = require('hapi-postgres-pool');\n\nconst server = Hapi.server({ port: 3000 });\n\nawait server.register({\n  plugin: plugin,\n  options: {\n    default: 'primary',\n    connections: [\n      {\n        key: 'primary',\n        connectionString: 'postgres://user:pass@localhost:5432/mydb'\n      }\n    ]\n  }\n});\n\n// Access pool via server\nconst pool = server.pg.primary;\nconst { rows } = await pool.query('SELECT NOW()');\nconsole.log(rows);\n\nawait server.start();","lang":"javascript","description":"Registers the plugin with a single PostgreSQL connection and runs a simple query."},"warnings":[{"fix":"Consider migrating to '@hapi/postgresql-connection' or 'knex' with Hapi plugins.","message":"Plugin is unmaintained; no updates since 2017. May not work with modern Hapi v19+.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure Hapi version is 17 or newer. For v16, use version 1.x of this plugin.","message":"Requires Hapi v17+ (uses async/await). Older Hapi v16 not supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always set a 'default' key or ensure the requested key exists in connections.","message":"The connection pools are attached to server.pg and request.pg with the 'key' value. If no default is set and the key is not matched, pooled connections may be undefined.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2017':45 'access':18 'allow':29 'appear':46 'attach':30 'base':32 'bind':27 'connect':9,15,57 'databas':13 'hapi':2,5 'hapi-postgres-pool':1 'hood':42 'javascript':51 'last':43 'multipl':11,56 'nativ':25 'object':23 'param':35 'pg':26,38,52 'pg-pool':37 'plugin':6 'pool':4,16,39,55 'postgr':3,53 'postgresql':12,54 'provid':17 'queri':31 'recent':49 'releas':50 'request':22 'server':20 'support':24 'unmaintain':47 'updat':44 'url':34 'use':14,36 'v2.x':7 'via':19","created_at":"2026-06-05T16:56:55.172164+00:00","updated_at":"2026-06-05T16:56:55.172164+00:00","problems":[{"fix":"npm install hapi-postgres-pool","cause":"Package was not installed or name is misspelled.","error":"Error: Cannot find module 'hapi-postgres-pool'"},{"fix":"Ensure the key used (e.g., server.pg.mykey) matches one defined in options.connections.","cause":"Attempted to access a connection key that does not exist in options.connections.","error":"TypeError: Cannot read property 'query' of undefined"}],"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/doron2402/hapi-postgres-pool#readme","github":"https://github.com/doron2402/hapi-postgres-pool","docs":null,"changelog":null,"pypi":null,"npm":"hapi-postgres-pool","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}}