### Build and start OpenQueue for production Source: https://openqueue.dev Compile a self-contained server artifact and run it in a production environment. ```bash $ openqueue build && openqueue start ``` -------------------------------- ### Run OpenQueue in development Source: https://openqueue.dev Start the development worker to discover tasks and serve the Workbench locally. ```bash $ openqueue dev ``` -------------------------------- ### Initialize and run OpenQueue development Source: https://openqueue.dev Scaffold a new project using the CLI and start the development worker with hot reloading. ```zsh $ bunx @openqueue/cli init created worker.config.ts created worker/example.ts OpenQueue initialized $ openqueue dev [openqueue] 3 tasks · 2 queues · 1 schedule [openqueue] workbench on http://localhost:8090/workbench [openqueue] watching ./worker for changes ✓ export-csv r_3aa16 · 284ms ✓ sync-contacts r_3aa15 · 1.2s ✗ export-csv r_3aa14 · attempt 2/3 · retrying in 2s ``` -------------------------------- ### Initialize OpenQueue project Source: https://openqueue.dev Use the CLI to initialize a new OpenQueue project. ```bash bunx @openqueue/cli init ``` -------------------------------- ### Embed OpenQueue in a server Source: https://openqueue.dev Mount the dashboard into an existing application using adapters or a fetch handler. ```javascript $ import { workbench } from '…/next' ``` -------------------------------- ### Define and trigger a task with worker/export-csv.ts Source: https://openqueue.dev Define a task using the task function with Zod schema validation, retry logic, and backoff settings. The trigger method provides a type-safe way to execute the job from anywhere in the application. ```typescript import { task } from '@openqueue/sdk'; import { z } from 'zod'; export const exportCsv = task({ id: 'export-csv', schema: z.object({ reportId: z.string(), format: z.enum(['csv', 'xlsx']), }), attempts: 5, backoff: { type: 'exponential', delay: 1000 }, run: async (payload, ctx) => { ctx.logger.info('building report', { id: payload.reportId }); const file = await build(payload); await ctx.progress({ step: 'uploading' }); return { url: file.url }; }, }); // anywhere in your app — typed, validated, durable await exportCsv.trigger({ reportId: 'rep_812', format: 'csv' }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.