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

@haykal/jobs-backend

v1.0.0

Published

> Background job processing with BullMQ — queue management, job scheduling, health monitoring, and an admin API for queue inspection.

Readme

@haykal/jobs-backend

Background job processing with BullMQ — queue management, job scheduling, health monitoring, and an admin API for queue inspection.

Installation

pnpm add @haykal/jobs-backend

Configuration

forRoot() Options

import { JobsModule } from '@haykal/jobs-backend';

@Module({
  imports: [
    JobsModule.forRoot({
      redis: {
        host: 'localhost',
        port: 6379,
        password: undefined,
        db: 0,
      },
      queues: ['email', 'notifications', 'reports'],
      defaultJobOptions: {
        attempts: 3,
        backoff: { type: 'exponential', delay: 1000 },
        removeOnComplete: 100,
        removeOnFail: 500,
      },
      dashboard: {
        enabled: true,
        basePath: '/admin/jobs',
      },
      workers: {
        concurrency: 5,
      },
    }),
  ],
})
export class AppModule {}

Configuration Reference

| Property | Type | Required | Default | Description | | ------------------------------------ | ------------------- | -------- | --------------- | ------------------------------------------- | | redis.host | string | Yes | — | Redis host | | redis.port | number | Yes | — | Redis port | | redis.password | string | No | — | Redis password | | redis.db | number | No | 0 | Redis database number | | queues | string[] | Yes | — | Queue names to auto-register | | defaultJobOptions.attempts | number | No | — | Default retry attempts | | defaultJobOptions.backoff | object | No | — | { type: 'fixed' \| 'exponential', delay } | | defaultJobOptions.priority | number | No | — | Job priority (lower = higher) | | defaultJobOptions.removeOnComplete | boolean \| number | No | — | Auto-remove completed jobs | | defaultJobOptions.removeOnFail | boolean \| number | No | — | Auto-remove failed jobs | | defaultJobOptions.timeout | number | No | — | Job timeout in ms | | dashboard.enabled | boolean | No | false | Enable admin API endpoints | | dashboard.basePath | string | No | '/admin/jobs' | Dashboard base path | | workers.concurrency | number | No | 5 | Worker concurrency per queue |

Key Exports

| Export | Type | Description | | --------------------- | ------------- | ----------------------------------------------------- | | JobsModule | NestJS Module | Global module with forRoot() / forRootAsync() | | JOBS_CONFIG | Symbol | Inject the config object | | JOBS_QUEUES | Symbol | Inject the Map<string, Queue> of registered queues | | JobsService | Service | Enqueue jobs, schedule recurring, manage queues | | JobsHealthIndicator | Service | Health check for all queues | | JobsAdminController | Controller | Queue inspection and control (when dashboard enabled) |

API Endpoints

Enabled when dashboard.enabled: true. Base path: /api/jobs.

| Method | Path | Description | | -------- | ------------------------------ | -------------------------------- | | GET | /jobs/queues | List all queues with stats | | GET | /jobs/queues/:name | Get queue details | | GET | /jobs/queues/:name/jobs | List jobs (filterable by status) | | GET | /jobs/queues/:name/jobs/:id | Get job details | | POST | /jobs/queues/:name/retry-all | Retry all failed jobs | | DELETE | /jobs/queues/:name/clean | Clean completed/failed jobs | | POST | /jobs/queues/:name/pause | Pause a queue | | POST | /jobs/queues/:name/resume | Resume a paused queue |

Usage Examples

Enqueueing a Job

import { JobsService } from '@haykal/jobs-backend';

@Injectable()
export class EmailService {
  constructor(private readonly jobs: JobsService) {}

  async sendWelcomeEmail(userId: string, email: string) {
    await this.jobs.enqueue('email', 'welcome', { userId, email });
  }
}

Scheduling a Recurring Job

await this.jobs.scheduleRecurring('reports', 'daily-summary', {
  pattern: '0 8 * * *', // 8 AM daily
  data: { type: 'daily' },
});

Delayed Job

await this.jobs.enqueueDelayed(
  'notifications',
  'reminder',
  {
    userId,
    message: "Don't forget!",
  },
  60 * 60 * 1000,
); // 1 hour delay

Health Check

import { JobsHealthIndicator } from '@haykal/jobs-backend';

@Controller('health')
export class HealthController {
  constructor(private readonly jobsHealth: JobsHealthIndicator) {}

  @Get()
  async check() {
    return this.jobsHealth.check();
  }
}

Related Packages

  • @haykal/jobs-client — React Query hooks for queue dashboard
  • @haykal/core-backend — Base infrastructure
  • @haykal/email-backend — Uses jobs for email queue delivery

Further Reading