Generated banner for Upstash Qstash JS
Generated logo for Upstash Qstash JS

Upstash Qstash JS

UpstashOfficialCreated by Upstash

  • Skill
  • Tool integration
  • Automation and integrations
  • MIT
  • Low risk
  • Has scripts

From the author

Work with the @upstash/qstash TypeScript/JavaScript SDK, an HTTP-based message queue, task scheduler, and background job system for serverless and edge runtimes (Next.js, Vercel, Cloudflare Workers, Deno, Node.js). Use when publishing messages to HTTP endpoints or URL groups, running background jobs without a long-running worker process, scheduling with cron expressions, delaying messages, building FIFO queues with parallelism and flow control, configuring retries and callbacks, handling a dead letter queue (DLQ), deduplicating messages, fanning out to multiple endpoints, verifying QStash webhook signatures (Next.js App Router, Pages Router, and Edge Runtime), running a local QStash dev server, or migrating regions. Also use when the user asks for a serverless cron job, async task queue, job scheduler, delayed delivery, webhook delivery with retries, or event-driven messaging between services.
— the description by Upstash

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The QStash JavaScript SDK provides a robust interface for interacting with Upstash's HTTP-based messaging and scheduling platform. Designed for serverless and edge environments like Next.js, Cloudflare Workers, and Deno, this skill enables developers to implement asynchronous task processing, cron-style scheduling, and reliable event-driven communication without maintaining persistent worker infrastructure.

What it does

  • Publishes HTTP messages to individual endpoints or URL groups
  • Schedules recurring tasks using cron expressions
  • Manages FIFO queues with configurable parallelism and flow control
  • Verifies incoming webhook signatures for secure communication
  • Handles advanced messaging patterns like retries, callbacks, and dead letter queues
  • Supports message deduplication and multi-region configurations

When to use it

  • When building serverless applications requiring background job processing
  • When you need to schedule delayed or recurring tasks in edge runtimes
  • When implementing event-driven architectures between microservices
  • When you need reliable webhook delivery with automatic retries
  • When you need to ensure ordered message processing with flow control

Advantages

  • Native support for serverless and edge runtimes
  • Simplifies complex background job orchestration
  • Built-in security via webhook signature verification
  • Flexible configuration for retries, delays, and dead letter queues
  • Supports local development workflows

Usage examples

“How do I publish a JSON message to a webhook using QStash?”
The agent provides a code snippet using the Client.publishJSON method, demonstrating how to initialize the client with an environment token and send a payload to a specific URL.
“How can I verify that a webhook request came from QStash?”
The agent explains how to use the Receiver class to validate incoming request signatures, including platform-specific guidance for frameworks like Next.js.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/upstash/upstash-qstash-js/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip upstash-qstash-js.zip -d .agents/skills

Documentation by Upstash

QStash JavaScript SDK

QStash is an HTTP-based messaging and scheduling solution for serverless and edge runtimes. This skill helps you use the QStash JS SDK effectively.

Bundled docs and source

Before writing or debugging SDK code, check node_modules/@upstash/qstash/docs/ for bundled docs and node_modules/@upstash/qstash/src/ for readable TypeScript source. Read and search the relevant files when present; otherwise use the references in this skill.

When to use this skill

Use this skill when:

  • Publishing HTTP messages to endpoints or URL groups

  • Creating scheduled or delayed message delivery

  • Managing FIFO queues with configurable parallelism

  • Verifying incoming webhook signatures from QStash

  • Implementing callbacks, DLQ handling, or message deduplication

Quick Start

Installing the SDK
npm install @upstash/qstash
Basic Publishing
import { Client } from "@upstash/qstash";

const client = new Client({
  token: process.env.QSTASH_TOKEN!,
});

const result = await client.publishJSON({
  url: "https://my-api.example.com/webhook",
  body: { event: "user.created", userId: "123" },
});

Core Concepts

For fundamental QStash operations, see:

For verifying incoming messages:

  • Receiver Verification - Core signature verification with the Receiver class

  • Platform-Specific Verifiers:

    • Next.js - App Router, Pages Router, and Edge Runtime

For advanced features:

Platform Support

QStash JS SDK works across various platforms:

  • Next.js (App Router and Pages Router)

  • Cloudflare Workers

  • Deno

  • Node.js (v18+)

  • Vercel Edge Runtime

  • SvelteKit, Nuxt, SolidJS, and other frameworks

Note on Workflow SDK: For building complex durable workflows that chain multiple QStash messages together, consider using the separate QStash Workflow SDK (@upstash/workflow). The Workflow SDK empowers you to orchestrate multi-step processes with automatic state management, retries, and fault tolerance. This Skills file focuses on the core QStash messaging SDK.

Best Practices

  • Always verify incoming QStash messages using the Receiver class

  • Use environment variables for tokens and signing keys

  • Set appropriate retry counts and timeouts for your use case

  • Use queues for ordered processing with controlled parallelism

  • Implement DLQ handling for failed message recovery

Files

fundamentals/local-development.md

Local Development

Use the QStash dev server to test publishing and signature verification end-to-end on your machine — no public tunnel, no real QStash account, no real signing keys.

Pass devMode: true to the Client (and the matching verifier). The SDK will download the QStash CLI binary, start it, and wire credentials for you.

import { Client } from "@upstash/qstash";

const client = new Client({ devMode: true });

await client.publishJSON({
  url: "https://example.com/webhook",
  body: { hello: "world" },
});

When devMode is on:

  • The SDK downloads the latest qstash binary on first use, caches it under the OS cache directory, and reuses it across projects.

  • Spawns the dev server on port 8080 (override via QSTASH_DEV_PORT).

  • Reuses an already-running server on the configured port instead of spawning a duplicate.

  • Injects deterministic dev baseUrl, token, and signing keys. Any explicit token / baseUrl / signing keys you pass are ignored (a warning is printed). To use real credentials, set devMode: false.

  • Forwards dev server logs to stdout/stderr with a dim [QStash CLI] prefix.

  • No-ops in production (NODE_ENV=production), during next build, and in browser/edge runtimes.

Environment variable

Instead of hard-coding devMode: true, leave the option unset and toggle via env:

QSTASH_DEV=true       # or "1"
QSTASH_DEV_PORT=8080  # optional, default 8080

The resolution order is: explicit devMode boolean > QSTASH_DEV env var > off. Use this so production code never accidentally turns the dev server on.

Verifying signatures in dev

The receiving side also needs devMode: true so it verifies against the dev server's deterministic signing keys instead of your real ones.

import { Receiver } from "@upstash/qstash";

const receiver = new Receiver({ devMode: true });

await receiver.verify({
  signature: request.headers.get("upstash-signature")!,
  body: await request.text(),
});

For Next.js, the wrappers accept the same flag:

// app/api/webhook/route.ts
import { verifySignatureAppRouter } from "@upstash/qstash/nextjs";

export const POST = verifySignatureAppRouter(
  async (request) => new Response("ok"),
  { devMode: true }
);
Next.js: starting the server before edge routes

Edge runtimes cannot spawn child processes. If a route in the Edge Runtime is the first thing to use QStash, the SDK can only check whether the server is reachable — it cannot start it. Call registerQStashDev() from instrumentation.ts to spawn the server during Next.js startup, before any request hits:

// instrumentation.ts
import { registerQStashDev } from "@upstash/qstash/nextjs";

export function register() {
  registerQStashDev();
}

registerQStashDev is itself a no-op in production and during next build.

Common pitfalls
  • Passing token alongside devMode: true — the explicit token is ignored and you get a console warning. Drop the token field, or set devMode: false to use it.

  • Hitting build-time errors in next build — if a route module is evaluated at build time and instantiates the Client, mark the route export const dynamic = "force-dynamic" so it isn't pre-rendered.

  • Port 8080 already in use — the SDK errors with a clear message; either stop the other process or set QSTASH_DEV_PORT to a free port (matched on both client and receiver sides).

  • Calling QStash from an edge route without instrumentation.ts — the edge runtime can't spawn the binary. Either move the call to a Node-runtime route or wire registerQStashDev() as shown above.

Manual dev server

If you cannot use the automatic flow (non-Node runtime, CI without internet, custom binary), run the CLI yourself:

npx @upstash/qstash-cli dev

Then construct the client with the printed dev credentials explicitly and leave devMode unset/false:

const client = new Client({
  baseUrl: "http://127.0.0.1:8080",
  token: "eyJVc2VySUQiOiJkZWZhdWx0VXNlciIsIlBhc3N3b3JkIjoiZGVmYXVsdFBhc3N3b3JkIn0=",
});

See the Local Development docs for the full list of test users and CLI options.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Upstash
Publisher
Upstash (Official)
Source
upstash/skills · skills/upstash-qstash-js · commit 9f9e3e5
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Upstash or Upstash.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download upstash-qstash-js.zip