npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

resumable-workflow

v1.4.0

Published

A lightweight, persistent workflow engine for Node.js. Ensure multi-step processes survive crashes and resume automatically.

Readme

Resumable Workflow

A lightweight, framework-agnostic Node.js library to ensure multi-step processes survive server crashes. It uses a declarative functional API and checkpoints progress to persistent storage after every step.

Features

  • Checkpointing: Automatically saves state after each successful step.
  • Resumable: Easily resume failed or interrupted runs by ID.
  • Result Pattern: Returns descriptive objects instead of throwing errors for better control and performance.
  • Auto-Resume: Optional background resumption of incomplete tasks on startup.
  • Auto-Cleanup: Optional automatic deletion of run data upon successful completion.
  • Pluggable Storage: Default file-system storage included, with interfaces for Redis or SQL.

Architecture

The library is split into three main parts:

  1. The Engine (src/core): Manages the execution loop and ensures that steps are called in order.
  2. Storage Providers (src/storage): Handles the physical saving and loading of the workflow state.
  3. Types (src/types): Provides strict generic support so your input and output data are always type-safe.

Installation

pnpm add resumable-workflow

Usage

1. Define and Start a Workflow

import { createWorkflow } from 'resumable-workflow';

const onboarding = createWorkflow({
  id: 'user-onboarding',
  autoCleanup: true, // Optional: Automatically delete data after success
  steps: [
    {
      name: 'create-user',
      run: async ({ input }) => {
        // Logic to create user
        return { userId: '123' }; // Merged into state
      }
    },
// ...
  ]
});

// ...

2. Manual Cleanup

You can also manually clear all completed runs for a workflow:

await onboarding.clearCompleted();

3. Resume a Failed Run

{
  name: 'send-welcome-email',
  run: async ({ state }) => {
    // Access state.userId from previous step
    await mailer.send(state.userId);
    return { emailSent: true };
  }
}

] });

const response = await onboarding.start({ email: '[email protected]' });

if (response.success) { console.log('Workflow finished:', response.result); } else { console.error('Workflow failed at:', response.stepName, 'Error:', response.error); // You can store response.runId to resume later }


### 2. Resume a Failed Run
```typescript
const response = await onboarding.resume(failedRunId);

3. Auto-Resume on Startup

const workflow = createWorkflow({
  id: 'critical-process',
  autoResume: true, // Will automatically scan and resume pending tasks
  steps: [...]
});

API

createWorkflow(config)

Returns an engine with start, resume, listIncomplete, and resumeAllIncomplete.

Config:

  • id: Unique string identifying the workflow.
  • steps: Array of step objects { name, run }.
  • autoResume: (Optional) Boolean.
  • storage: (Optional) Custom storage provider.

The Result Object

All execution methods return a WorkflowResult:

  • Success: { success: true, result: T, runId: string }
  • Failure: { success: false, error: string, runId: string, stepName: string }

Development & Release

Workflow for Changes

  1. Make your changes.
  2. Run pnpm changeset and follow the prompts to describe your change.
  3. Commit the generated changeset file.

CI/CD

This project uses GitHub Actions for CI. Every pull request is automatically:

  • Linted with Biome
  • Built with tsup
  • Tested with Vitest

Contributing

We welcome contributions! Please see our CONTRIBUTING.md for detailed instructions on how to set up the project, our coding standards, and the pull request process.

License

MIT