Skip to content
Get started
Get started
Integrations: Web Frameworks, Databases, AI Agents
guide · integrations

bunqueue in your stack.

One pattern works everywhere: create a queue, add jobs from your HTTP handlers, process them in a worker. This page shows the smallest version, then points you to the detailed guides.

This page is the hub for integrations. It shows the one pattern every integration shares, then links to the framework, storage, and AI agent guides.

bunqueue in embedded mode runs inside your app’s process, backed by a local SQLite file, so there is no queue server to install or run. This works in any Bun app, whatever framework you use:

import { Queue, Worker } from 'bunqueue/client';
// The queue: where jobs wait
const emails = new Queue('emails', { embedded: true });
// The worker: runs your function on each job
new Worker('emails', async (job) => {
await sendEmail(job.data);
}, { embedded: true });
// Anywhere in your app (an HTTP handler, for example):
await emails.add('welcome', { to: 'user@example.com' });

The HTTP response returns immediately; the email is sent in the background, with automatic retries if it fails.

The pattern above plus each framework’s idioms (typed context, validation, plugins):

FrameworkWhat the guide addsGuide
HonoRoutes, job status endpoints, typed middlewareHono Integration
ElysiaSchema validation with t.Object(), plugin patternElysia Integration

Using another framework? The smallest example above works as is; only the routing syntax changes.

bunqueue needs no external database. Persistence is a single local SQLite file. If you were expecting a Postgres or MySQL backend, or you deploy on a platform without a durable disk, read Storage: SQLite by Design. It explains why, and shows three patterns for serverless and ephemeral filesystems.

bunqueue ships an MCP server, so AI agents like Claude can add jobs, manage crons, retry failures, and monitor queues directly:

Terminal window
claude mcp add bunqueue -- bunx --package=bunqueue bunqueue-mcp

The same command shape works for Claude Desktop, Cursor, Windsurf, and any MCP client over stdio. Setup for each client, plus the full tool list, is in the MCP Server guide.

These apply to any framework.

Create each queue once at startup and import it where needed. Do not create a new Queue(...) inside a request handler.

queues.ts
import { Queue } from 'bunqueue/client';
export const queues = {
emails: new Queue('emails', {
embedded: true,
defaultJobOptions: { attempts: 3, backoff: 5000 },
}),
reports: new Queue('reports', {
embedded: true,
defaultJobOptions: { timeout: 300_000 },
}),
} as const;

defaultJobOptions sets the retry and timeout defaults for every job added to that queue; per-job options override them.

On shutdown, close workers first (they wait for active jobs to finish), then release the embedded queue manager:

import { shutdownManager } from 'bunqueue/client';
async function shutdown() {
await Promise.all(workers.map((w) => w.close()));
shutdownManager();
process.exit(0);
}
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);