Design a Task Execution Workflow (Zapier-like)

Hard45 min
1 / 31
System design answer

Design a Task Execution Workflow (Zapier-like)

Hard45 min31 sections
understanding•7 min read

Problem Statement: A Multi-Tenant Durable Execution Fabric Across Other People's APIs

Frames the product as a durable orchestrator whose hardest dependency is thousands of third-party APIs it does not control.

Problem statement

Design a platform where a non-technical user wires a trigger in one SaaS product to a sequence of actions in others: a new row in Google Sheets creates a Slack message, opens a Linear issue, and writes an audit row back to a warehouse. The user draws this in a visual builder, tests it against a sample payload, publishes it, and expects it to run for months without supervision.

The system is a durable execution engine with a hostile dependency surface. Our own compute is the easy part. The hard part is that every meaningful side effect happens inside someone else's rate-limited, occasionally broken, OAuth-gated API, and most of those side effects cannot be rolled back. A Slack message that was posted stays posted. A charge that was captured stays captured.

Why this is not a cron-plus-queue problem

Three properties break the naive design:

  1. Triggers are mostly pull, not push. Many SaaS products offer no webhook for the resource we need, so we poll. Polling millions of workflows naively is a self-inflicted denial of service against our partners.
  2. Runs are long-lived and stateful. A run may contain a filter that stops it, a branch, a loop over 200 line items, a delay of six days, and a human approval. State must survive deploys, region loss, and process death.
  3. Failure is the normal case. Assume low-single-digit percentages of steps fail transiently at all times. Retry, hold, replay, and compensate are product features with a UI, not exception paths.

The four planes

  • Authoring plane: visual builder, connector catalog, field mapping, sample-based testing, draft/publish, version pinning.
  • Trigger plane: poll scheduler with coalescing and cursors, webhook ingress with verification and dedup, subscription renewal.
  • Execution plane: durable run state machine, step queue, action workers, token vault, per-tenant and per-provider rate limiting, sandboxed transforms.
  • Trust plane: credential encryption, tenant isolation, payload retention and redaction, audit, replay evidence, cost accounting.

A strong answer keeps the authoring plane eventually consistent and cheap, and the execution plane durable and boring.

Key Highlights

  • •Most side effects are irreversible and executed in third-party APIs, so saga compensation replaces rollback and only where a reverse operation exists.
  • •Polling dominates trigger volume: coalescing identical poll requests is a first-class subsystem, not an optimization.
  • •Runs are long-lived stateful objects with delays, branches, and loops; they must survive deploys and region failover.
  • •Four planes: authoring, trigger, execution, trust. Failure handling and replay are user-visible product surfaces.
Name the Irreversibility Line Early
Say in the first two minutes that most actions cannot be undone, so the design uses an effect ledger plus optional compensation rather than a distributed transaction.
Do Not Open With 'Just Use a Queue'
A queue answers delivery, not durable multi-step state, per-tenant fairness, credential lifecycle, or partner quota exhaustion.

Section Rescue Kit

Buzzwords to use:

Durable ExecutionEffect Ledger

Safe statements:

  • "Let me separate the authoring experience from the execution engine, because they have different consistency and latency needs."
  • "I will treat every third-party call as an irreversible side effect until the connector declares a reverse operation."
Design a Task Execution Workflow (Zapier-like) - System Design | WinJob | WinJob