Back to projects

2025 · In production · Contract

InboundSelect

Multi-tenant pay-per-call operations platform

Lead Backend Engineer · sole architect

Tenancy
Multi-tenant
Billing tiers
3
DB migrations
100+
Routing
Real-time

The problem

Agencies buying inbound phone leads had no system to route live calls to the right available agent, bill fairly per call, isolate money across tenants, and prove which ad campaigns actually drove revenue. They needed an operations platform that did all of it in real time, for many agencies at once.

My approach

I designed a three-tier model — Platform → Agency (IMO) → Agent — where the org tree governs visibility only, while money always flows directly to the agency's Stripe Connected Account via an immutable imo_root_id. This cleanly separates hierarchy from money flow and makes tenant isolation a property of the schema, not of application checks scattered everywhere.

Architecture

A Node/Express backend pairs with Socket.IO for real-time dispatch. A Twilio inbound webhook creates a call session, an eligibility engine (availability + admin approval + active subscription + tenant scope) selects agents, and the call is offered to their dashboards live; on accept, TwiML bridges the call and billing runs on completion. Billing is three-tier: agent wallet debit (acceptance-plan based), agency connection fee, and a marketplace fee on resold calls. Bull + Redis run the nightly pipelines (CSV invoicing, marketplace-fee Stripe retries, Google-Ads aggregation, stuck-call cleanup) with an in-process fallback when Redis is absent. A PostgreSQL closure table powers O(1) hierarchy visibility, and a read-only Google Ads sync joins campaign spend to calls by UTM to compute true ROI.

Highlights

  • Real-time eligibility-based call routing over Twilio + Socket.IO with tenant-scoped rooms.
  • Multi-tenant billing & payouts on Stripe Connect with per-agency financial isolation.
  • Three-tier charge model: agent wallet, agency connection fee, marketplace resale fee.
  • Bull + Redis nightly jobs: invoicing, reconciliation, recovery, ads aggregation — with graceful fallback.
  • Google Ads ↔ Twilio attribution joining ad spend to calls for live campaign ROI.
  • PostgreSQL closure-table hierarchy for O(1) ancestor/descendant visibility queries.
  • AWS SES email infra with suppression-list handling to protect sender reputation.

Tech stack

Backend

Node.jsExpress 5Socket.IO

Telephony / Payments

TwilioStripe Connect

Jobs / Cache

BullRedis (ioredis)

Data

PostgreSQLclosure tables100+ migrations

Cloud

AWS SESGoogle Ads APIRailwayVercel

Frontend

React 19ViteTanStack QueryRecharts