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

@stablemates/workhorse

v0.8.0

Published

A durable task queue for PostgreSQL. Public beta.

Readme

@stablemates/workhorse

The TypeScript client, worker runtime, schema tools, and operator API for the Workhorse durable task queue for PostgreSQL.

Public beta: Workhorse is usable for evaluation and early production adoption. A 0.x minor release may change behaviour, so read the changelog before you upgrade. It will not ask you to recreate your database: migrations are ordered, and inside a major line a migration only adds, so a running deployment upgrades in place.

An AI agent should read the Workhorse documentation index first.

Install

npm install @stablemates/workhorse
npm exec --no -- workhorse schema install

Install the schema during deployment. Runtime processes should verify compatibility instead of attempting schema changes. npm exec --no runs the binary this project already depends on, so the schema tool and the application always agree on a version.

Requires Node.js 22 or 24 and PostgreSQL 15 through 18.

Run one task

import { Admin, Pool, Queue, Worker } from "@stablemates/workhorse";

export async function runQuickstart(databaseUrl: string) {
  const pool = new Pool({ connectionString: databaseUrl });
  try {
    const queue = new Queue(pool);
    const admin = new Admin(pool);
    const worker = new Worker(queue, { workerId: "quickstart-worker" }).handle<{ name: string }>(
      "welcome.send",
      async (payload) => ({ message: `Welcome, ${payload.name}!` }),
    );
    const taskId = await queue.enqueue("welcome.send", { name: "Ada" });
    await worker.runOnce();
    const task = await admin.getTask(taskId);
    if (task?.state !== "succeeded") throw new Error(`Quickstart task finished in ${task?.state}`);
    return { taskId, result: task.result };
  } finally {
    await pool.end();
  }
}

Handlers receive at-least-once delivery. Use stable provider idempotency keys around external effects; named checkpoints prevent completed application stages from running after a later restart.

Task groups, checkpoint inputs, and single passes

  • A task group tracks many tasks as one unit. After the group is sealed and every member task is finished, Workhorse enqueues the callback tasks of the group. queue.taskGroup creates a group, adds its tasks, and seals it in one transaction.
  • A handler can give the input of a checkpoint. Give it as ctx.checkpoint(name, operation, { input }). If a later run gives a different input, the call raises CheckpointInputConflictError, the task fails, and the operation does not run again. If the stored checkpoint or the call has no input, Workhorse compares nothing.
  • worker.runOnce() returns true only when a handler ran. It returns false after a pass that only released the tasks that it claimed. If you call it in a loop, wait after false.

Package boundary

This package owns the PostgreSQL schema, protocol client, worker runtime, CLI, and operator API. Run schema changes as a deployment step; application and worker processes should only check compatibility. ORM applications can add a provider package to enqueue through an existing application transaction. Core has no telemetry vendor dependency. Applications that use OpenTelemetry install @stablemates/workhorse-otel, configure their global SDK providers, and call registerOpenTelemetry() during process startup.

Next

License

Apache-2.0. See LICENSE and NOTICE in the package.