Queue

Process background jobs reliably with retries, scheduling, and concurrency control. Supports Redis-backed queues, Postgres-based queues, and in-memory for development.

jobsbackgroundworkersasync

Providers

BullMQ

Redis-backed job queue with scheduling, retries, and dashboard

bullmq
REDIS_URL

pg-boss

PostgreSQL-based job queue with no additional infrastructure

pg-boss
DATABASE_URL

In-Memory

Simple in-process queue for development and testing

Usage

Enqueue a background job

Add a job to the queue for async processing

import { queue } from '@/lib/queue'

// Enqueue a job
await queue.add('send-welcome-email', {
  userId: user.id,
  email: user.email,
})

// Process jobs
queue.process('send-welcome-email', async (job) => {
  await sendWelcomeEmail(job.data.email)
})

Get Started

Add queue to your Primstack project with a single command:

prim queue init