Skip to content

What is Durably?

Durably is a resumable job execution library for TypeScript. Split long-running tasks into steps — if interrupted, resume from the last successful step.

The Problem

Long-running tasks fail. Networks drop, servers restart, browsers close. Traditional approaches either:

  • Lose all progress and restart from scratch
  • Require complex infrastructure like Redis queues or cloud services

The Solution

Durably saves each step's result to the database (SQLite or PostgreSQL). On resume, completed steps return cached results instantly.

ts
const job = defineJob({
  name: 'import-csv',
  run: async (step, input) => {
    // Step 1: Parse (cached after first run)
    const rows = await step.run('parse', () => parseCSV(input.file))

    // Step 2: Import each row
    for (const [i, row] of rows.entries()) {
      await step.run(`import-${i}`, () => db.insert(row))
      step.progress(i + 1, rows.length)
    }

    return { count: rows.length }
  },
})

If the process crashes after importing 500 of 1000 rows, restart picks up at row 501.

Three Ways to Run

ModeStorageUse Case
ServerlibSQL, PostgreSQL, better-sqlite3Cron jobs, data pipelines, CLI tools
FullstackServer DB + SSE to browserWeb apps with real-time progress UI
SPASQLite WASM + OPFSOffline-capable, local-first apps

Same job definition works in all three modes.

When NOT to Use Durably

Durably is great for batch processing with step-level resumability. It's not the right tool for everything:

If you need...Use instead
Sub-second job dispatch (real-time messaging, webhooks)BullMQ, SQS, or a message broker
Hundreds of concurrent workers processing a massive queueTemporal, Inngest, or a dedicated workflow engine
Simple scheduled tasks (one cron job, no steps)Node.js cron (node-cron), OS crontab, or Vercel Cron
Stream processing (continuous event ingestion)Kafka, Redis Streams
Long-running single operation (no natural step boundaries)A plain async function with retry logic

Durably shines when your task has multiple discrete steps that are expensive to redo, and you want automatic resume without managing infrastructure.

Next Step

Quick Start — Run your first resumable job in under 2 minutes.

Released under the MIT License.