Run durable scheduled agent jobs in Node.js with Agenda
Use Agenda when a custom Node.js agent needs persistent scheduled jobs, retries, locking, and background workers backed by MongoDB, PostgreSQL, or Redis instead of fragile in-process timers.
Prerequisites
Node.js, the agenda npm package, and a supported persistence backend such as MongoDB, PostgreSQL, or Redis.
Installation
Use the upstream install or setup path that matches your environment:
- npm install agenda
- npm install @agendajs/mongo-backend
- npm install @agendajs/postgres-backend
- npm install @agendajs/redis-backend
Requirements and caveats from upstream:
- A light-weight job scheduling library for Node.js
- ESM-only - Modern ES modules (Node.js 18+)
- If your MongoDB deployment is a replica set (even a single-node replica set works), you can use MongoChangeStreamNotificationChannel for native real-time notifications without any external dependencies:
Basic usage or getting-started notes:
For MongoDB: Install the official MongoDB backend:
You will need a working MongoDB database (v4+).
For PostgreSQL: Install the official PostgreSQL backend:
Source: https://github.com/agenda/agenda
Extracted from upstream docs: https://raw.githubusercontent.com/agenda/agenda/HEAD/README.md