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 SQLite. On resume, completed steps return cached results instantly.

Resumability

ts
const job = defineJob({
  name: 'import-csv',
  run: async (step, payload) => {
    // Step 1: Parse (cached after first run)
    const rows = await step.run('parse', () => parseCSV(payload.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.

Where It Runs

EnvironmentStorageUse Case
Node.js@libsql/client, better-sqlite3Server-side batch jobs
BrowserSQLite WASM + OPFSOffline-capable apps

Same job definition works in both environments.

Next Step

Getting Started → — Build a CSV importer with progress UI in 5 minutes.

Released under the MIT License.