Effortless setup
With a simple declarative API to define and use your workflows.
Creating a workflow
import { sleep } from "workflow";import { createUser, sendWelcomeEmail, sendOneWeekCheckInEmail} from "./steps";export async function userSignup(email) { "use workflow"; // Create the user and send the welcome email const user = await createUser(email); await sendWelcomeEmail(email); // Pause for 7 days // without consuming any resources await sleep("7 days"); await sendOneWeekCheckInEmail(email); return { userId: user.id, status: "done" };}Defining steps
import { Resend } from 'resend';import { FatalError } from 'workflow';export async function sendWelcomeEmail(email) { "use step" const resend = new Resend('YOUR_API_KEY'); const resp = await resend.emails.send({ from: 'Acme <onboarding@resend.dev>', to: [email], subject: 'Welcome!', html: `Thanks for joining Acme.`, }); if (resp.error) { throw new FatalError(resp.error.message); }};// Other steps...