pg-boss is a PostgreSQL-based job queue for Node.js providing exactly-once delivery, backpressure-compatible polling, cron scheduling, dead letter queues, priority queues, and automatic retries with exponential backoff. It uses PostgreSQL's SKIP LOCKED to guarantee atomic commits and can create jobs within existing database transactions. Ships TypeScript types, supports multi-master deployments (e.g., Kubernetes ReplicaSet), serverless functions, and CLI for migrations. Version 12.18.2 requires Node >=22.12.0. Key differentiators: SQL-based operations, ORM transaction adapters (Knex, Kysely, Prisma), and pub/sub API for fan-out patterns.
npm install pg-bossNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup: create PgBoss instance, start, create queue, send job, work callback.
Use import { PgBoss } from 'pg-boss' instead of default import.Upgrade Node.js to >=22.12.0 or use pg-boss@11.x.
Always await boss.start() before boss.send() or boss.work().
Replace boss.publish() with boss.send().
Attach an 'error' listener: boss.on('error', console.error).Import adapters from 'pg-boss' directly, not from 'pg-boss/adapters'.
Verify PostgreSQL is running and connection string is correct: 'postgres://user:pass@host:port/db'.
Change import to: import { PgBoss } from 'pg-boss'.Run `await boss.start()` or `npx pg-boss migrate` to create required tables.
Run `npm install pg-boss` and ensure import path is correct.
Use fromKnex(trx) not fromKnex(trx) — call the adapter function with the transaction object.