{"id":51076936,"url":"https://github.com/tanstack/workflow","last_synced_at":"2026-06-23T15:01:57.133Z","repository":{"id":361061995,"uuid":"1244814127","full_name":"TanStack/workflow","owner":"TanStack","description":"🤖 Type-safe durable execution for agents and workflows. Resumable runs, append-only history, and compensable steps for TS/JS, React, Solid, Vue, and Svelte.","archived":false,"fork":false,"pushed_at":"2026-05-30T23:18:24.000Z","size":774,"stargazers_count":175,"open_issues_count":4,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T08:27:00.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TanStack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"tannerlinsley"}},"created_at":"2026-05-20T16:13:14.000Z","updated_at":"2026-06-17T18:14:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/TanStack/workflow","commit_stats":null,"previous_names":["tanstack/workflow"],"tags_count":2,"template":false,"template_full_name":"TanStack/template","purl":"pkg:github/TanStack/workflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TanStack%2Fworkflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TanStack%2Fworkflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TanStack%2Fworkflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TanStack%2Fworkflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TanStack","download_url":"https://codeload.github.com/TanStack/workflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TanStack%2Fworkflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34694786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-23T15:01:55.154Z","updated_at":"2026-06-23T15:01:57.128Z","avatar_url":"https://github.com/TanStack.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tannerlinsley"],"categories":[],"sub_categories":[],"readme":"# TanStack Workflow\n\nType-safe durable execution for TypeScript. Workflows are ordinary async functions that can pause, persist progress to an append-only log, and resume after approvals, webhooks, timers, or process restarts.\n\n```bash\npnpm add @tanstack/workflow-core\n```\n\nInstall `zod` or another Standard Schema-compatible library if you want runtime validation for workflow inputs, outputs, state, or signal payloads.\n\n## Example\n\n```ts\nimport {\n  createWorkflow,\n  inMemoryRunStore,\n  runWorkflow,\n} from '@tanstack/workflow-core'\nimport { z } from 'zod'\n\nconst checkout = createWorkflow({\n  id: 'checkout',\n  input: z.object({ userId: z.string(), amount: z.number() }),\n  output: z.object({ status: z.enum(['approved', 'rejected']) }),\n}).handler(async (ctx) =\u003e {\n  const charge = await ctx.step('charge-card', (stepCtx) =\u003e\n    stripe.charges.create(\n      { customer: ctx.input.userId, amount: ctx.input.amount },\n      { idempotencyKey: stepCtx.id },\n    ),\n  )\n\n  if (ctx.input.amount \u003e 10_000) {\n    const decision = await ctx.approve({ title: 'Approve large charge?' })\n    if (!decision.approved) return { status: 'rejected' as const }\n  }\n\n  await ctx.step('send-receipt', () =\u003e sendReceipt(charge.id))\n  return { status: 'approved' as const }\n})\n\nconst store = inMemoryRunStore()\n\nfor await (const event of runWorkflow({\n  workflow: checkout,\n  input: { userId: 'cus_123', amount: 4200 },\n  runStore: store,\n})) {\n  console.log(event.type, event)\n}\n```\n\n## Core Ideas\n\n- Side effects live inside `ctx.step(id, fn)`, which records results and skips re-execution on replay.\n- `ctx.waitForEvent`, `ctx.approve`, `ctx.sleep`, and `ctx.sleepUntil` pause runs until the host delivers a matching signal or approval.\n- `ctx.now()` and `ctx.uuid()` record deterministic values for replay.\n- Middleware can extend `ctx` with typed dependencies such as users, database handles, or tracing.\n- Storage is pluggable through `RunStore`; the package ships an in-memory store for local development and tests.\n\n## Packages\n\n- `@tanstack/workflow-core`: engine, workflow builder, middleware, event types, request parsing helpers, version routing, and in-memory `RunStore`.\n- `@tanstack/workflow-runtime`: registered workflows, durable execution store contract, timers, schedules, leases, signals, approvals, and bounded sweeps.\n- `@tanstack/workflow-store-drizzle-postgres`: Drizzle/Postgres implementation of the runtime execution store.\n- `@tanstack/workflow-vercel`: Vercel route handler and cron config helper for runtime sweeps.\n- `@tanstack/workflow-netlify`: Netlify Scheduled Function handler and config helper for runtime sweeps.\n\nFramework bindings and devtools are planned as follow-up packages.\n\n## Development\n\n```bash\npnpm install\npnpm --filter @tanstack/workflow-core test:lib\npnpm --filter @tanstack/workflow-core test:types\npnpm --filter @tanstack/workflow-core build\npnpm test\n```\n\n## Docs\n\n- [Overview](./docs/overview.md)\n- [Comparison](./docs/comparison.md)\n- [Installation](./docs/installation.md)\n- [Quick start](./docs/quick-start.md)\n- [Guide](./docs/guide/index.md)\n- [Cookbook](./docs/cookbook/index.md)\n- [API reference](./docs/api/index.md)\n- [Primitives](./docs/concepts/primitives.md)\n- [Replay and resume](./docs/concepts/replay-and-resume.md)\n- [Scheduling](./docs/concepts/scheduling.md)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanstack%2Fworkflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanstack%2Fworkflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanstack%2Fworkflow/lists"}