Skip to content
Proyectos

Acerca de

⚡ Cola de trabajos de alto rendimiento para Bun. SQLite de forma predeterminada y PostgreSQL con múltiples brokers al escalar. Incluye DLQ, cron, copias de seguridad de SQLite en S3 y MCP nativo. Sin Redis.

Sistemas e infraestructura

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
-1
in 7 days
+3
in 15 days
+7
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

bunqueue

npm version npm downloads CI GitHub Stars License

High-performance job queue, scheduler, and workflow engine. No Redis.
Runs in-process on Bun (memory or one-file SQLite), as a standalone server, or multi-broker on PostgreSQL 17–19.

Docs · Quick Start · SDKs · Video Course · Benchmarks · npm


Pick your setup

Use case How to run Storage
Bun app (fastest start) bun add bunqueue (embedded: true) In-memory or 1 SQLite file (dataPath)
Node / Deno / Python / Go / Rust Docker, single binary, or bunx bunqueue start SQLite (single broker)
Multi-broker HA docker compose -f docker-compose.postgres.yml up -d (from a repo clone) PostgreSQL 17–19 (19.0 recommended)

Only the server and embedded runtime require Bun (>= 1.4.0). Producers and workers run from Node.js, Deno, Bun, Cloudflare Workers, Python, Go, and Rust.


1. Quickstart on Bun (in-process, zero setup)

bun add bunqueue
// jobs.ts
import { Queue, Worker } from 'bunqueue/client';

const queue = new Queue<{ to: string }>('emails', { embedded: true });

const worker = new Worker<{ to: string }>(
  'emails',
  async (job) => {
    console.log('Processing:', job.data.to);
    return { sent: true };
  },
  { embedded: true }
);

worker.on('error', (error) => console.error(error));
await queue.add('welcome', { to: '[email protected]' });
bun jobs.ts
# Processing: [email protected]

Add dataPath: './jobs.db' to Queue and Worker to persist jobs to a single SQLite file across restarts.


2. Server Mode (any language)

Start the server

# Docker (amd64 & arm64 — variants: alpine, debian, slim, distroless)
docker run -d --name bunqueue \
  --restart unless-stopped \
  -p 127.0.0.1:6789:6789 \
  -p 127.0.0.1:6790:6790 \
  -v bunqueue-data:/app/data \
  egeominotti/bunqueue:2.9.25-alpine

curl --fail http://127.0.0.1:6790/health

Prefer no Docker? Install the verified single binary or run via Bun:

curl -fsSL https://bunqueue.dev/install.sh | sh                              # macOS / Linux binary
curl -fsSL https://bunqueue.dev/install.sh | sudo sh -s -- --systemd         # Linux hardened systemd service
# irm https://bunqueue.dev/install.ps1 | iex                                 # Windows (x64 & arm64)
bunx bunqueue start --host 127.0.0.1 --data-path ./bunqueue.db               # Bun CLI

Connect from Node.js (or any SDK)

npm install bunqueue-client
// jobs.mjs
import { Queue, Worker } from 'bunqueue-client';

const options = {
  embedded: false,
  connection: { host: '127.0.0.1', port: 6789 },
};
const queue = new Queue('emails', options);

const worker = new Worker(
  'emails',
  async (job) => {
    console.log('Processing:', job.data.to);
    return { sent: true };
  },
  options
);

worker.on('error', (error) => console.error(error));
await queue.add('welcome', { to: '[email protected]' });
node jobs.mjs
# Processing: [email protected]

Official SDKs

Runtime Install
Node.js ≥ 20, Deno ≥ 2, Bun, Cloudflare Workers npm install bunqueue-client
Python ≥ 3.10 pip install bunqueue-client
Go ≥ 1.26.5 go get github.com/egeominotti/bunqueue/sdk/go
Rust ≥ 1.85 cargo add bunqueue-client

All four SDKs share the same wire protocol, Queue / Worker / atomic FlowProducer APIs, and conformance suite (SDK guide →).

Scale out with PostgreSQL 17–19

From a clone of this repository:

POSTGRES_PASSWORD='replace-me' \
  BUNQUEUE_POSTGRES_URL='postgres://bunqueue:replace-me@postgres:5432/bunqueue' \
  docker compose -f docker-compose.postgres.yml up --build -d

Starts active-active brokers against one PostgreSQL database with database-authoritative claims, fenced leases, and failover (storage guide → · Docker & deployment →).


Core features

Built-in server-side: retries with backoff, priorities, cron, rate limits, fair FIFO groups & native batches (QueuePro/WorkerPro), atomic parent/child flows, DLQ, SQLite S3 backups, and BullMQ-compatible APIs (migrate in minutes →).

Simple Mode (Bunqueue — Queue + Worker + routes + cron in one object)

import { Bunqueue } from 'bunqueue/client';

const app = new Bunqueue<{ to?: string }, { ok: boolean }>('notifications', {
  embedded: true,
  routes: {
    'send-email': async (job) => {
      console.log('Sending to:', job.data.to);
      return { ok: true };
    },
    'daily-report': async () => ({ ok: true }),
  },
  concurrency: 10,
  retry: { maxAttempts: 5, strategy: 'jitter' },
});

await app.cron('daily-report', '0 9 * * *', {});
await app.add('send-email', { to: '[email protected]' });

Workflow Engine (sagas, branching, human-in-the-loop)

import { Workflow, Engine } from 'bunqueue/workflow';

const orderFlow = new Workflow('order-pipeline')
  .step('reserve', async () => inventory.reserve(), {
    compensate: async () => inventory.release(), // auto-rollback on downstream failure
  })
  .step('charge', async () => ({ txId: await payments.charge() }), {
    compensate: async () => payments.refund(),
  })
  .waitFor('manager-approval', { timeout: 86_400_000 })
  .step('confirm', async (ctx) => ({ txId: (ctx.steps['charge'] as { txId: string }).txId }));

const engine = new Engine({ embedded: true });
engine.register(orderFlow);
const run = await engine.start('order-pipeline', { orderId: 'ORD-1' });
await engine.signal(run.id, 'manager-approval', { approved: true });

Built-in MCP Server (AI agents)

Ships with 79 primary tools (+ 3 optional workflow tools, 5 resources, 3 prompts) over stdio or Streamable HTTP:

bun add bunqueue @modelcontextprotocol/sdk
claude mcp add bunqueue -e BUNQUEUE_MCP_PROFILE=agent -- bunx --package=bunqueue bunqueue-mcp

Live Monitoring & Diagnostics

bunqueue top                     # live terminal TUI (queues, jobs, DLQ, workers, workflows)
bunqueue doctor --deep           # check config, TCP, host limits, SQLite, PostgreSQL >=17, systemd
bunx bunqueue-dashboard          # web UI (beta) — live demo: https://egeominotti.github.io/bunqueue-dashboard/

Performance

Medians on native Ryzen 9 9950X3D (Bun 1.3.14, repeated fresh processes — methodology & full report →):

Workload Mode Median Persistence
Internal batched push (1M jobs) Embedded 729,395 jobs/sec In-memory
Public addBulk (50K cell) Embedded 186,384 jobs/sec On-disk SQLite
TCP PUSHB (50K sample) Server 158,779 jobs/sec On-disk SQLite
No-work worker drain (concurrency 50) Server 17,256 jobs/sec Full pull/process/ACK
Linear Workflow Engine (3 nodes) Embedded / TCP 2,700 / 3,187 wf/sec SQLite

These operations do different work; the internal in-memory push result is not an SQLite or public-API claim.


Documentation & Links

License

MIT — provided as is, without warranty of any kind. See DISCLAIMER.md.

Explorar proyectos relacionados

Cargando…