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

@vorsteh-queue/core

v0.5.0

Published

Core queue engine for Vorsteh Queue with TypeScript support, job scheduling, and event system

Readme

Queue Package

A TypeScript-first, ORM-agnostic queue system with adapter pattern support for Prisma, Drizzle, and other ORMs.

Features

  • Type-safe: Full TypeScript support with strict typing
  • ORM-agnostic: Adapter pattern supports any database ORM
  • Priority queues: Support for job priorities (low, normal, high, critical)
  • Delayed jobs: Schedule jobs to run at specific times
  • Retry logic: Configurable retry attempts with exponential backoff
  • Event system: Listen to job lifecycle events
  • Concurrency control: Configure how many jobs run simultaneously
  • Memory adapter: Built-in memory adapter for testing

Requirements

  • Node.js 20+
  • ESM only - This package is ESM-only and cannot be imported with require()

Installation

npm install @vorsteh-queue/core

Note: Make sure your project has "type": "module" in package.json or use .mjs file extensions.

Quick Start

import { MemoryQueueAdapter, Queue } from "@your-org/queue"

const adapter = new MemoryQueueAdapter("my-queue")
const queue = new Queue(adapter, {
  name: "my-queue",
  concurrency: 2,
})

// Register job handler
queue.register("send-email", async (payload: { to: string; subject: string }) => {
  // Your email sending logic
  return { messageId: "abc123" }
})

// Start processing
await queue.connect()
await queue.start()

// Add job
await queue.add("send-email", {
  to: "[email protected]",
  subject: "Welcome!",
})

Adapters

Memory Adapter (Built-in)

import { MemoryQueueAdapter } from "@your-org/queue"

const adapter = new MemoryQueueAdapter("queue-name")

Prisma Adapter

import { PrismaClient } from "@prisma/client"
import { PrismaQueueAdapter } from "@your-org/queue/adapters/prisma"

const prisma = new PrismaClient()
const adapter = new PrismaQueueAdapter(prisma, "queue-name")

Drizzle Adapter

import { DrizzleQueueAdapter } from "@your-org/queue/adapters/drizzle"

import { db, queueJobTable } from "./db"

const adapter = new DrizzleQueueAdapter(db, queueJobTable, "queue-name")

Database Schema

For database adapters, you'll need a table with this structure:

CREATE TABLE queue_jobs (
  id VARCHAR PRIMARY KEY,
  queue_name VARCHAR NOT NULL,
  name VARCHAR NOT NULL,
  payload TEXT NOT NULL,
  status VARCHAR NOT NULL,
  priority VARCHAR NOT NULL,
  attempts INTEGER NOT NULL DEFAULT 0,
  max_attempts INTEGER NOT NULL,
  created_at TIMESTAMP NOT NULL DEFAULT NOW(),
  process_at TIMESTAMP NOT NULL,
  processed_at TIMESTAMP,
  completed_at TIMESTAMP,
  failed_at TIMESTAMP,
  error TEXT
);

API Reference

Queue Configuration

interface QueueConfig {
  name: string
  concurrency?: number // Default: 1
  defaultJobOptions?: JobOptions
  retryDelay?: number // Default: 1000ms
  maxRetryDelay?: number // Default: 30000ms
  removeOnComplete?: number // Default: 100
  removeOnFail?: number // Default: 50
}

Job Options

interface JobOptions {
  priority?: "low" | "normal" | "high" | "critical" // Default: 'normal'
  delay?: number // Delay in milliseconds
  maxAttempts?: number // Default: 3
  timeout?: number // Default: 30000ms
}

Events

queue.on("job:added", (job) => {})
queue.on("job:processing", (job) => {})
queue.on("job:completed", (job) => {})
queue.on("job:failed", (job) => {})
queue.on("job:retried", (job) => {})
queue.on("queue:paused", () => {})
queue.on("queue:resumed", () => {})
queue.on("queue:stopped", () => {})

Creating Custom Adapters

Extend BaseQueueAdapter to create adapters for other ORMs:

import { BaseQueueAdapter } from "@your-org/queue"

export class MyCustomAdapter extends BaseQueueAdapter {
  async connect(): Promise<void> {
    // Connection logic
  }

  async addJob<T>(job: Omit<BaseJob<T>, "id" | "createdAt">): Promise<BaseJob<T>> {
    // Add job to database
  }

  // Implement other required methods...
}