Registry / database / pmb-postgres

pmb-postgres

JSON →
library0.0.6jsnpmunverified

pmb-postgres is a Postgres database provider for the PMB framework, version 0.0.6. It provides a lightweight integration layer for connecting PMB applications to PostgreSQL databases. As a very early-stage package with no release cadence, it offers minimal abstraction over node-postgres. Its key differentiators are its tight coupling with PMB's service architecture and small API surface. Uses pg (node-postgres) internally.

npm install pmb-postgres
INSTALL
IMPORT
SIG · PMB-POSTGRES
P
pmb-postgres
databasejavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createPostgresService
import { createPostgresService } from 'pmb-postgres'
const createPostgresService = require('pmb-postgres')
The package does not export a CommonJS compatible default, use ESM import.
PostgresServiceConfig
import type { PostgresServiceConfig } from 'pmb-postgres'
import { PostgresServiceConfig } from 'pmb-postgres'
This is a TypeScript type, not a value. Import as type to avoid runtime errors in compiled code.
default export
import pmbPostgres from 'pmb-postgres'
import { default as pmbPostgres } from 'pmb-postgres'
The package has a default export which is the same as createPostgresService. The named export is preferred.

Demonstrates creating a Postgres service with configuration and executing a simple query.

import { createPostgresService } from 'pmb-postgres'; const config = { connectionString: process.env.DATABASE_URL ?? 'postgres://localhost:5432/mydb', poolSize: 10 }; const db = createPostgresService(config); async function test() { const result = await db.query('SELECT NOW()'); console.log(result.rows[0].now); await db.disconnect(); } test().catch(console.error);
Debug
Known issues
gotchaThe package is version 0.0.6 and may have unstable API. Expect breaking changes in minor versions before 1.0.0.
fix
Pin exact version in package.json and review changelog before upgrading.
affects: >=0.0.0 <1.0.0
breakingcreatePostgresService accepts a config object with 'connectionString' property. 'uri' or 'url' are not supported.
fix
Use 'connectionString' instead of 'url' or 'uri'.
affects: >=0.0.0 <=0.0.6
gotchaThe package does not handle reconnection or retry logic. Pool connection failures will throw immediately.
fix
Wrap db.query calls in try-catch or implement custom retry logic.
affects: >=0.0.0 <=0.0.6
Errors
Common errors & fixes
TypeError: createPostgresService is not a function
Using CommonJS require with a package that only exports ES modules.
fix
Use import statement or enable ES modules in your project. Alternatively, use dynamic import: const { createPostgresService } = await import('pmb-postgres');
Error: getaddrinfo ENOTFOUND localhost
Database hostname 'localhost' is not resolved. Possibly PostgreSQL not running or connection string misconfigured.
fix
Ensure PostgreSQL is running. Update connectionString to use the correct host (e.g., '127.0.0.1' or valid hostname).
Error: no pg_hba.conf entry for host
PostgreSQL authentication failure: the client IP or authentication method is not allowed.
fix
Modify pg_hba.conf to allow connections from your client IP with appropriate authentication method (e.g., md5, trust). Then reload PostgreSQL.
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
pgrequirednode-postgres is the PostgreSQL client used internally for database connections and queries.
Agent activity
4 hits · last 30 days
node
4
Resources
pmb-postgres — npm install pmb-postgres · libregistry