Skip to content

Monque

Type-safe, reliable job scheduling powered by MongoDB
import { Monque } from "@monque/core";
import { MongoClient } from "mongodb";

const client = await MongoClient.connect("mongodb://localhost:27017");
const monque = new Monque(client.db("my-app"));

monque.register<{ message: string }>("print-message", async (job) => {
  console.log(job.data.message);
});

await monque.initialize();
monque.start();
await monque.now("print-message", { message: "Hello from Monque" });

See the Quick Start for events, recurring jobs, and graceful shutdown.

bun add @monque/core mongodb

Add the dashboard to inspect jobs, filter and share views, and retry, cancel, reschedule, or delete jobs from your Express application. It includes Queue Views, Jobs, and Health pages with light and dark themes.

The Management API exposes the same queries and actions to HTTP clients, with OpenAPI documentation, authorization, and payload redaction.

Atomic Locking

Multiple schedulers can share a jobs collection. Atomic claims prevent two workers from claiming the same pending job at once. Handlers must still be safe to retry.

Heartbeat Monitoring

Heartbeats record worker activity. During startup, Monque recovers processing jobs whose locks have expired.

Type-Safe

Use TypeScript generics to describe the payload each worker receives.

Framework Agnostic

Works with any Node.js framework and runs wherever you can connect to MongoDB.

Event-Driven

Record job starts, completions, and failures through event listeners.

Change Streams

Real-time job notifications via MongoDB Change Streams, while polling continues as a safety net.

Cron Scheduling

Schedule recurring jobs with standard 5-field cron expressions. Automatic rescheduling after successful completion.

Exponential Backoff

Automatic retries with configurable exponential backoff. Set retry limits and maximum delays for failed jobs.

Installation Guide

Check requirements and install the packages. Installation

Quick Start Tutorial

Register a worker and process your first job. Quick start

Core Concepts

Understand jobs, workers, and the processing lifecycle. Jobs

API Reference

Look up methods, options, and TypeScript types. API reference

Related job queue libraries: