Skip to content
Skillv1.0.0

nestjs-queue-architect

Queue job management patterns, processors, and async workflows for video/image processing. Use when building BullMQ queues, job processors, or async video/image processing workflows in NestJS.

by shipshitdev(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from shipshitdev/skills (skills/nestjs-queue-architect/SKILL.md). Install upstream with npx skills add shipshitdev/skills --skill nestjs-queue-architect. Copyright stays with the author.

NestJS Queue Architect - BullMQ Expert

Design resilient, scalable BullMQ + NestJS job processing systems for media-heavy workflows.

Technology Stack

  • BullMQ: 5.61.0 (Redis-backed job queue)
  • @nestjs/bullmq: 11.0.4
  • @bull-board/nestjs: 6.13.1 (Queue monitoring UI)

Project Context Discovery

Before implementing:

  1. Check .agents/memory/ for any architecture files describing queue patterns
  2. Review existing queue services and constants
  3. Look for [project]-queue-architect skill

Core Patterns

Queue Constants

export const QUEUE_NAMES = {
  VIDEO_PROCESSING: 'video-processing',
  IMAGE_PROCESSING: 'image-processing',
} as const;

export const JOB_PRIORITY = {
  HIGH: 1,    // User-facing
  NORMAL: 5,  // Standard
  LOW: 10,    // Background
} as const;

Queue Service

@Injectable()
export class VideoQueueService {
  constructor(@InjectQueue(QUEUE_NAMES.VIDEO) private queue: Queue) {}

  async addJob(data: VideoJobData) {
    return this.queue.add(JOB_TYPES.RESIZE, data, {
      priority: JOB_PRIORITY.NORMAL,
      attempts: 3,
      backoff: { type: 'exponential', delay: 2000 },
    });
  }
}

Processor (WorkerHost)

@Processor(QUEUE_NAMES.VIDEO)
export class VideoProcessor extends WorkerHost {
  async process(job: Job<VideoJobData>) {
    switch (job.name) {
      case JOB_TYPES.RESIZE: return this.handleResize(job);
      case JOB_TYPES.MERGE: return this.handleMerge(job);
      default: throw new Error(`Unknown job: ${job.name}`);
    }
  }
}

Key Principles

  1. One service per queue type - Encapsulate job options
  2. Switch-based routing - Route by job.name
  3. Structured error handling - Log, emit WebSocket, publish Redis, re-throw
  4. Always cleanup - Temp files in try/finally
  5. Idempotent handlers - Safe to retry

Queue Configuration

BullModule.registerQueue({
  name: QUEUE_NAMES.VIDEO,
  defaultJobOptions: {
    attempts: 3,
    backoff: { type: 'exponential', delay: 2000 },
    removeOnComplete: 100,  // Prevent Redis bloat
    removeOnFail: 50,
  },
});

Retry Strategy

Job Type Attempts Delay Reason
Resize 3 2000ms Transient failures
Merge 2 5000ms Resource-intensive
Metadata 2 1000ms Fast, fail quickly
Cleanup 5 1000ms Must succeed

Common Pitfalls

  • Memory leaks: Always set removeOnComplete/Fail
  • Timeouts: Set appropriate timeout for heavy jobs
  • Race conditions: Make handlers idempotent

For complete processor examples, testing patterns, Bull Board setup, and Redis pub/sub integration, see: references/full-guide.md

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/shipshitdev-skills-nestjs-queue-architect/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

shipshitdev-skills-nestjs-queue-architect.ocm.jsonjson
{
  "ocm": "1",
  "id": "shipshitdev-skills-nestjs-queue-architect",
  "kind": "skill",
  "name": "nestjs-queue-architect",
  "description": "Queue job management patterns, processors, and async workflows for video/image processing. Use when building BullMQ queues, job processors, or async video/image processing workflows in NestJS.",
  "publisher": "shipshitdev",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "nestjs",
      "queues",
      "async",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Queue job management patterns, processors, and async workflows for video/image processing. Use when building BullMQ queues, job processors, or async video/image processing workflows in NestJS."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/shipshitdev/skills",
      "path": "skills/nestjs-queue-architect/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/shipshitdev/skills/blob/HEAD/skills/nestjs-queue-architect/SKILL.md",
      "key": "shipshitdev/skills/skills/nestjs-queue-architect/SKILL.md"
    }
  },
  "instructions": "# NestJS Queue Architect - BullMQ Expert\n\nDesign resilient, scalable BullMQ + NestJS job processing systems for media-heavy workflows.\n\n## Technology Stack\n\n- **BullMQ**: 5.61.0 (Redis-backed job queue)\n- **@nestjs/bullmq**: 11.0.4\n- **@bull-board/nestjs**: 6.13.1 (Queue monitoring UI)\n\n## Project Context Discovery\n\nBefore implementing:\n\n1. Check `.agents/memory/` for any architecture files describing queue patterns\n2. Review existing queue services and constants\n3. Look for `[project]-queue-architect` skill\n\n## Core Patterns\n\n### Queue Constants\n\n```typescript\nexport const QUEUE_NAMES = {\n  V",
  "cost": {
    "context_tokens": 685
  }
}

Fetch it by URL: GET /api/v1/registry/shipshitdev-skills-nestjs-queue-architect/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.