High-performance job queue for Bun — SQLite persistence, cron scheduling, DLQ, S3 backups, and a native MCP server, all without Redis.
bunqueue is a TypeScript-first job queue built exclusively for the Bun runtime, replacing Redis-backed systems like BullMQ with a self-contained server that uses Bun’s native SQLite for persistence. It ships as a single npm install weighing just 5.4 MB with only two runtime dependencies — croner for cron expressions and msgpackr for binary serialization — making it dramatically lighter than traditional queue libraries that drag in Redis clients and their dependency trees.
The library offers two primary usage modes. In Simple Mode, a single Bunqueue object combines a Queue and Worker in one place — ideal for producers and consumers in the same process. In distributed scenarios, Queue and Worker can be used independently over a TCP transport, with a binary protocol that allows external processes or microservices to submit and consume jobs. The server boots with a full REST API and WebSocket dashboard out of the box.
bunqueue ships a native Model Context Protocol (MCP) server, meaning AI agents running in Claude, Cursor, or any MCP-compatible host can enqueue jobs, inspect queue state, manage cron schedules, and interact with the dead-letter queue using natural language — no code required. This makes bunqueue uniquely suited for agentic AI workflows where automated systems need to schedule and track background work.
The library includes an extensive set of production-grade features: five retry strategies (fixed, exponential, jitter, fibonacci, custom), a three-state circuit breaker, batch accumulation, job TTL, priority aging to prevent starvation, deduplication, debouncing, per-queue and per-group rate limiting, event triggers for chaining jobs, a dead-letter queue with auto-retry, cron scheduling with timezone support, S3-compatible backups (AWS, Cloudflare R2, MinIO), Prometheus metrics export, a built-in workflow engine with compensation (saga pattern), and TLS support for encrypted TCP connections.
Architecture
The codebase follows a layered domain-driven architecture with clear boundaries across src/domain/, src/application/, src/infrastructure/, and src/client/. The domain layer defines pure types for Job, CronJob, DlqEntry, and related concepts. The application layer hosts managers — queueManager, workerManager, dlqManager, eventsManager, stallDetection, webhookManager — each with a single bounded responsibility. The infrastructure layer provides the SQLite storage, S3 backup, TCP server, HTTP and WebSocket handlers, and the cron scheduler. The client layer (src/client/) exposes the user-facing Queue, Worker, and Bunqueue classes, plus the bunqueue/workflow sub-package, all of which speak to the infrastructure over the TCP protocol when in remote mode or directly when in embedded mode. The MCP server (src/mcp/) registers tool handlers by domain area — job tools, queue tools, cron tools, DLQ tools, monitoring tools — and wires them to the same application managers. This separation means every consumer path shares identical core logic.
Tech Stack
bunqueue runs exclusively on Bun (>= 1.3.9) and exploits Bun’s built-in APIs throughout: bun:sqlite for the SQLite persistence layer, Bun.connect / Bun.listen for the binary TCP transport, S3Client from the Bun standard library for S3 backups, and the Bun test runner for the test suite. Runtime dependencies are minimal: croner (v10) for POSIX cron parsing with timezone support, and msgpackr for MessagePack binary serialization which delivers roughly 2-3x faster encode/decode than JSON. The MCP server is an optional peer dependency via @modelcontextprotocol/sdk. Biome handles linting and formatting in place of ESLint and Prettier. The build pipeline uses tsc with a separate tsconfig.build.json and produces ESM output with .d.ts declarations.
Code Quality
bunqueue has an extensive test suite with hundreds of files covering unit tests, integration tests, audit-driven regression tests, bug-specific regression tests, and end-to-end scenarios. Each discovered bug gets its own bug-*.test.ts or repro-*.test.ts file, creating a living regression corpus. Core types are strongly typed throughout with generics for job data (Job<T>) and return values. Error handling is explicit — the SQLite layer exposes a onCriticalLoss callback for write-buffer failures, the TCP client surfaces typed errors, and the server protocol includes request IDs for correlation. Biome enforces consistent formatting and linting across the src/ tree, and CI runs on GitHub Actions. The codebase avoids any in critical paths and uses typed discriminated unions for job states and DLQ failure reasons.
What Makes It Unique
bunqueue targets a specific runtime niche — Bun-only — and uses that constraint productively: it leverages bun:sqlite instead of a third-party driver, Bun’s built-in S3Client instead of the AWS SDK, and Bun’s native TCP APIs instead of Node’s net module, achieving the minimal install size and fast cold-start that make it viable in serverless and agent contexts. The MCP server is the most distinctive feature: it exposes every queue operation as an AI-callable tool, letting LLM agents schedule, inspect, retry, and purge jobs through natural language without any integration code. The built-in workflow engine adds saga-pattern compensation, parallel fan-out steps, sub-workflow composition, and human-in-the-loop gates — features that typically require a dedicated orchestration service like Temporal — making bunqueue a self-contained alternative for agentic multi-step automation.
Licensing Model MIT licensed — all features available in self-hosted deployments with no restrictions or license keys required.
Self-Hosting Restrictions None. The core queue server, MCP server, workflow engine, S3 backup, TCP transport, and CLI are all MIT-licensed and fully available without any license key or paid plan.
Enterprise Features
bunqueue Cloud (bunqueue.io) is an optional hosted telemetry and remote dashboard service. Self-hosters can enable it by setting BUNQUEUE_CLOUD_URL and BUNQUEUE_CLOUD_API_KEY environment variables, which activates the CloudAgent telemetry module. There is no feature gate that restricts self-hosted functionality — Cloud adds a hosted monitoring UI on top of a fully functional self-hosted deployment.
License Key Required No. All features run without a license key in self-hosted mode.
No Code Platforms · AI Development · Developer Tools
Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.
Developer Tools · Game Development · Design Tools
Free, MIT-licensed 2D and 3D game engine with one-click multi-platform export and no royalties.
Developer Tools · Databases · Search
The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.