Socket
Book a DemoInstallSign in
Socket

@buggyhunter/qjobs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buggyhunter/qjobs

A simple, type-safe job queue SDK for serverless environments (Next.js, Vercel, Node.js) powered by Upstash QStash.

latest
npmnpm
Version
1.0.0-rc.3
Version published
Maintainers
1
Created
Source

@upstash/qjobs

A simple, type-safe job queue SDK for serverless environments (Next.js, Vercel, Node.js) powered by Upstash QStash.

Installation

npm install @upstash/qjobs

Setup (one-time)

Set up a catch-all route to receive and process jobs. You only need to do this once per project.

Next.js API Route

Create pages/api/jobs/[jobs].ts:

import { jobRouter } from '@upstash/qjobs';

export default jobRouter();

Next.js App Router

Create app/api/jobs/[jobs]/route.ts:

import { jobRouter } from '@upstash/qjobs';

export const POST = jobRouter();

Usage

1. Define a Job

Define your job(s) with type-safe payloads and handler logic.

import { createJob } from '@upstash/qjobs';

const emailJob = createJob('sendEmail', async (payload: { to: string; subject: string; body: string }) => {
  // Your email sending logic here
  console.log('Sending email to', payload.to);
});

2. Enqueue a Job

Enqueue jobs to be processed by your handler, either immediately or with delay/schedule.

// Enqueue a job to run immediately
await emailJob.enqueue({ to: 'user@example.com', subject: 'Hello', body: 'Welcome!' });

// Enqueue a job with a delay or schedule
await emailJob.enqueue(
  { to: 'user@example.com', subject: 'Scheduled', body: 'This will be sent later.' },
  { delay: '10s' } // or { schedule: '0 9 * * *' } for cron
);

Environment Variables

  • QSTASH_TOKEN: Your Upstash QStash token (required for enqueueing jobs)
  • QSTASH_SIGNING_KEY: Your Upstash QStash signing key (required for signature verification)
  • VERCEL_URL or VERCEL_PROJECT_PRODUCTION_URL: (optional, for automatic URL inference)

Security & Signature Verification

This SDK automatically verifies the authenticity of incoming job requests using Upstash QStash's signature verification (via @upstash/qstash).

  • Requests without a valid signature will be rejected with a 401 Unauthorized response.
  • Make sure to set QSTASH_SIGNING_KEY in your environment for secure operation.

License

MIT

FAQs

Package last updated on 17 May 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.