← Back to list

Designing an Event-Driven Node.js Backend for Batch Image Processing and Client Notifications

Came across a situation where users can upload large batches of images at once from a mobile app. While uploading files to cloud storage is…

Hamzeen Hameem · 2026-05-19 09:36 · 0 claps · 1.7 min read
#nodejs #server-sent-events #event-driven-architecture #batch-processing #pub-sub
Open on Medium ↗
Wiki topics: RAG · RAG & Retrieval 🌐 · Web Development 📱 · Mobile Development 🏛️ · Architecture

Designing an Event-Driven Node.js Backend for Batch Image Processing and Client Notifications

Came across a situation where users can upload large batches of images at once from a mobile app. While uploading files to cloud storage is relatively straightforward, the real challenge begins afterward: asynchronously processing each image while keeping the system scalable & responsive. A classic example of an event-driven backend architecture.

Here’s an illustration of the high-level architecture of the solution:

Assume an Angular app uploads a batch of images to a Node.js backend. The backend immediately stores the files in blob storage, creates a batch record in the database, and enqueues one processing job per image. Instead of processing images within the request lifecycle, the work is delegated to background workers through a queue.

This keeps the API responsive while enabling image processing to scale independently through worker pools.

Each worker independently:

  • downloads an image from blob storage,
  • runs image processing algorithms,
  • updates image status in the database,
  • and reports progress back to the batch.

Once all images in the batch are processed, the system enters a completion orchestration phase.

At this stage:

  1. the batch is marked as COMPLETED,
  2. an email notification is sent to the user,
  3. and a completion event is published through an internal Pub/Sub channel.

The Pub/Sub layer decouples workers from the API server. Workers simply emit events such as BATCH_COMPLETED, while the API server subscribes to these events and pushes one-way real-time updates to connected clients using Server-Sent Events (SSE).

This creates a clean event-driven architecture where:

  • background processing scales independently,
  • side effects such as email notifications remain asynchronous,
  • and frontend clients receive lightweight real-time updates immediately after batch completion.

Curious about Server Sent Events (SSE)?

here is a simple example.


메타데이터
post_id
0a0cd2d84ec2
slug
designing-an-event-driven-node-js-backend-for-batch-image-processing-and-client-notifications-0a0cd2d84ec2
url
https://medium.com/@hamzeen/designing-an-event-driven-node-js-backend-for-batch-image-processing-and-client-notifications-0a0cd2d84ec2
canonical_url
https://medium.com/@hamzeen/designing-an-event-driven-node-js-backend-for-batch-image-processing-and-client-notifications-0a0cd2d84ec2
author_url
https://medium.com/@hamzeen
status
ok
fetched_at
2026-06-09 15:37:30