Some work should not happen inside a web request. Sending a welcome email, generating a PDF, resizing an image, or processing a payment webhook β if any of these run slowly, your user waits. BullMQ solves this by moving the work into a queue backed by Redis, so your API can respond instantly and the heavy work happens in the background.
The pattern is simple: a producer adds jobs, workers process them.
import { Queue , Worker } from 'bullmq' ;
const emailQueue = new Queue ( 'emails' , { connection : { host : 'localhost' , port : 6379 } , } ) ;
// Producer: add a job from your API route await emailQueue . add ( 'welcome' , { userId : 42 , email : '[email protected]' } ) ;
// Worker: process jobs somewhere else const worker = new Worker ( 'emails' , async ( job ) => { await sendWelcomeEmail ( job . data .β¦