Multi-tenant event processor
Replaced a Make.com scenario with a queue-backed TypeScript processor that turns AccuLynx webhooks into HubSpot records for every location, cut over behind a shadow run and a canary.
Data paths and guards
- HubSpot: Contacts and deals for every location and brand.
- Slack alerts: Health alerts from a monitor that runs every 5 minutes.
- Edge gateway: A Cloudflare Worker in front of the old scenario: it mirrored traffic, then flipped its route.
- Event processor: Ingress, cron worker, 15-topic router and health monitor, in TypeScript on Vercel.
- Event queue: Postgres queue with claims, dead letters and an event log, on Supabase.
- Make.com scenario: The old scenario: shadowed, then switched off on cutover day.
- AccuLynx, each location: Jobs and contacts for each location, and the webhooks that announce changes.
- From AccuLynx, each location to Edge gateway: Via the edge gateway. Job and contact events from the locations whose webhooks pass through the Worker. A change in AccuLynx.
- From AccuLynx, each location to Event processor: Direct subscriptions. Job and contact events from the subscriptions re-registered to post straight to the ingress. A change in AccuLynx.
- From Event processor to Event queue: Queued, claimed, logged. Each deduped event, its claims and retries, dead letters and the event log. Each webhook, and a worker run every minute.
- From Event processor to HubSpot: Contacts and deals. Contacts and deals created or updated from a fresh read of the AccuLynx record. Each claimed event, routed by its topic.
- From Event processor to Slack alerts: Health alerts. Unreplayed dead letters, a queue backlog, stuck claims or too few active connections. The monitor, every 5 minutes, finds a problem.
- From Edge gateway to Make.com scenario: Old route, off at cutover. Each event, as before, until the route flip on cutover day. Every event before the flip.
- From Edge gateway to Event processor: Mirrored, then the only route. A copy of each event during the shadow run, then every event after the flip. Shadow mode, then the route flip.
- On Direct subscriptions: 503 until it is queued. If the queue write fails, the ingress answers 503, so AccuLynx sends the event again.
- On Event queue: Claims, backoff, dead letters. Workers claim rows with SKIP LOCKED; a failure backs off and retries, and repeat failures go to dead letters with a bounded replay.
- On Contacts and deals: Upserts by AccuLynx id. Deals are upserted on an AccuLynx job id property, so a repeated event updates the record instead of making another.
- On Mirrored, then the only route: Shadow run, then a canary. Live traffic was mirrored to the processor first; then a replay of 205 real jobs passed, and 8 companies ran on it alone before the flip.
- On Event queue: Refuses the retired database. The config needs one database address and refuses to start against the retired host.
- Built by me
- Platforms I connect to
- Guards
- Data paths
- In production
| Via the edge gateway Job and contact events from the locations whose webhooks pass through the Worker |
|---|
| Direct subscriptions Job and contact events from the subscriptions re-registered to post straight to the ingress |
| Queued, claimed, logged Each deduped event, its claims and retries, dead letters and the event log |
| Contacts and deals Contacts and deals created or updated from a fresh read of the AccuLynx record |
| Health alerts Unreplayed dead letters, a queue backlog, stuck claims or too few active connections |
| Old route, off at cutover Each event, as before, until the route flip on cutover day |
|---|
| Mirrored, then the only route A copy of each event during the shadow run, then every event after the flip |
-
Systems
Each location runs its own AccuLynx account, and the company works in HubSpot. The old Make.com scenario sat behind a Cloudflare Worker. Its replacement is a TypeScript processor on Vercel, with a Postgres queue on Supabase and health alerts in Slack.
-
Data paths
AccuLynx sends job and contact webhooks, most through the Worker and the rest directly. The ingress dedupes and queues each event, and a worker claims it, routes it by topic and upserts contacts and deals in HubSpot. A monitor checks the queue every 5 minutes and alerts in Slack.
- a Via the edge gateway
- b Direct subscriptions
- c Queued, claimed, logged
- d Contacts and deals
- e Health alerts
-
Cutover
The Worker mirrored live traffic to the processor while Make kept writing. A replay of 205 real jobs passed with 0 dead letters, 8 companies ran on the processor alone, and on June 20 the route flipped and Make was switched off.
- f Old route, off at cutover
- g Mirrored, then the only route
-
Guards
A failed queue write answers 503, so AccuLynx sends the event again. Claims, backoff and dead letters keep every event. Upserts by AccuLynx id stop duplicates, the canary checked values before the flip, and the config refuses the retired database.
- 503 until it is queued on b
- Claims, backoff, dead letters on Queue
- Upserts by AccuLynx id on d
- Shadow run, then a canary on g
- Refuses the retired database on Queue
-
Result
Every location moved off Make.com. In the 7 days to July 7, 10,630 events were done, at a 1.5-second median over a 48-hour sample.
One no-code scenario for every location, with no view of failures
The inherited connector ran every AccuLynx location through one Make.com scenario. It matched contacts by email, had consumed 441K+ operations, shared one HubSpot search rate ceiling across every location, and had no retries and no view of what failed.
What I built
- Changes to the inherited scenario first: contacts matched on the AccuLynx id instead of email, edits through the Make API with a backup before each, and webhook subscriptions registered for every active location.
- A checkpointed migration that moved 13,953 deals onto 11,713 new per-customer contacts, then backfills with revert logs.
- An ingress on Vercel that checks a shared secret, dedupes, queues and returns 200 at once, or 503 when the queue write fails, so AccuLynx sends the event again.
- A Postgres queue with SKIP LOCKED claims, backoff, stale-lock reclaim, dead letters and bounded replay, drained by a cron worker with a 250-second budget.
- A 15-topic router that finds each location’s credentials by its AccuLynx subscription id and upserts HubSpot records by id, plus a monitor that alerts in Slack.
- Later, an identity guard that matches names with room for nicknames, typos and married names before it lets a contact be renamed.
What the guards protect against
| The risk | The guard |
|---|---|
| An event is acknowledged but never stored. | 503 until it is queued If the queue write fails, the ingress answers 503, so AccuLynx sends the event again. |
| Two workers take the same event, or a failed one is dropped. | Claims, backoff, dead letters Workers claim rows with SKIP LOCKED; a failure backs off and retries, and repeat failures go to dead letters with a bounded replay. |
| A retried or repeated event creates a duplicate deal. | Upserts by AccuLynx id Deals are upserted on an AccuLynx job id property, so a repeated event updates the record instead of making another. |
| The new path raises no errors but writes the wrong values. | Shadow run, then a canary Live traffic was mirrored to the processor first; then a replay of 205 real jobs passed, and 8 companies ran on it alone before the flip. |
| Stale settings send writes to a frozen copy while health checks stay green. | Refuses the retired database The config needs one database address and refuses to start against the retired host. |
Decisions
-
Replace the scenario instead of extending it
- Chose
- A multi-tenant TypeScript processor on Vercel with a Postgres queue, built to take over everything the Make.com scenario did.
- Instead of
- Keep extending the Make.com scenario. One scenario shared one HubSpot search rate ceiling across every location, and it had no retries and no dead-letter view.
- Trade-off
- Every behavior of a 140-module scenario had to be ported and proven, checked by a diff against the live scenario before cutover.
-
Flip the route at the edge, since one account was out of reach
- Chose
- Mirror live traffic through the Cloudflare Worker that already sat in front of Make, then flip its route, with an instant way back.
- Instead of
- Re-pointing every AccuLynx webhook subscription. There was no access to one tenant’s AccuLynx account, so its webhooks could not be re-pointed.
- Trade-off
- Some subscriptions posted straight to Make, past the Worker, so they were re-registered alongside the old ones and both paths ran until they converged on the same HubSpot ids.
-
Prove the values with a canary, not only the shadow run
- Chose
- After the shadow run, 8 companies ran on the new processor alone, and the canary came through clean at 164 of 164.
- Instead of
- Cutting over on the shadow run alone. A shadow run shows that the new path raises no errors, not that the values it writes are right.
- Trade-off
- For those 8 companies Make was paused, so the new processor was their only writer before the flip.
Results
- Every AccuLynx location cut over, most through the edge gateway and the rest re-registered to post directly.
- Before the flip, 205 of 205 real jobs replayed with 0 dead letters, and an 8-company canary came through clean.
- 10,630 events done in the 7 days to July 7, at a 1.5-second median over a 48-hour sample.
Kept from this build: a scheduled job is proven only by its own schedule, so the replay cron was tested by letting its schedule replay a test dead letter.
Facts
- Session advisory locks proved unsafe through the pooler, so enum self-heal takes transaction locks
- Rep names backfilled onto 179,267 of 196,292 deals, 91.3% coverage
- Brands backfilled onto 24,735 deals and 17,303 contacts
- Before cutover, 8 of 8 malformed inputs were handled with 0 dead letters
- A failed health check also fails the Vercel cron, so an alert never rests on Slack alone
Related builds
-
Two-way field-service sync
Date: Feb 2026
Fact: 11,683 deals and 8,182 tickets in a two-way sync
Client: For a commercial roofing service contractor
Systems: CenterPoint Connect, Zapier, QuickBooks Online and Make.com
Status: In production
-
Two-way ERP sync
Date: Aug 2026
Fact: 11,598 deals linked to the ERP
Client: For a commercial roofing contractor
Systems: Dataforma
Status: In production
-
Multi-tenant booking platform
Date: Apr 2026
Fact: 4 live tenants, 21 of 21 production smoke checks on each
Client: For four roofing contractors
Systems: Zuper, Demand IQ and n8n
Status: In production