Creating a Client
The client is how you enqueue jobs from your application code. It’s fully typed — each job in the router becomes a property with an .enqueue() method whose input type is inferred from the Zod schema.
import { createClient } from "@queuebase/nextjs"; // or @queuebase/nodeimport { jobs } from "./jobs";
export const jobClient = createClient(jobs, { apiUrl: "http://localhost:3847", callbackUrl: "http://localhost:3000/api/queuebase", apiKey: undefined, // required in production});Configuration
Section titled “Configuration”| Parameter | Type | Description |
|---|---|---|
apiUrl | string | Queuebase API URL. In dev: http://localhost:3847 |
callbackUrl | string | Your app’s webhook endpoint (e.g. http://localhost:3000/api/queuebase) |
apiKey | string | undefined | API key for authenticating with the Queuebase API. Required in production. |
In practice, pull these from environment variables:
export const jobClient = createClient(jobs, { apiUrl: process.env.QUEUEBASE_API_URL ?? "http://localhost:3847", apiKey: process.env.QUEUEBASE_API_KEY, callbackUrl: process.env.QUEUEBASE_CALLBACK_URL ?? "http://localhost:3000/api/queuebase",});See Configuration for the full list of environment variables.