### Run Embedded Examples Source: https://bullstudio.dev/docs/development Start embedded examples for framework adapters or embedded-mode behavior. Ensure Redis is started first. ```bash pnpm --filter @bullstudio/example-hono-bullmq-embedded dev pnpm --filter @bullstudio/example-express-bullmq-embedded dev pnpm --filter @bullstudio/example-fastify-bullmq-embedded dev pnpm --filter @bullstudio/example-next-bullmq-embedded dev ``` -------------------------------- ### Install BullMQ Adapter Source: https://bullstudio.dev/docs/queue-adapters Install the BullMQ adapter and BullMQ library using pnpm. ```bash pnpm add @bullstudio/bullmq-adapter bullmq ``` -------------------------------- ### Install Node.js and pnpm Source: https://bullstudio.dev/docs/development Verify Node.js version and install the required pnpm version. ```bash node --version corepack enable corepack prepare pnpm@10.4.1 --activate pnpm --version ``` -------------------------------- ### Install Bull v4 Adapter Source: https://bullstudio.dev/docs/queue-adapters Install the Bull v4 adapter and Bull library using pnpm. ```bash pnpm add @bullstudio/bull-adapter bull ``` -------------------------------- ### Complete Bullstudio Configuration Example Source: https://bullstudio.dev/docs/configuration A comprehensive example demonstrating how to configure Bullstudio with queues, read-only mode, session protection, custom branding, document identity, and polling settings. ```javascript bullstudio({ queues: [emailQueueAdapter], readOnly: true, protection: { type: "session", username: "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, tokenTtlSeconds: 60 * 60 * 8, cookieName: "queue_ops_session", }, dashboardIdentity: { title: "Production Queues", logo: { src: "/assets/queue-logo.svg", alt: "Queue Ops", }, }, documentIdentity: { title: "Queue Ops", favicon: "/favicon.ico", }, polling: { enabled: true, interval: 5000, minInterval: 2000, allowUserOverride: true, }, }); ``` -------------------------------- ### Run Bullstudio with npx Source: https://bullstudio.dev/docs/standalone The simplest way to start Bullstudio is by using npx with a Redis URL. This command starts the dashboard and automatically opens it in your browser. ```bash npx bullstudio -r redis://localhost:6379 ``` -------------------------------- ### Install Fastify Dependencies Source: https://bullstudio.dev/docs/embedded/fastify Install the required packages for Fastify integration with Bullstudio and BullMQ. ```bash pnpm add @bullstudio/fastify @bullstudio/bullmq-adapter bullmq ioredis fastify ``` -------------------------------- ### Install NestJS Platform Adapter (Fastify) Source: https://bullstudio.dev/docs/embedded/nestjs Install the common, core, and Fastify platform adapter packages for NestJS. ```bash pnpm add @nestjs/common @nestjs/core @nestjs/platform-fastify ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://bullstudio.dev/docs/development Clone the Bullstudio repository and install all necessary project dependencies. ```bash git clone https://github.com/emirce/bullstudio.git cd bullstudio pnpm install ``` -------------------------------- ### Install Express and BullMQ Adapter Source: https://bullstudio.dev/docs/embedded Install the necessary packages for Express framework integration and the BullMQ adapter. This includes the Bullstudio express adapter, the BullMQ adapter, BullMQ itself, and ioredis for the connection. ```bash pnpm add @bullstudio/express @bullstudio/bullmq-adapter bullmq ioredis ``` -------------------------------- ### Install Dependencies for Express Source: https://bullstudio.dev/docs/embedded/express Install the necessary Bullstudio packages and their dependencies for Express integration. ```bash pnpm add @bullstudio/express @bullstudio/bullmq-adapter bullmq ioredis express ``` -------------------------------- ### Install NestJS Platform Adapter (Express) Source: https://bullstudio.dev/docs/embedded/nestjs Install the common, core, and Express platform adapter packages for NestJS. ```bash pnpm add @nestjs/common @nestjs/core @nestjs/platform-express ``` -------------------------------- ### Start Redis with Docker Source: https://bullstudio.dev/docs/troubleshooting Run a Redis instance using Docker if you don't have one locally. ```bash docker run --rm -p 6379:6379 redis:7-alpine ``` -------------------------------- ### Install Bullstudio Dependencies for Hono Source: https://bullstudio.dev/docs/embedded/hono Install the necessary packages for integrating Bullstudio with Hono and BullMQ. ```bash pnpm add @bullstudio/hono @bullstudio/bullmq-adapter bullmq ioredis hono @hono/node-server ``` -------------------------------- ### Install Bullstudio Dependencies Source: https://bullstudio.dev/docs/embedded/next Install the necessary Bullstudio packages and BullMQ dependencies for your Next.js project. ```bash pnpm add @bullstudio/next @bullstudio/bullmq-adapter bullmq ioredis ``` -------------------------------- ### Minimal BullMQ Queue Setup Source: https://bullstudio.dev/docs/embedded Set up a BullMQ queue and create an adapter for Bullstudio. This involves establishing a Redis connection and defining the queue with its adapter configuration. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { Queue } from "bullmq"; import IORedis from "ioredis"; const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); export const bullstudioQueues = [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ]; ``` -------------------------------- ### Connect to Redis with username and password Source: https://bullstudio.dev/docs/standalone Example of connecting to a Redis instance that requires both a username and a password. ```bash bullstudio -r redis://username:password@redis.example.com:6379 ``` -------------------------------- ### Run Frontend Dashboard Source: https://bullstudio.dev/docs/development Start the frontend development server for the dashboard. This mounts a standalone API, allowing local UI work to connect to Redis. ```bash pnpm --filter @bullstudio/frontend dev ``` -------------------------------- ### Connect to Redis with password Source: https://bullstudio.dev/docs/standalone Example of connecting to a Redis instance that requires a password. ```bash bullstudio -r redis://:password@redis.example.com:6379 ``` -------------------------------- ### Configure Bullstudio with CLI options Source: https://bullstudio.dev/docs/standalone Customize Bullstudio's behavior using command-line flags. This example sets the Redis URL, port, specific prefixes, and enables basic authentication. ```bash bullstudio \ --redis redis://localhost:6379 \ --port 4000 \ --prefix bull,stage \ --username operator \ --password secret \ --no-open ``` -------------------------------- ### Install Bullstudio and BullMQ Dependencies Source: https://bullstudio.dev/docs/embedded/nestjs Install the necessary Bullstudio, BullMQ adapter, BullMQ, and Redis packages for your NestJS application. ```bash pnpm add @bullstudio/nestjs @bullstudio/bullmq-adapter bullmq ioredis ``` -------------------------------- ### Run Bullstudio in Docker Source: https://bullstudio.dev/docs/standalone Deploy Bullstudio using Docker. This example maps the container port to the host and connects to a Redis instance running on the host machine. ```bash docker run --rm \ -p 4000:4000 \ -e REDIS_URL=redis://host.docker.internal:6379 \ emirce/bullstudio ``` -------------------------------- ### Start Redis with Docker Compose Source: https://bullstudio.dev/docs/development Start the Redis service in detached mode using the provided Docker Compose file. ```bash docker compose -f docker-compose.test.yml up -d redis ``` -------------------------------- ### Connect to Redis using TLS Source: https://bullstudio.dev/docs/standalone Example of connecting to a Redis instance over a secure TLS connection. ```bash bullstudio -r rediss://username:password@redis.example.com:6380 ``` -------------------------------- ### BullMQ Queue Module Setup Source: https://bullstudio.dev/docs/embedded/next Configure the BullMQ queue connection and define the email queue using IORedis. Ensure the REDIS_URL environment variable is set. ```typescript // lib/queue.ts import { Queue } from "bullmq"; import IORedis from "ioredis"; export const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); export const emailQueue = new Queue("email", { connection }); ``` -------------------------------- ### Docker Compose configuration for Bullstudio Source: https://bullstudio.dev/docs/standalone Define Bullstudio and its Redis dependency using Docker Compose. This setup includes environment variables for authentication. ```yaml services: bullstudio: image: emirce/bullstudio ports: - "4000:4000" environment: REDIS_URL: redis://redis:6379 BULLSTUDIO_USERNAME: operator BULLSTUDIO_PASSWORD: secret depends_on: - redis redis: image: redis:7-alpine ports: - "6379:6379" ``` -------------------------------- ### Configure polling interval Source: https://bullstudio.dev/docs/standalone Adjust the polling interval for live data updates. This example sets the interval to 10 seconds, overriding the default. ```bash # Poll every 10s instead of the 2s default BULLSTUDIO_POLL_INTERVAL=10000 bullstudio -r redis://localhost:6379 ``` -------------------------------- ### Configure Bullstudio Embedded Authentication Source: https://bullstudio.dev/docs/troubleshooting Enable dashboard protection by configuring username and password in the embedded setup. ```javascript protection: { type: "session", username: "operator", password: "secret", } ``` -------------------------------- ### Next.js Route Handler for Bullstudio Source: https://bullstudio.dev/docs/embedded/next Create a catch-all route handler in Next.js to mount Bullstudio. This example configures Bullstudio with a specific mount path, queues, and session-based protection. ```typescript // app/ops/bullstudio/[[...bullstudio]]/route.ts import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { bullstudio } from "@bullstudio/next"; import { emailQueue } from "@/lib/queue"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; export const { GET, HEAD, POST } = bullstudio({ mountPath: "/ops/bullstudio", queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }); ``` -------------------------------- ### Bullstudio health check response Source: https://bullstudio.dev/docs/standalone Example of a successful health check response from Bullstudio. ```json { "status": "ok", "timestamp": "2026-06-01T10:00:00.000Z", "redis": "configured" } ``` -------------------------------- ### Enable Metrics for Bull v4 Queue Source: https://bullstudio.dev/docs/operating-dashboard Configure the `metrics` option on a Bull v4 queue to maintain accurate per-minute completed and failed job counts. This example sets data points for two weeks. ```javascript import Bull from "bull"; const queue = new Bull("email", { // Two weeks of per-minute data points (60 * 24 * 14). metrics: { maxDataPoints: 20160 }, }); ``` -------------------------------- ### Mount Bullstudio Dashboard in Express Source: https://bullstudio.dev/docs/embedded/express Configure and mount the Bullstudio dashboard as middleware in an Express application. Requires Redis connection and queue setup. ```typescript import { createBullMqQueueAdapter, } from "@bullstudio/bullmq-adapter"; import { bullstudio } from "@bullstudio/express"; import { Queue } from "bullmq"; import express from "express"; import IORedis from "ioredis"; const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); const app = express(); app.use( "/ops/bullstudio", bullstudio({ queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }), ); const server = app.listen(3000); ``` -------------------------------- ### Mount Bullstudio Directly in NestJS Source: https://bullstudio.dev/docs/embedded/nestjs Configure Bullstudio using `forRoot` when queue adapters can be created directly without relying on NestJS dependency injection. This example sets up a Redis connection and an email queue. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { BullstudioModule } from "@bullstudio/nestjs"; import { Module } from "@nestjs/common"; import { Queue } from "bullmq"; import IORedis from "ioredis"; const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); @Module({ imports: [ BullstudioModule.forRoot({ mountPath: "/ops/bullstudio", queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }), ], }) export class AppModule {} ``` -------------------------------- ### Production Baseline Configuration Source: https://bullstudio.dev/docs/embedded Configure Bullstudio for production with a stable mount path, read-only mode, and explicit credentials for security. This setup includes dashboard and document identity configurations. ```typescript bullstudio({ queues: bullstudioQueues, readOnly: true, protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME!, password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, dashboardIdentity: { title: "Production Queues", }, documentIdentity: { title: "Queue Ops", favicon: "/favicon.ico", }, }); ``` -------------------------------- ### Mount Bullstudio with Dependency Injection in NestJS Source: https://bullstudio.dev/docs/embedded/nestjs Configure Bullstudio using `forRootAsync` when queues are managed by NestJS dependency injection. This example demonstrates setting up a Redis connection and an email queue. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { BullstudioModule } from "@bullstudio/nestjs"; import { Module } from "@nestjs/common"; import { Queue } from "bullmq"; import IORedis from "ioredis"; export const REDIS_CONNECTION = Symbol("REDIS_CONNECTION"); export const EMAIL_QUEUE = Symbol("EMAIL_QUEUE"); @Module({ providers: [ { provide: REDIS_CONNECTION, useFactory: () => new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }), }, { provide: EMAIL_QUEUE, inject: [REDIS_CONNECTION], useFactory: (connection: IORedis) => new Queue("email", { connection }), }, ], exports: [REDIS_CONNECTION, EMAIL_QUEUE], }) export class QueueModule {} @Module({ imports: [ QueueModule, BullstudioModule.forRootAsync({ imports: [QueueModule], inject: [EMAIL_QUEUE], useFactory: (emailQueue: Queue) => ({ mountPath: "/ops/bullstudio", queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }), }), ], }) export class AppModule {} ``` -------------------------------- ### Run Docs Locally Source: https://bullstudio.dev/docs/development Serve the documentation site locally. The site is located in `apps/website-with-docs`. ```bash pnpm --filter website-with-docs dev ``` -------------------------------- ### Generate Sample Bull Jobs (Windows PowerShell) Source: https://bullstudio.dev/docs/development Seed local Redis with queues and jobs for realistic dashboard data on Windows PowerShell. ```powershell $env:REDIS_URL = "redis://localhost:6379" pnpm --filter ./packages/cli generate:bull-jobs ``` -------------------------------- ### Configure Bullstudio Standalone Authentication Source: https://bullstudio.dev/docs/troubleshooting Set username and password via command-line arguments for standalone Bullstudio. ```bash bullstudio --username operator --password secret ``` -------------------------------- ### Create BullMQ Queue Adapter Source: https://bullstudio.dev/docs/queue-adapters Create an adapter for a BullMQ queue. Ensure the queue is initialized with a connection. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { Queue } from "bullmq"; const emailQueue = new Queue("email", { connection }); const emailQueueAdapter = createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }); ``` -------------------------------- ### Use Custom Keys for Adapters Source: https://bullstudio.dev/docs/queue-adapters Configure Bullstudio with multiple adapters, using custom keys and labels to differentiate queues, especially when queue names might collide. ```typescript bullstudio({ queues: [ createBullMqQueueAdapter(emailPrimaryQueue, { key: "email-primary", label: "Email Primary", }), createBullMqQueueAdapter(emailBackfillQueue, { key: "email-backfill", label: "Email Backfill", }), ], }); ``` -------------------------------- ### Run Formatting and Check Commands Source: https://bullstudio.dev/docs/development Apply code formatting cleanup and run general checks for project consistency. ```bash pnpm format pnpm check ``` -------------------------------- ### Generate Sample Bull Jobs Source: https://bullstudio.dev/docs/development Seed local Redis with queues and jobs for realistic dashboard data. This command uses the CLI package. ```bash REDIS_URL=redis://localhost:6379 pnpm --filter ./packages/cli generate:bull-jobs ``` -------------------------------- ### Run Frontend Dashboard with Custom Redis URL Source: https://bullstudio.dev/docs/development Configure the frontend development server to use a specific Redis instance by setting the REDIS_URL environment variable. ```bash REDIS_URL=redis://localhost:6379 pnpm --filter @bullstudio/frontend dev ``` -------------------------------- ### Configure Bullstudio with environment variables Source: https://bullstudio.dev/docs/standalone Set Bullstudio's configuration using environment variables. This is useful for containerized environments or when managing settings externally. ```bash REDIS_URL=redis://localhost:6379 \ PORT=4000 \ REDIS_PREFIX=bull,stage \ BULLSTUDIO_USERNAME=operator \ BULLSTUDIO_PASSWORD=secret \ bullstudio ``` -------------------------------- ### Configure Bullstudio with Custom Prefix Source: https://bullstudio.dev/docs/troubleshooting When using a custom Redis prefix for your queues, specify it in the Bullstudio command. ```bash bullstudio --redis redis://localhost:6379 --prefix bull,stage ``` -------------------------------- ### Create Bull v4 Queue Adapter Source: https://bullstudio.dev/docs/queue-adapters Create an adapter for a Bull v4 queue. Ensure the queue is initialized with Redis connection details. ```typescript import { createBullQueueAdapter } from "@bullstudio/bull-adapter"; import Bull from "bull"; const emailQueue = new Bull("email", { redis: process.env.REDIS_URL, }); const emailQueueAdapter = createBullQueueAdapter(emailQueue, { key: "email", label: "Email", }); ``` -------------------------------- ### Run Frontend Dashboard with Custom Redis URL (Windows PowerShell) Source: https://bullstudio.dev/docs/development Configure the frontend development server to use a specific Redis instance on Windows PowerShell by setting the REDIS_URL environment variable. ```powershell $env:REDIS_URL = "redis://localhost:6379" pnpm --filter @bullstudio/frontend dev ``` -------------------------------- ### Run Docs Checks Source: https://bullstudio.dev/docs/development Perform type checking and build checks for the documentation site before changing its structure or components. ```bash pnpm --filter website-with-docs types:check pnpm --filter website-with-docs build ``` -------------------------------- ### Configure Next.js Route for Bullstudio Source: https://bullstudio.dev/docs/troubleshooting Ensure the Next.js route file path matches the `mountPath` option for Bullstudio. ```typescript // app/ops/bullstudio/[[...bullstudio]]/route.ts export const { GET, HEAD, POST } = bullstudio({ mountPath: "/ops/bullstudio", queues: [emailQueueAdapter], }); ``` -------------------------------- ### Reinstall Dependencies Source: https://bullstudio.dev/docs/development If dependency versions appear inconsistent, reinstall all project dependencies from the repository root. ```bash pnpm install ``` -------------------------------- ### Mount Bullstudio Dashboard in Fastify Source: https://bullstudio.dev/docs/embedded/fastify Mount the Bullstudio dashboard as a Fastify plugin. Ensure Redis connection and queue configurations are correctly set up. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { bullstudio } from "@bullstudio/fastify"; import { Queue } from "bullmq"; import Fastify from "fastify"; import IORedis from "ioredis"; const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); const app = Fastify(); await app.register( bullstudio({ queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }), { prefix: "/ops/bullstudio", }, ); await app.listen({ port: 3000 }); ``` -------------------------------- ### Check Redis Connection Source: https://bullstudio.dev/docs/troubleshooting Use `redis-cli` to verify your Redis server is running and accessible. ```bash redis-cli -u redis://localhost:6379 ping ``` -------------------------------- ### Add test data to a BullMQ queue Source: https://bullstudio.dev/docs/standalone This Node.js script demonstrates how to add a job to a BullMQ queue. It requires `bullmq` and `ioredis` packages. Ensure Redis is running locally. ```javascript import { Queue } from "bullmq"; import IORedis from "ioredis"; const connection = new IORedis("redis://localhost:6379", { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); await emailQueue.add("send-welcome-email", { to: "ada@example.com", template: "welcome", }); await emailQueue.close(); await connection.quit(); ``` -------------------------------- ### Run Integration Tests with Custom Redis URL Source: https://bullstudio.dev/docs/development Execute integration tests, specifying a custom Redis URL. If TEST_REDIS_URL is not set, it defaults to `redis://localhost:6379/15`. ```bash TEST_REDIS_URL=redis://localhost:6379/15 pnpm test ``` -------------------------------- ### Run Project Validation Checks Source: https://bullstudio.dev/docs/development Execute comprehensive checks including type checking, tests, linting, and building for validating changes before a pull request. ```bash pnpm typecheck pnpm test pnpm lint pnpm build ``` -------------------------------- ### Configure ioredis Connection for BullMQ Source: https://bullstudio.dev/docs/troubleshooting Use an `ioredis` connection with `maxRetriesPerRequest: null` for compatibility with BullMQ. ```javascript const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); ``` -------------------------------- ### Configure Unique Queue Keys Source: https://bullstudio.dev/docs/troubleshooting Assign unique keys to queue adapters when multiple instances of the same queue type are used. ```javascript bullstudio({ queues: [ createBullMqQueueAdapter(emailQueue, { key: "email-primary" }), createBullMqQueueAdapter(emailQueueCopy, { key: "email-copy" }), ], }); ``` -------------------------------- ### Configure Bullstudio Embedded Queues Source: https://bullstudio.dev/docs/troubleshooting In embedded mode, explicitly pass each queue adapter to Bullstudio. ```javascript bullstudio({ queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email" }), createBullMqQueueAdapter(reportQueue, { key: "reports", label: "Reports" }), ], }); ``` -------------------------------- ### Regenerate Sample Bull Jobs Source: https://bullstudio.dev/docs/development If the dashboard shows no queues, confirm that Redis has test data by regenerating sample Bull jobs. ```bash pnpm --filter ./packages/cli generate:bull-jobs ``` -------------------------------- ### Mount Bullstudio Dashboard in Hono App Source: https://bullstudio.dev/docs/embedded/hono Mount the Bullstudio dashboard as a route in your Hono application. Ensure Redis connection and queue details are correctly configured. ```typescript import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter"; import { bullstudio } from "@bullstudio/hono"; import { serve } from "@hono/node-server"; import { Queue } from "bullmq"; import { Hono } from "hono"; import IORedis from "ioredis"; const connection = new IORedis(process.env.REDIS_URL!, { maxRetriesPerRequest: null, }); const emailQueue = new Queue("email", { connection }); const app = new Hono(); app.route( "/ops/bullstudio", bullstudio({ queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ], protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME ?? "operator", password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, }, }), ); serve({ fetch: app.fetch, port: 3000, }); ``` -------------------------------- ### Configure Session Protection Source: https://bullstudio.dev/docs/configuration Protect embedded dashboards with Bullstudio's built-in session authentication. Configure credentials and session signing explicitly in production using your own secrets. ```javascript protection: { type: "session", username: process.env.BULLSTUDIO_USERNAME!, password: process.env.BULLSTUDIO_PASSWORD!, sessionSecret: process.env.BULLSTUDIO_SESSION_SECRET!, } ``` -------------------------------- ### Configure Polling Settings Source: https://bullstudio.dev/docs/configuration Control how often Bullstudio polls Redis for live updates to manage costs on shared Redis instances. Settings apply globally to all live views. ```javascript polling: { enabled: true, interval: 5000, minInterval: 2000, allowUserOverride: true, } ``` -------------------------------- ### Check Redis Service Status Source: https://bullstudio.dev/docs/development Verify that the Redis service is running and accessible. ```bash docker compose -f docker-compose.test.yml ps ``` -------------------------------- ### Configure Queue Visibility Source: https://bullstudio.dev/docs/configuration Specify which queues appear in the embedded dashboard by passing queue adapters. Bullstudio does not scan Redis in embedded mode. ```javascript queues: [ createBullMqQueueAdapter(emailQueue, { key: "email", label: "Email", }), ] ``` -------------------------------- ### Create BullMQ Worker Source: https://bullstudio.dev/docs/troubleshooting Ensure a BullMQ worker is running to process jobs added to the queue. ```javascript import { Worker } from "bullmq"; const worker = new Worker( "email", async (job) => { await sendEmail(job.data); }, { connection }, ); ``` -------------------------------- ### Graceful Shutdown of Express Server and Queues Source: https://bullstudio.dev/docs/embedded/express Implement a shutdown function to close the Express server, BullMQ queues, and Redis connections gracefully. This ensures all resources are released properly. ```typescript async function shutdown() { await new Promise((resolve, reject) => { server.close((error) => (error ? reject(error) : resolve())); }); await emailQueue.close(); await connection.quit(); } ``` -------------------------------- ### Check Bullstudio health status Source: https://bullstudio.dev/docs/standalone Use this endpoint to verify if Bullstudio is running and connected to Redis. ```bash curl http://localhost:4000/health ``` -------------------------------- ### Shutdown Fastify Application and Resources Source: https://bullstudio.dev/docs/embedded/fastify Gracefully close the Fastify application, the BullMQ queue, and the Redis connection. ```typescript async function shutdown() { await app.close(); await emailQueue.close(); await connection.quit(); } ``` -------------------------------- ### Enable Metrics for BullMQ Worker Source: https://bullstudio.dev/docs/operating-dashboard Enable the `metrics` option on a BullMQ worker to ensure accurate throughput and failure rate tracking. This configuration persists metrics even after jobs are removed. ```typescript import { MetricsTime, Worker } from "bullmq"; const worker = new Worker( "email", async (job) => { await sendEmail(job.data); }, { connection, metrics: { maxDataPoints: MetricsTime.ONE_WEEK }, }, ); ``` -------------------------------- ### Customize Document Identity Source: https://bullstudio.dev/docs/configuration Set the browser tab title and favicon for the dashboard to match your application or environment. ```javascript documentIdentity: { title: "Queue Ops", favicon: "/favicon.ico", } ``` -------------------------------- ### Handle SIGTERM for Queue Cleanup Source: https://bullstudio.dev/docs/queue-adapters Gracefully shut down queues and Redis connections when the process receives a SIGTERM signal. This ensures resources are released properly. ```typescript process.once("SIGTERM", async () => { await emailQueue.close(); await connection.quit(); process.exit(0); }); ``` -------------------------------- ### Disable Built-in Auth Source: https://bullstudio.dev/docs/configuration Disable Bullstudio's authentication when the host application already protects the mount path. ```javascript protection: { type: "disabled", } ``` -------------------------------- ### Customize Dashboard Identity Source: https://bullstudio.dev/docs/configuration Set the title and logo that operators see within the dashboard interface. ```javascript dashboardIdentity: { title: "Queue Ops", logo: { src: "/assets/queue-logo.svg", alt: "Queue Ops", }, } ``` -------------------------------- ### Enable Read-Only Mode Source: https://bullstudio.dev/docs/configuration Use read-only mode to allow operators to inspect queues without altering job or queue states. This blocks mutating operations. ```javascript readOnly: true ``` -------------------------------- ### Shutdown BullMQ Queue and Redis Connection Source: https://bullstudio.dev/docs/embedded/hono Gracefully close the BullMQ queue and the Redis connection when shutting down the application to release resources. ```typescript async function shutdown() { await emailQueue.close(); await connection.quit(); } ``` -------------------------------- ### Disable polling Source: https://bullstudio.dev/docs/standalone Turn off automatic polling to reduce Redis load. Views will need to be manually refreshed. ```bash # Disable polling; operators refresh each view manually BULLSTUDIO_POLL_ENABLED=false bullstudio -r redis://localhost:6379 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.