A scalable, asynchronous image processing system built using Node.js, Express, BullMQ, Redis, MongoDB, and Sharp.
This project demonstrates a distributed task queue architecture where image uploads are handled via a REST API and processed in the background by a worker service.
- Node.js + Express — REST API for image upload and status
- BullMQ + Redis — Background job queue and task processing
- MongoDB — Track job state (
queued,in-progress,completed,failed) - Sharp — High-performance image resizing
- Multer — Handle image uploads
- ESM Modules — Clean modular structure using
type: module
- Upload image via API
- Queue processing via Redis (non-blocking, async)
- Background worker resizes the image
- Real-time job status tracking via MongoDB
- Easily scalable by adding more workers
┌────────────────────┐
| Client (UI) |
└────────┬───────────┘
│
Upload image │
▼
┌────────────────────┐
| Express API Server |
└────────┬───────────┘
│
Enqueue Job ▼
┌────────────────────┐
│ Redis Queue |
└────────┬───────────┘
│
Consume Job ▼
┌────────────────────┐
│ Worker Instance │
│ (Sharp) |
└────────┬───────────┘
│
Update Status ▼
┌────────────────────┐
│ MongoDB │
└────────────────────┘
- Clone the repository
- Run
npm iin the terminal - Add your own .env file
- Run the redis server:
sudo service redis-server start - Run on terminal:
npm start - Run on another terminal
node workers/imageWorkers.js
POST http://localhost:9300/job/upload-image :
Headers: multipart/form-data
Body: (key:image), file, value: input your image
GET http://localhost:9300/job/status/<jobId>