Workflows, jobs & cron

Durable workflows and background jobs.

Long-running, multi-step workflows with sleep, retries, and event waits that survive restarts — state is checkpointed on every step. Plus background jobs you enqueue with ctx.schedule and cron entries that live in the manifest, version-controlled with your code.

functions/onSignup.ts
import { workflow } from "@pylonsync/functions";

export default workflow({
  async handler(ctx, { userId }) {
    await ctx.step("welcome", () => sendEmail(userId, "welcome"));
    await ctx.sleep("3d");
    const active = await ctx.step("check", () => isActive(userId));
    if (!active) await ctx.step("nudge", () => sendEmail(userId, "comeback"));
  },
});
  • Durable workflows: sleep for days, wait for events, retry — survive deploys and crashes
  • State checkpointed to storage on every step; resume exactly where they left off
  • Background jobs via ctx.schedule — run work after the response is sent
  • Cron lives in the manifest, so the schedule is reviewed and versioned like code
01

Workflows that outlive the process

A workflow can sleep for three days, wait for a webhook, then continue — and a deploy or a crash in the middle doesn't lose its place. Each step is checkpointed, so on resume Pylon replays completed steps from their recorded results and picks up at the next one. It's part of the same runtime — nothing to run alongside.

02

Jobs after the response

Enqueue work with ctx.schedule to keep request latency low — send the email, transcode the upload, recompute the rollup after you've already returned to the user. Jobs run on the same server with the same database and policy context.

03

Cron as code

Scheduled jobs are declared in the manifest, so the cron expression sits in your repo, goes through review, and ships atomically with the function it triggers. No clicking schedules into a dashboard that drifts from the code.

Build it on Pylon.

One framework for your schema, sync, auth, functions, realtime, and SSR. Free to start.