TanStack
TanStack

Workflow

alpha

Write an async function that can outlive its process.

TanStack Workflow records durable execution around ordinary TypeScript so steps, retries, sleeps, signals, and approvals can continue after a worker disappears.

Docs
durable execution log

run

order-4832

waiting
1

reserve inventory

completed

2

manager approval

waiting

3

release fulfillment

queued

append-only history

  1. 01

    run.started

    order-4832

  2. 02

    step.completed

    reserve-inventory

  3. 03

    approval.requested

    manager-approval

order-workflow.ts

export async function fulfillOrder(input, ctx) {

  const reservation = await ctx.step(

    'reserve-inventory', () => reserve(input)

  )

  const approval = await ctx.approve({

     title: 'Release fulfillment?'

  })

  return ctx.step(

    'release-fulfillment', () => release(reservation, approval)

  )

}

Stable IDs let replay match recorded work to the same boundaries.

Code is the process

Control flow stays in plain async TypeScript.

Conditionals, loops, variables, and errors remain language features. The workflow context adds durable boundaries only where time, retries, side effects, or external input need to survive beyond the current process.

Time and outside input

Waiting is a stored state, not a worker doing nothing.

A workflow can sleep until later, wait for an external event, or request human approval. Host-delivered signal IDs make retries idempotent, while recorded time and UUID primitives keep decisions deterministic when the function runs again.

durable wait state
await ctx.sleep(3 * DAY)

history record

wakeAt · replay-safe timestamp

worker

free to stop while waiting

Durability boundary

Bring the runtime and store that fit your application.

The workflow definition is application code. A runtime adapter executes it, and a durable store preserves the append-only history needed for recovery. Current runtimes and adapters are experimental, so deployment and version routing remain explicit choices.

Workflow definition

Versioned TypeScript and stable step IDs

Runtime adapter

Executes, schedules, retries, and receives signals

Durable store

Persists history outside the worker process

Replay skips recorded steps. It does not make arbitrary external side effects exactly once; use idempotent boundaries.

Route existing runs to compatible workflow versions when definitions evolve.

Partners

Gold
CodeRabbit
Cloudflare
Railway
Netlify
Lovable
Silver
OpenRouter
SerpApi
WorkOS
AG Grid
Clerk
Bronze
Sentry
Unkey
Electric
Prisma
OSS Sponsors

Sponsors get special perks like private discord channels, priority issue requests, and direct support!