Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@upstash/qstash

Package Overview
Dependencies
Maintainers
5
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@upstash/qstash

Official Deno/Typescript client for qStash

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42K
increased by4.9%
Maintainers
5
Weekly downloads
 
Created
Source

Upstash qStash SDK

Tests npm (scoped) npm bundle size

qStash is a serverless queueing / messaging system, designed to be used with serverless functions to consume from the queue.

It is the only connectionless (HTTP based) Redis client and designed for:

  • Serverless functions (AWS Lambda ...)
  • Cloudflare Workers (see the example)
  • Fastly Compute@Edge (see the example)
  • Next.js, Jamstack ...
  • Client side web/mobile applications
  • WebAssembly
  • and other environments where HTTP is preferred over TCP.

See the list of APIs supported.

How does qStash work?

qStash is the message broker between your serverless apps. You send a HTTP request to qStash, that includes a destination, a payload and optional settings. We store your message durable and will deliver it to the destination server via HTTP. In case the destination is not ready to receive the message, we will retry the message later, to guarentee at-least-once delivery.

Quick Start

Install

npm
npm install @upstash/qstash
Deno
import { Redis } from "https://deno.land/x/upstash_qstash/mod.ts";

Activate qStash

Go to upstash and activate qStash.

Basic Usage:

Publishing a message

import { Client } from "@upstash/qstash"

const q = new Client({
  token: <QSTASH_TOKEN>,
})

const res = await q.publishJSON({
    body: { hello: "world" },
})

console.log(res.messageID)

Consuming a message

How to consume a message depends on your http server. QStash does not receive the http request directly, but should be called by you as the first step in your handler function.

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

const c = new Consumer({
  currentSigningKey: "..",
  nextSigningKey: "..",
});

const isValid = await c.verify({
  /**
   * The signature from the `upstash-signature` header.
   */
  signature: "string";

  /**
   * The raw request body.
   */
  body: "string";

  /**
   * URL of the endpoint where the request was sent to.
   */
  url: "string";
})

Docs

See the documentation for details.

Contributing

Install Deno

Running tests

QSTASH_TOKEN=".." deno test -A

Keywords

FAQs

Package last updated on 06 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc