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

@drew-foxall/upstash-workflow-world

v0.1.0

Published

Edge-runtime compatible World implementation for Workflow DevKit using Upstash Redis

Readme

@drew-foxall/upstash-workflow-world

An edge-runtime compatible World implementation for Workflow DevKit using Upstash Redis.

Works on: Cloudflare Workers, Vercel Edge, Deno Deploy, and any JavaScript runtime with fetch().

Attribution

This package is derived from workflow-worlds by Dustin Townsend. The original project provides the foundational architecture and patterns for implementing World interfaces for the Workflow DevKit.

Features

  • Edge-Runtime Compatible: Uses HTTP-based Redis operations (no TCP connections required)
  • Full World Interface: Implements Storage, Queue, and Streamer capabilities
  • Self-Invoking Queue: Uses Redis Streams with HTTP triggers for reliable job processing
  • Polling-Based Streaming: Real-time output streaming without persistent connections
  • Automatic Retries: Built-in retry logic with exponential backoff
  • Idempotency: Prevents duplicate job processing

Installation

npm install @drew-foxall/upstash-workflow-world @upstash/redis

Quick Start

import { createWorld } from '@drew-foxall/upstash-workflow-world';

// Create a world instance
const world = createWorld({
  redisUrl: process.env.UPSTASH_REDIS_REST_URL,
  redisToken: process.env.UPSTASH_REDIS_REST_TOKEN,
  baseUrl: 'https://my-app.vercel.app', // Your deployed app URL
});

export default world;

Configuration

Environment Variables

The package supports the following environment variables:

| Variable | Description | |----------|-------------| | UPSTASH_REDIS_REST_URL | Upstash Redis REST URL | | UPSTASH_REDIS_REST_TOKEN | Upstash Redis REST Token | | WORKFLOW_UPSTASH_REDIS_REST_URL | Alternative Redis URL (higher priority) | | WORKFLOW_UPSTASH_REDIS_REST_TOKEN | Alternative Redis Token (higher priority) | | DEBUG | Set to workflow:* for debug logging |

Config Options

interface UpstashWorldConfig {
  // Redis connection
  redisUrl?: string;           // Upstash Redis REST URL
  redisToken?: string;         // Upstash Redis REST Token
  redis?: Redis;               // Pre-existing @upstash/redis client

  // Key prefix for all Redis keys (default: 'workflow')
  keyPrefix?: string;

  // Queue configuration
  baseUrl?: string;            // Base URL for self-invoking HTTP triggers
  maxRetries?: number;         // Max retry attempts (default: 3)
  retryDelayMs?: number;       // Initial retry delay (default: 1000)
  idempotencyTtlMs?: number;   // Idempotency key TTL (default: 60000)

  // Streamer configuration
  streamMaxLen?: number;       // Max stream length (default: 10000)
  pollIntervalMs?: number;     // Polling interval (default: 100)
}

Usage with Workflow DevKit

Creating a Workflow

import { createWorkflow } from '@workflow/core';
import { createWorld } from '@drew-foxall/upstash-workflow-world';

const world = createWorld({
  redisUrl: process.env.UPSTASH_REDIS_REST_URL,
  redisToken: process.env.UPSTASH_REDIS_REST_TOKEN,
  baseUrl: process.env.VERCEL_URL,
});

const myWorkflow = createWorkflow({
  world,
  name: 'my-workflow',
  async run(ctx, input) {
    const result = await ctx.step('process', async () => {
      return { processed: true };
    });
    return result;
  },
});

Queue Handler (Edge Function)

For the self-invoking queue pattern to work, you need to expose a /drain endpoint:

// pages/api/drain.ts (Next.js) or similar
import { world } from './world';

export const config = { runtime: 'edge' };

export default world.createQueueHandler('workflow', async (message) => {
  // Process queue message
  console.log('Processing:', message);
});

Architecture

This implementation uses:

  1. Storage: Redis Hashes and Sorted Sets for runs, steps, events, and hooks
  2. Queue: Redis Streams with self-invoking HTTP triggers (no BullMQ/TCP required)
  3. Streamer: Redis Streams with polling-based reads (no Pub/Sub required)

Why Not BullMQ?

BullMQ requires TCP connections which are not available in edge runtimes. This implementation uses:

  • Redis Streams for reliable message queuing
  • HTTP-based self-invocation for job processing triggers
  • Polling instead of blocking reads for stream consumption

Development

# Install dependencies
npm install

# Run tests (requires Upstash Redis credentials)
UPSTASH_REDIS_REST_URL=... UPSTASH_REDIS_REST_TOKEN=... npm test

# Build
npm run build

# Type check
npm run typecheck

License

MIT - See LICENSE for details.

Credits