Queue

Send background jobs through Platformatic, Cloudflare, Vercel, Netlify, Upstash QStash, or Memory.

Use Queue to move work out of the current request. Define queue handlers once, publish jobs with runQueue(), and switch providers without rewriting your application code.

What Queue is

Queue gives you one portable way to define background jobs and send them later.

  • Put queue definitions in server/queues/**.
  • Register a queue with defineQueue(handler, options?).
  • Publish work with runQueue() or deferQueue().

Queue names come from the file path, so welcome-email.ts becomes welcome-email across providers.

When Queue fits

Queue is a good fit when you want to:

  • move slow work out of the request path
  • retry failed jobs
  • delay or rate-limit delivery
  • keep one job definition while swapping between hosted and local providers

Use When to use Queue when you need to choose between Queue, Workflow, and Cron.

What stays portable

These parts stay the same when you switch providers:

  • the discovery directory: src/queues/** or server/queues/**
  • the queue definition API: defineQueue() and createQueue() where supported
  • the runtime API: runQueue(), deferQueue(), and getQueue()
  • the queue name derived from the file path

Provider-specific setup, callback delivery, bindings, and advanced native methods live on the provider pages.

Where to go next

Quickstart
Get a first queue working locally with the memory provider.
Runtime API
Look up defineQueue, runQueue, deferQueue, getQueue, and the core Queue types.
When to use Queue
Decide when Queue is better than Workflow, Cron, or an inline request flow.
Send a job
Enqueue payloads with the common runtime patterns.
Local development
Understand memory auto-selection and the recommended local loop.
Runtime playground
Inspect the existing Queue playground app and the exact files it uses.

Providers

Platformatic
Configure local or self-hosted workers with full runtime control.
Cloudflare
Run producers and consumers on Workers with Cloudflare Queues.
Vercel
Publish and consume jobs inside the Vercel deployment model.
Netlify
Route background work through Netlify Async Workloads.
Upstash QStash
Use an HTTP-first queue with signed callback delivery.
Memory
Run jobs in-process for local development and tests.