Professional Project

Automated Billing Engine

An automated multi-channel collection engine that recovers revenue at scale through intelligent rule-based triggers and pluggable delivery drivers.

Clube Certo
2025
Node.js / MySQL

Overview

Companies using the Clube Certo platform needed a way to automatically recover overdue payments without manual intervention. I built an end-to-end billing collection engine that processes thousands of invoices hourly, triggering multi-channel outreach through configurable rule-based schedules.

The system supports pluggable delivery drivers (email, WhatsApp, SMS), allowing each company to customize their collection strategy while the engine handles batching, rate limiting, and failure recovery automatically.

Architecture

CRON Scheduler
Invoice Filter
Rule Engine
D+3, D+7, D+15
Channel Router
Drivers
Email / WA / SMS

Key Features

Rule-Based Triggers
Configurable schedules (D+3, D+7, D+15, etc.) with weekend skipping, amount range filters, and company-specific overrides.
Multi-Channel Delivery
Pluggable driver architecture for email, WhatsApp, and SMS. Each channel has independent rate limiting and retry logic.
Email Pixel Tracking
Unique UUID-based tracking pixels embedded in emails for open detection, feeding analytics back into the collection pipeline.
SMTP Rate Limiting
Connection pooling with 1 email per 3 seconds throttling to prevent blacklisting while maintaining high throughput.
Atomic Transactions
Each collection attempt is logged atomically with full retry-on-failure, ensuring no invoice is double-contacted or missed.
Test Mode
Safe staging rollout with a test mode that simulates the full pipeline without sending real messages or modifying data.

Challenges & Solutions

  • Scale: Processing thousands of invoices per batch required careful query optimization with status indexing and pagination to prevent memory issues.
  • Deliverability: Email providers have strict rate limits. Implemented connection pooling with configurable throttling and automatic IP rotation awareness.
  • Reliability: CRON jobs can fail mid-batch. Designed idempotent processing with checkpoint tracking so jobs can safely resume from where they stopped.
  • Multi-tenancy: Each company has unique collection rules. Built a configuration layer that isolates company settings while sharing the core engine.

Tech Stack

Node.js TypeScript MySQL CRON SMTP / Nodemailer WhatsApp Business API State Machine Pattern Redis (Rate Limiting)

Want to see more of my work?

All Projects