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

@usepingback/nestjs

v0.3.0

Published

NestJS adapter for Pingback — reliable cron jobs and background tasks

Readme

@usepingback/nestjs

NestJS adapter for Pingback — reliable cron jobs and background tasks.

Installation

npm install @usepingback/nestjs

Setup

1. Import the module

import { PingbackModule } from '@usepingback/nestjs';

@Module({
  imports: [
    PingbackModule.register({
      apiKey: process.env.PINGBACK_API_KEY,
      cronSecret: process.env.PINGBACK_CRON_SECRET,
      baseUrl: process.env.APP_URL,
    }),
  ],
})
export class AppModule {}

2. Define functions

import { Injectable } from '@nestjs/common';
import { Cron, Task, PingbackContext } from '@usepingback/nestjs';

@Injectable()
export class EmailService {
  @Cron('send-emails', '*/15 * * * *', { retries: 3, timeout: '60s' })
  async sendEmails(ctx: PingbackContext) {
    ctx.log('Dispatched emails', { count: 42 });
  }

  @Task('send-email', { retries: 2, timeout: '15s' })
  async sendEmail(ctx: PingbackContext, payload: { id: string }) {
    ctx.log('Sent email', { id: payload.id });
  }
}

3. Environment variables

PINGBACK_API_KEY=pb_live_...
PINGBACK_CRON_SECRET=...

Workflows (Task Chaining)

Tasks can call ctx.task() to chain into multi-step workflows with branching:

@Injectable()
export class OrderService {
  @Task('validate-order', { retries: 2 })
  async validateOrder(ctx: PingbackContext, payload: { orderId: string; amount: number }) {
    ctx.log('Validating', { orderId: payload.orderId });

    if (payload.amount <= 0) {
      ctx.task('notify-failure', { orderId: payload.orderId, reason: 'Invalid amount' });
      return { valid: false };
    }

    ctx.task('charge-payment', payload);
    return { valid: true };
  }

  @Task('charge-payment', { retries: 3 })
  async chargePayment(ctx: PingbackContext, payload: { orderId: string; amount: number }) {
    const charge = await this.stripe.charge(payload.amount);
    ctx.log('Charged', { chargeId: charge.id });
    ctx.task('send-confirmation', payload);
  }

  @Task('send-confirmation', { retries: 2 })
  async sendConfirmation(ctx: PingbackContext, payload: { orderId: string }) {
    await this.mailer.send(payload.orderId);
    ctx.log('Confirmation sent');
  }
}

Each step runs as its own execution with independent retries and logging. The workflow graph in your dashboard visualizes the full chain.

Programmatic Triggering

Use PingbackClient to trigger tasks from anywhere in your application — no cron schedule or fan-out needed. It's an injectable service:

import { Injectable } from '@nestjs/common';
import { PingbackClient } from '@usepingback/nestjs';

@Injectable()
export class AuthService {
  constructor(private readonly pingback: PingbackClient) {}

  async register(email: string, password: string) {
    const user = await this.createUser(email, password);

    const { executionId } = await this.pingback.trigger(
      'send-onboarding-email',
      { userId: user.id },
    );

    return user;
  }
}

trigger() returns an { executionId } you can use for tracking. The task must already be registered in your project (defined with @Task() and deployed).

Structured Logging

ctx.log('message');                          // info
ctx.log('message', { key: 'value' });        // info with metadata
ctx.log.warn('slow query', { ms: 2500 });    // warning
ctx.log.error('failed', { code: 'E001' });   // error
ctx.log.debug('cache stats', { hits: 847 }); // debug

Configuration

PingbackModule.register({
  apiKey: string;          // Required
  cronSecret: string;      // Required
  baseUrl?: string;        // Your app's public URL
  routePath?: string;      // default: /api/pingback
  platformUrl?: string;    // default: https://api.pingback.lol
})

How It Works

  1. On startup, scans all providers for @Cron and @Task decorators
  2. Registers functions with the Pingback platform
  3. Auto-registers a POST endpoint at /api/pingback
  4. Platform sends signed execution requests to your endpoint
  5. Controller verifies HMAC, executes handler, returns results