Workflows, jobs & cron

Durable workflows and background jobs.

Long-running workflows can sleep, retry, and wait for events across restarts because Pylon checkpoints every step. Enqueue background jobs with ctx.schedule and version cron entries in the manifest 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, and retry across 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

How it works.

durable workflow
welcomestep
wait 3dresumable
checkActiverecorded
nudgenext
checkpoint saved after every step

A workflow can sleep for three days, wait for a webhook, then continue after a deploy or crash. Pylon checkpoints each step, replays completed steps from their recorded results, and resumes at the next one. The workflow runs in the same runtime as your app.

What you’d otherwise wire up.

Each line is a piece teams normally assemble for this one capability. On Pylon it is part of the runtime.

  • A queue broker and the worker fleet that drains it
  • A cron host living separately from the app it triggers
  • Retry, backoff, and idempotency logic written by hand
  • A dead-letter store that someone has to remember to check

Apps built with it.

Scaffold any of these with npm create @pylonsync/pylon.

All examples →
Local service

An appointment business with services, booking, live slot availability, and an owner dashboard.

Live bookingSchedulingOwner dashboard
template: local-service
AI studio

Generate images, audio, and video with Replicate. A live gallery fills in as each background job finishes.

Background jobsLive galleryReplicate
template: ai-studio

Build it on Pylon.

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