Prerequisites
Before installing BullMQ, ensure you have:- Node.js 16.x or higher
- Redis 6.2.0 or higher (Redis 7+ recommended)
Install BullMQ
Choose your preferred package manager:@types package is needed.
Install Redis
If you don’t have Redis installed yet, you have several options:Using Docker
The easiest way to get Redis running locally:Using Docker Compose
Create adocker-compose.yml file:
The
maxmemory-policy noeviction setting is important to prevent Redis from automatically removing keys, which would cause unexpected errors in BullMQ.System Package Manager
Cloud Redis Providers
For production environments, consider managed Redis services:- AWS - ElastiCache or MemoryDB
- Google Cloud - Memorystore
- Azure - Azure Cache for Redis
- Upstash - Serverless Redis
- Redis Cloud - Official Redis hosting
Redis Configuration
For optimal BullMQ performance, configure your Redis instance with these settings:Verify Installation
Create a simple test file to verify your installation:test.ts
Alternative Redis Implementations
BullMQ is compatible with Redis-compatible databases:Dragonfly
Dragonfly is a drop-in Redis replacement that offers:- Massive performance improvements by utilizing all CPU cores
- More efficient memory usage
- Full BullMQ compatibility
Valkey
Valkey is an open-source Redis fork that is fully compatible with BullMQ.IoRedis Dependency
BullMQ uses ioredis as its Redis client. This is installed automatically as a dependency. You can also install it explicitly if you want to manage Redis connections yourself:TypeScript Support
BullMQ is written in TypeScript and includes type definitions. For the best development experience:- Use TypeScript 4.5 or higher
- Enable
strictmode in yourtsconfig.json - Consider enabling
esModuleInteropfor easier imports
tsconfig.json
Next Steps
Quick Start
Create your first queue and worker
Architecture
Learn how BullMQ works internally
