Queuebase is now live! Read the announcement.

Background Jobs for Next.js

The easiest way to run background jobs in Next.js. Define type-safe jobs with a TypeScript API, add retries and scheduling, and start processing in minutes. Works with Vercel, serverless, and any Node.js hosting.

npm install @queuebase/nextjs

Overview

Your job processing at a glance

Total Jobs

1,247

Successful

1,198

Failed

12

Avg Duration

340ms

Recent Jobs View all
sendEmail
2s ago
processPayment
14s ago
generateReport
1m ago
syncInventory
3m ago
Quick Start
Create a project
View documentation

Everything you need to process background jobs

A type-safe job queue for Next.js and TypeScript. Read the docs to learn more.

Type-Safe by Default

A tRPC-inspired TypeScript API with Zod validation. Full type safety from job definition to enqueue — catch errors at build time, not runtime.

Runs on Your Infrastructure

Jobs execute in your own app via a callback model. No vendor lock-in for execution, no cold starts, full access to your database and services.

Automatic Retries

Failed jobs are automatically retried with configurable exponential or linear backoff. Set max attempts, delays, and backoff strategies per job.

Real-Time Monitoring

Track job status, view run history, and monitor performance from the Queuebase dashboard. See what's running, what succeeded, and what needs attention.

CRON Scheduling

Coming soon

Schedule recurring jobs with familiar CRON syntax. Perfect for reports, data syncs, and cleanup tasks.

Webhook Notifications

Coming soon

Get notified via webhooks when jobs complete, fail, or need attention. Integrate with Slack, PagerDuty, or any HTTP endpoint.

Get started in minutes

Inspired by the developer experience of tRPC and UploadThing. Define your jobs, create a handler, and start processing — all with full type safety.

src/jobs/index.ts
import { createJobRouter, job } from '@queuebase/nextjs';
import { z } from 'zod';

export const jobs = createJobRouter({
  sendEmail: job({
    input: z.object({
      to: z.string().email(),
      subject: z.string(),
      body: z.string(),
    }),
    handler: async ({ input, jobId, attempt }) => {
      console.log(`Sending email to ${input.to}`);
      await sendEmail(input);
      return { sent: true };
    },
    defaults: {
      retries: 3,
      backoff: 'exponential',
    },
  }),
});

export type JobRouter = typeof jobs;
1

Define your jobs

Define your jobs using a tRPC-style router. Each job has a Zod schema for input validation and a handler function that runs when the job executes.

src/app/api/queuebase/route.ts
import { createHandler } from '@queuebase/nextjs/handler';
import { jobs } from '@/jobs';

export const POST = createHandler(jobs);
2

Create your API handler

Expose a POST endpoint that Queuebase calls to execute your jobs. One line of code — the handler takes care of routing, validation, and execution.

src/jobs/client.ts
import { createClient } from '@queuebase/nextjs';
import { jobs } from './index';

export const jobClient = createClient(jobs, {
  apiUrl: process.env.QUEUEBASE_API_URL!,
  apiKey: process.env.QUEUEBASE_API_KEY,
  callbackUrl: process.env.QUEUEBASE_CALLBACK_URL!,
});
3

Create your client

The client gives you type-safe access to enqueue jobs from anywhere in your app — server components, server actions, or API routes.

src/app/actions.ts
'use server';

import { jobClient } from '@/jobs/client';

export async function sendWelcomeEmail() {
  await jobClient.sendEmail.enqueue({
    to: 'user@example.com',
    subject: 'Welcome to our app!',
    body: 'Thanks for signing up.',
  });
}
4

Enqueue a job

Enqueue jobs with full type safety. Your IDE autocompletes job names, validates input shapes, and catches errors at build time.

Frequently asked questions

Can't find what you're looking for? Reach out on Twitter or email support@queuebase.com .

How do I run background jobs in Next.js?
Next.js runs on serverless infrastructure, which means long-running tasks can timeout. Queuebase solves this with a callback model — you define jobs in your app, and Queuebase orchestrates execution by calling back to your endpoint. Your jobs run on your own infrastructure with no timeout limits. See the documentation to get started.
Can I use Queuebase with Vercel?
Yes! Queuebase works great with Vercel deployments. Since Queuebase calls back to your app’s API route, it works with any hosting platform — Vercel, Railway, Fly.io, Docker, or self-hosted servers.
Does Queuebase support retries and error handling?
Yes. Failed jobs are automatically retried with configurable backoff strategies. You can set max retry attempts, choose between exponential or linear backoff, and configure delays per job. Learn more in the docs.
Does Queuebase support CRON jobs?
CRON scheduling is on our roadmap and coming soon. Follow our roadmap for updates.
Does Queuebase work with the Next.js App Router and Pages Router?
Queuebase currently supports the App Router with a standard route handler. Pages Router support is planned for an upcoming release.
Do I have to use Next.js?
Queuebase is optimized for Next.js but also has a Node.js package for use with Express, Fastify, and other frameworks. Support for SvelteKit, Nuxt, and more is planned. Check the roadmap for updates.
How much does Queuebase cost?
Queuebase has a generous free tier with 10,000 job runs per month, 5 concurrent jobs, and 7 days of log retention. No credit card required. Paid plans are available for higher volume and longer retention. See pricing for details.
How does Queuebase compare to Inngest, Trigger.dev, and BullMQ?
Queuebase focuses on simplicity and developer experience for Next.js. Unlike BullMQ, you don’t need to manage Redis. Unlike Inngest and Trigger.dev, your jobs run on your own infrastructure. Check out our comparison pages for Inngest and Trigger.dev.
Who’s behind Queuebase?
Queuebase is built by Brock Herion and Queuebase LLC. We’re passionate about making background job processing simple for web developers.

Start running background jobs today

Start with 10,000 free job runs per month. No credit card required.