Vercel Logo

Workflow Foundations

Learn the foundations of the Workflow SDK by building a pizza order tracker. Durable, resumable code with two directives and no state machines.

You've built it before. A signup flow that needs to send an email today and a follow-up next week. An order tracker that has to wait for the kitchen, then the driver, then a delivery confirmation. You reach for setTimeout, then realize serverless kills your function. You build a cron job. You add a database table to track state. You write retry logic.

Three days later you have a brittle pile of code that breaks every time you deploy.

This course teaches you how to build that same feature with the Workflow SDK: durable, resumable code that survives deploys, retries automatically, and waits for hours or days without consuming a single millisecond of compute. No new DSL. No state machines. Just async TypeScript with two new directives.

What You'll Build

A pizza order tracker. A customer places an order, a workflow walks it through the kitchen and the driver via real webhooks, retries flaky steps automatically, escalates if the kitchen goes dark, and sends a "rate your pizza" email after delivery. By the end you'll have a working app deployed to Vercel with real Resend emails firing and the real Workflows dashboard showing every run.

What You'll Learn

  • Why durable workflows exist and when to reach for one
  • The two directives that turn regular async functions into durable workflows
  • How to sequence steps, pause for hours or days, and survive deploys mid-execution
  • How to wait on real-world events with hooks
  • How retries work and how to opt out for fatal errors
  • How to debug workflows in the Vercel dashboard

Prerequisites

  • Comfort with Next.js App Router (Route Handlers, Server Components, basic Server Actions)
  • TypeScript basics (async/await, type annotations)
  • A Vercel account
  • A Resend account (free tier is fine)
  • Node 20+ and pnpm installed

You don't need prior experience with queues, cron jobs, or state machines. If anything, the less of that you've used, the easier this will be.

Course Sections

Section 1: Your First Workflow. Set up the pizza tracker, write your first step and workflow, and deploy. By the end of this section you've shipped a one-step workflow to Vercel and watched it run in the dashboard.

Section 2: Multi-Step Orders. Stack on more steps and introduce sleep() to model cook time. Deploy a code change mid-workflow and watch it survive. By the end of this section the tracker walks an order through every state from confirmed to delivered.

Section 3: Waiting for the Real World. Replace the fake sleeps with real external events. Hooks let the workflow pause until the kitchen or driver actually pings us. By the end the workflow is fully event-driven and handles an unresponsive kitchen gracefully.

Section 4: When Things Go Wrong. Production isn't kind. Steps fail, services flake, payments decline. This section walks through automatic retries, fatal errors, and the dashboard tools that make production debugging livable.

Let's order a pizza.