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

@flowcraft/vercel-adapter

v1.1.1

Published

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![NPM Version](https://img.shields.io/npm/v/@flowcraft/vercel-adapter.svg)](https://www.npmjs.com/package/@flowcraft/vercel-adapter) [![Codecov](h

Downloads

39

Readme

Flowcraft Adapter for Vercel

License: MIT NPM Version Codecov

This package provides a distributed adapter for Flowcraft that is deeply integrated with Vercel's serverless infrastructure. It uses Vercel Queues for event-driven job queuing and Redis (e.g., Upstash via Vercel Marketplace) for scalable state persistence and coordination.

Features

  • Serverless Execution: No persistent workers needed. Each job is processed by a Vercel Function triggered by the queue.
  • Event-Driven Queues: Utilizes Vercel Queues for durable, at-least-once message delivery with automatic retries.
  • Redis State & Coordination: Leverages Redis for workflow context, distributed coordination (fan-in joins), and status tracking.
  • Workflow Reconciliation: Includes a reconciler utility to detect and resume stalled workflows.

Installation

npm install flowcraft @flowcraft/vercel-adapter @vercel/queue ioredis

Prerequisites

  • A Vercel project with the Queues feature enabled.
  • A Redis instance (e.g., Upstash Redis via Vercel Marketplace).
  • Node.js 22+ (required by @vercel/queue).

Usage

Queue Consumer (Worker)

// app/api/workflow-worker/route.ts
import { handleCallback } from '@vercel/queue'
import Redis from 'ioredis'
import { VercelQueueAdapter, VercelKvCoordinationStore } from '@flowcraft/vercel-adapter'

const redis = new Redis(process.env.UPSTASH_REDIS_URL!)

const coordinationStore = new VercelKvCoordinationStore({ client: redis })

const adapter = new VercelQueueAdapter({
	redisClient: redis,
	topicName: 'flowcraft-jobs',
	coordinationStore,
	runtimeOptions: {
		blueprints: {
			/* your blueprints */
		},
		registry: {
			/* your node implementations */
		},
	},
})

export const POST = handleCallback(async (message) => {
	await adapter.handleJob(message)
})

vercel.json Configuration

{
	"functions": {
		"app/api/workflow-worker/route.ts": {
			"experimentalTriggers": [{ "type": "queue/v2beta", "topic": "flowcraft-jobs" }]
		}
	}
}

Starting a Workflow (Producer)

import { analyzeBlueprint } from 'flowcraft'
import { send } from '@vercel/queue'
import Redis from 'ioredis'

const redis = new Redis(process.env.UPSTASH_REDIS_URL!)

async function startWorkflow(blueprint, initialContext) {
	const runId = crypto.randomUUID()

	// Set initial context
	const prefix = 'flowcraft:context:'
	await redis.set(`${prefix}${runId}:blueprintId`, blueprint.id, 'EX', 86400)

	// Set status
	await redis.set(
		`flowcraft:status:${runId}`,
		JSON.stringify({
			status: 'running',
			lastUpdated: Math.floor(Date.now() / 1000),
		}),
		'EX',
		86400,
	)

	// Enqueue start nodes
	const analysis = analyzeBlueprint(blueprint)
	for (const nodeId of analysis.startNodeIds) {
		await send('flowcraft-jobs', { runId, blueprintId: blueprint.id, nodeId })
	}

	return runId
}

Components

  • VercelQueueAdapter: The main adapter class for serverless execution via Vercel Queues. Exposes handleJob() for per-invocation processing.
  • VercelKvContext: An IAsyncContext implementation for storing workflow state in Redis.
  • VercelKvCoordinationStore: An ICoordinationStore implementation for distributed locks and counters using Redis.
  • createVercelReconciler: A utility function for creating a reconciler that queries Redis for stalled workflows and resumes them.

Reconciliation

import { createVercelReconciler } from '@flowcraft/vercel-adapter'

const reconciler = createVercelReconciler({
	adapter: myAdapter,
	redisClient: myRedisClient,
	statusKeyPrefix: 'flowcraft:status:',
	stalledThresholdSeconds: 300,
})

const stats = await reconciler.run()
console.log(`Reconciled ${stats.reconciledRuns} of ${stats.stalledRuns} stalled runs`)

License

This package is licensed under the MIT License.