Back to projects
In ProductionBackend Engineer · 2025 — Present

WB Connector

WhatsApp Connection Service

A dedicated NestJS service that holds the live WhatsApp session and forwards every inbound message to the platform over webhooks. It exists so the messaging connection can crash, restart or scale on its own without ever taking the main application down with it.

WB Connector

The Problem

Holding a live messaging connection inside the main application makes the whole system fragile. A dropped socket, a restart or a deploy takes messaging down with it, and every restart used to require scanning a QR code again, which is not acceptable for a business running on it.

Architecture & Approach

  • Standalone NestJS service that owns the WhatsApp connection and nothing else, so it can be restarted independently of the main platform
  • Session state persisted so a restart or redeploy reconnects on its own and never asks for a new QR scan
  • Automatic reconnection with backoff when the connection drops, rather than silently going offline
  • Inbound messages, media and voice notes forwarded to the platform through signed webhooks
  • Media pipeline that downloads within the short-lived link window and stores files before they expire
  • Multiple numbers on a single instance, each with isolated session state

Tech Stack

NestJSNode.jsTypeScriptBaileysWebhooksRedisDocker

Results

  • Messaging stays up independently of the main application
  • Restarts and deploys reconnect automatically with no QR rescan
  • Handles text, media, documents and voice notes end to end
  • Runs multiple business numbers on one instance