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

nestjs-kue

v0.4.3

Published

Kue wrapper for NestJS framework

Downloads

25

Readme

Kue wrapper for NestJS framework

Description

Installation

$ npm install --save nestjs-kue

This module uses REDIS to operate, and utilizes the following environment variables and the default values as configurations:

  • KUE_REDIS_PREFIX # Default 'q'
  • KUE_REDIS_HOST # Default 'localhost'
  • KUE_REDIS_PORT # Default 6379
  • KUE_REDIS_DB # Default 0

As of 0.2.0 version, you are able to use connection URI using KUE_REDIS_URI variable like:

redis://example.com:1234?redis_option=value&redis_option=value

Usage

Defining tasks:

src/modules/users/tasks/users.tasks.ts
import { Injectable } from '@nestjs/common';
import { Job, JobCallback, DoneCallback } from 'kue';
import { Task } from 'nestjs-kue';

@Injectable()
export class UsersTasks {
    @Task({ name: 'justATest' })
    justATest(job: Job, done: DoneCallback) {
        const result: string = 'Ended just fine!';
        done(null, result);
    }
}

Options when defining a task:

@Task({
    name: 'justATest',
    concurrency: 3,
    attempts: 3,
    ttl: 3000,
    backoff: { delay: 5 * 1000, type: 'fixed' }
})

To setup the module, include KueModule and the KueTaskRegisterService in modules where you will use tasks, then register the tasks using the method register():

import { ModuleRef } from '@nestjs/core';
import { KueModule, KueTaskRegisterService } from 'nestjs-kue';
import { UsersTasks } from './tasks/users.tasks';

@Module({
  imports: [KueModule],
  controllers: [UsersController],
  providers: [UsersTasks],
})
export class UsersModule implements OnModuleInit {
    constructor(
        private readonly moduleRef: ModuleRef,
        private readonly taskRegister: KueTaskRegisterService
    ) {}

    onModuleInit() {
        this.taskRegister.setModuleRef(this.moduleRef);
        this.taskRegister.register(UsersTasks);
    }
}

Firing a previously defined task:

import { Get, Controller } from '@nestjs/common';
import { UsersTasks } from './tasks/users.tasks';
import { KueService } from 'nestjs-kue';

@Controller()
export class AppController {
    constructor(
        private readonly kueService: KueService,
        private readonly tasks: UsersTasks
    ) {}
}
@Get('task')
createTask() {
    const job = this.kueService.createJob(this.tasks.justATest, { a: 'b' }).save();
}

A task can emit some events when fired:

@Get('task')
createJob(@Res() res) {
    const job = this.kueService.createJob(this.tasks.justATest, { a: 'b' }).save();
    job.on('complete', (result) => res.send(result));
    job.on('failed', (err) => res.status(HttpStatus.INTERNAL_SERVER_ERROR).send(err));
}

For more options and details, please check Kue docs

Debug

You can enable some debug logs with KUE_DEBUG environment variable:

KUE_DEBUG=true

Kue daemon autostart

By default Kue daemon will start when you register one task. If you want to disable Kue Daemon on any process/container, set the KUE_START_PROCESSING environment variable:

KUE_START_PROCESSING=false

Redis sentinel configuration

This module support redis sentinel, you need to setup env variable like this

# SENTINEL CONFIG
KUE_REDIS_SENTINEL=true
KUE_REDIS_SENTINEL_HOST=redis-sentinel-0,redis-sentinel-1,redis-sentinel-2 // NAME OF SENTINEL IN YOUR CLUSTER
KUE_REDIS_SENTINEL_PORT=26379,26379,26379 // PORT OF EACH SENTINEL IN YOUR CLUSTER
KUE_REDIS_SENTINEL_MASTER=name-of-master

You can set the KUE_REDIS_SENTINEL at false for disabled redis sentinel

Datadog integration

From version 0.3.0 and above, there are the ability to send execution stats to datadog monitoring service: Datadog

To setup datadog, all you need to do is call the method setDDTracer(tracer) on taskRegister service with your Datadog tracer object as the parameter.

this.taskRegister.setDDTracer(tracer);

Kue UI

KUE_UI_ENABLED=true 
KUE_UI_PORT=3050

People