feat(queue): implement add BullMQ queue monitoring dashboard#111
Open
Neziahtech wants to merge 3 commits into
Open
feat(queue): implement add BullMQ queue monitoring dashboard#111Neziahtech wants to merge 3 commits into
Neziahtech wants to merge 3 commits into
Conversation
|
@Neziahtech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Owner
|
@Neziahtech pipeline failing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36
Depends on #30
Summary
This PR sets up a Bull Board dashboard to provide visibility into BullMQ queue activity. Without it, investigating failed jobs, monitoring processing throughput, or manually retrying stuck jobs requires dropping into Redis directly. The dashboard exposes active, completed, and failed job states through a web UI and supports job inspection and retry from the browser, scoped behind an admin auth guard so it is not publicly accessible.
Changes
src/queue/queue-dashboard.module.ts (new file)
Registers the Bull Board UI using @bull-board/express as a NestJS middleware module
Adds a BullMQAdapter for each registered queue so all queues are visible in a single dashboard view
Mounts the dashboard at /admin/queues
src/queue/queue-dashboard.guard.ts (new file)
Implements an AdminAuthGuard that checks for a valid admin session or API key header before serving dashboard routes
Returns 401 for unauthenticated requests so the dashboard is not publicly accessible
src/app.module.ts
Imports QueueDashboardModule
Applies AdminAuthGuard to the /admin/queues route prefix
src/queue/queue.module.ts
Exports queue instances so QueueDashboardModule can register BullMQAdapters against them
.env.example
Adds BULL_BOARD_USERNAME and BULL_BOARD_PASSWORD for basic auth configuration
Adds QUEUE_DASHBOARD_PATH (default: /admin/queues) for configurable mount path
src/queue/queue-dashboard.module.spec.ts (new file)
Verifies the dashboard module registers without error
Asserts that unauthenticated requests to /admin/queues return 401
Confirms authenticated requests return 200 with queue data
Dashboard capabilities
Active jobs — displays jobs currently being processed, with worker ID and processing duration
Completed jobs — shows recently completed jobs with return values and processing time
Failed jobs — surfaces failed jobs with full error stack traces for inspection
Job retry — failed jobs can be retried individually from the UI without redeployment
Job detail — each job is inspectable: payload, attempts, logs, timestamps, and queue name
Access
The dashboard is mounted at /admin/queues (configurable via QUEUE_DASHBOARD_PATH). Requests must include a valid admin credential. In development this is satisfied by the BULL_BOARD_USERNAME and BULL_BOARD_PASSWORD values in .env. In production, the AdminAuthGuard should be wired to the application's existing admin authentication mechanism.
Dependencies
This PR depends on the BullMQ queue setup introduced in #30. The queues registered there are the ones surfaced in the dashboard. If #30 is not yet merged, this branch should be rebased on top of it before review.
Testing
npm run test -- queue-dashboard
Manual verification:
Start the application with a running Redis instance
Navigate to http://localhost:3000/admin/queues
Enqueue a test job and confirm it appears under Active
Allow it to complete and confirm it moves to Completed
Trigger a deliberate failure and confirm it appears under Failed with the stack trace
Use the Retry button and confirm the job re-enters the Active state
Checklist
Dashboard accessible at /admin/queues
Active, completed, and failed jobs displayed
Individual jobs inspectable with full payload and error detail
Failed jobs retryable from the UI
Dashboard protected behind AdminAuthGuard
All registered BullMQ queues surfaced via BullMQAdapter
Environment variables documented in .env.example