← All Projects
Post-Apply Lead Routing Engine
Node.jsExpressMongoDBMochaSvelteKit

Post-Apply Lead Routing Engine

Most routing systems are a flag and a coin flip. This one needed to be sticky, auditable, weighted, and safe to roll back across clients with different configurations running in production simultaneously.

I designed the full architecture: a flow registry plus a weighted-bucket router, where a single roll per lead assigns it to a flow using cumulative percentage buckets, with legacy filling whatever's left over. In practice that meant a 20/80 split, sending a fifth of leads to a new, optionally customizable flow while legacy held the rest as the comparison baseline. The registry was built so adding the next flow is a one-line entry, not a new system. Per-client feature flags let the business enable or disable the experiment independently for each account without a deploy. A migration script handled backfilling existing records cleanly, and the admin UI gave non-engineers visibility into routing state and performance (click-through rate, full-app applies) without needing to touch the database.

This wasn't a shadow deployment: once a lead rolled into a custom flow, a listener actively suppressed the legacy flow for that lead, so the split had a real, immediate effect on production traffic. The safety came from the engineering around that change, not from the change being inert: server-side validation rejected any client config whose enabled-flow weights exceeded 100%, sticky assignment meant a lead's flow was locked in once decided, and the per-client feature flag was a one-line, no-deploy rollback if a client's numbers looked wrong. A 37-case Mocha spec suite covered assignment math, stickiness, flag evaluation, and config validation before any of it touched real leads. This is the kind of system design work I'm drawn to: a real behavioral change, made safe by the guardrails around it rather than by avoiding the change.