# bunqueue: full documentation > Concatenated full text of the bunqueue documentation for LLM grounding. bunqueue is a high-performance job queue for the Bun runtime, using in-memory storage by default, optional SQLite (WAL), or PostgreSQL 15-18 for multi-broker deployments, without Redis. It provides a BullMQ-compatible API and a native MCP server. Canonical site: https://bunqueue.dev. Curated index: https://bunqueue.dev/llms.txt --- # Free, Open Source Job Queue for Your Stack bunqueue is a free, MIT-licensed job queue for Node.js, Deno, Python, PHP, Go, Rust, Elixir and Bun. Run the included Bun-powered server yourself, or use embedded mode on Bun. No Redis required. URL: https://bunqueue.dev/ import { Tabs, TabItem } from '@astrojs/starlight/components'; import HomeHero from '@components/home/HomeHero.astro'; import HomeDetails from '@components/home/HomeDetails.astro'; import HomeDockerQuickstart from '@components/home/HomeDockerQuickstart.astro';
Choose how to run the queue. Both options are free, with the same core queue features.
In a terminal with Bun installed, start the included server. Keep it running.
```bash bunx bunqueue start --host 127.0.0.1 --data-path ./bunqueue.db ```This is a local process on your machine. The server is included in the MIT-licensed package.
Open another terminal. Install a client, save the example, then run it.
You should see {'Processing: hello@example.com'}. Your application and worker use the same queue name and TCP address.
Use embedded mode when your app and worker run together on Bun. The queue engine lives inside your application.
```bash bun add bunqueue ```Set embedded: true on both the queue and worker. The example keeps jobs in memory; configure SQLite persistence to recover work after a restart.
bunqueue is a free, MIT-licensed job queue for Node.js, Deno, Python, PHP, Go, Rust, Elixir and Bun. The name comes from the core engine, which runs on Bun. Your application and workers use their own runtime through an official client.
The free bunqueue server runs on Bun. Your application uses the client for its own language. Bun applications can also embed the queue directly. The server, clients and queue features are included under MIT.
Create a queue, add jobs, process them with a Worker, and turn on persistence. On Bun everything runs embedded in a single process with zero configuration; from any other language, start the server once and connect.
bunqueue ships a built-in MCP server, so AI agents like Claude and Cursor can add jobs, schedule crons and monitor queues by talking to it. One command to connect, no code to write.
Six patterns you can copy into a real app: emails, webhooks, images, payments, cron and multi-step flows. Each one moves slow work out of your API request and into a background job.
Simple Mode gives you a Queue and a Worker in a single object. Add jobs, process them, add middleware, schedule crons, all from one place, one thing to close on shutdown.
Some jobs are really a sequence: reserve the stock, charge the card, send the confirmation. The workflow engine runs that sequence, retries the flaky parts, resumes after a crash, and when a later step fails it undoes the earlier ones for you.
A Queue is where work goes in. It is the same object whether it writes to SQLite in your process or talks over TCP to a memory-, SQLite-, or PostgreSQL-backed server, so client code does not change when the deployment does.
A worker is a loop you do not have to write. It asks the queue for work, runs your function, reports the outcome, and keeps the job alive while it runs.
A long, non-yielding handler can starve the code that renews its lease. Keep the broker safety mechanisms on and move computation to a thread, process, or service that cannot block them.
QueueGroup prefixes a set of queues with a shared name, so "invoices" inside the "billing" group becomes "billing:invoices". Handy for multi-tenant apps and keeping domains apart.
Some work only makes sense in order: resize every image, then build the album; charge each line, then close the invoice. A flow declares that shape once and bunqueue holds the parent until its children are done.
If a worker crashes or hangs mid-job, the job is not lost. bunqueue notices the silence, retries the job, and parks repeat offenders in the dead letter queue.
When a job runs out of retries, bunqueue can retain it in the Dead Letter Queue with the terminal error and attempt metadata, so you can inspect it and retry it deliberately.
Official client SDKs for Node.js, Deno, Bun, Python, PHP, Go, Rust, Elixir and Cloudflare Workers. Each speaks the native TCP protocol and MessagePack through an idiomatic Queue and Worker API.
Run bunqueue as a standalone service so multiple apps can share a queue. Keep one memory/SQLite broker, or point several brokers at PostgreSQL 15–18; producers and workers use the same TCP API either way.
Configure the whole bunqueue server from a single typed bunqueue.config.ts instead of scattered environment variables. Every option has IntelliSense, every section is optional.
One binary, two roles: bunqueue start runs the server, every other command talks to a running one. Push, pull, ack, DLQ, cron, backups, and monitoring, all scriptable with JSON output.
The complete environment variable reference for the bunqueue server and CLI: ports, storage, auth, TLS, S3 backup, timeouts, and logging.
The bunqueue HTTP API runs on port 6790 by default, configurable via the HTTP_PORT environment variable. All request and response bodies use JSON (Content-Type: application/json) unless otherwise noted.
A high-performance binary protocol on port 6789 by default. All messages use MessagePack encoding with length-prefixed framing, and pipelining lets the server process commands concurrently.
bunqueue is written in TypeScript and provides comprehensive type definitions. All public types are exported from bunqueue/client.
{
jobId: string;
data: P;
}
/** Emitted when a job stalls (no heartbeat) */
interface StalledEvent {
jobId: string;
}
/** Emitted when a job is removed from the queue */
interface RemovedEvent {
jobId: string;
prev: string;
}
/** Emitted when a job is moved to delayed state */
interface DelayedEvent {
jobId: string;
delay: number;
}
/** Emitted when a duplicate job is detected */
interface DuplicatedEvent {
jobId: string;
}
/** Emitted when a job is retried */
interface RetriedEvent {
jobId: string;
prev: string;
}
/** Emitted when a job enters waiting-children state */
interface WaitingChildrenEvent {
jobId: string;
}
/** Emitted when the queue has no more waiting jobs */
interface DrainedEvent {
id: string;
}
```
### QueueEvents Usage
```typescript
const events = new QueueEvents('my-queue', {
connection: { host: '127.0.0.1', port: 6789, token: process.env.BUNQUEUE_TOKEN },
});
events.on('waiting', ({ jobId }) => {
/* ... */
});
events.on('active', ({ jobId }) => {
/* ... */
});
events.on('completed', ({ jobId, returnvalue }) => {
/* ... */
});
events.on('failed', ({ jobId, failedReason }) => {
/* ... */
});
events.on('progress', ({ jobId, data }) => {
/* ... */
});
events.on('stalled', ({ jobId }) => {
/* ... */
});
events.on('removed', ({ jobId, prev }) => {
/* ... */
});
events.on('delayed', ({ jobId, delay }) => {
/* ... */
});
events.on('duplicated', ({ jobId }) => {
/* ... */
});
events.on('retried', ({ jobId, prev }) => {
/* ... */
});
events.on('waiting-children', ({ jobId }) => {
/* ... */
});
events.on('drained', ({ id }) => {
/* ... */
});
events.on('paused', () => {
/* ... */
});
events.on('resumed', () => {
/* ... */
});
events.on('error', (error: Error) => {
/* ... */
});
```
## QueueEventType
```typescript
type QueueEventType =
'waiting' | 'active' | 'completed' | 'failed' | 'progress' | 'removed' | 'drained';
```
## FlowProducer Types
### FlowProducerOptions
```typescript
interface FlowProducerOptions {
/** Use embedded mode (no server) */
embedded?: boolean;
/** TCP connection options */
connection?: ConnectionOptions;
}
```
:::note
FlowProducer extends `EventEmitter` (BullMQ v5 compatible). You can listen for
events using `.on()`, `.once()`, etc. The `close()` method returns
`Promise