API Reference

pg-boss

PostgreSQL-backed job queue for Node.js with retries, delayed scheduling, and transactional enqueue.

Official Documentation ↗
CompatibilityThis documentation covers version v12.38.0. Check the official docs for the latest API surface.

Installation

npmnpm install pg-boss

Methods

pg-boss stores jobs as rows in PostgreSQL, using the database as the single source of truth for delivery.

Key Features

  • At-least-once delivery with retries
  • Delayed and cron scheduling
  • Enqueue inside your own transaction

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/timgit/pg-boss@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:40.663Z.

FAQ

Why use pg-boss instead of a separate broker?
If you already run PostgreSQL, pg-boss avoids operating another service while giving you transactional enqueue in the same database.
What happens if a worker crashes mid-job?
The job remains active until its expiration lapses, then becomes available again, so handlers should be idempotent under at-least-once delivery.
How do I schedule recurring work?
Use boss.schedule(queue, cron, data) with a cron expression so pg-boss enqueues jobs on that cadence.