ScriptsApr 7, 2026·2 min read

Trigger.dev — Background Jobs for TypeScript Apps

Open-source background job framework for TypeScript. Write long-running tasks with retries, scheduling, and observability. No infrastructure to manage. Deploy alongside your Next.js app. 10,000+ stars.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

npx trigger.dev@latest init
// trigger/tasks/sync-data.ts
import { task } from "@trigger.dev/sdk/v3";

export const syncData = task({
  id: "sync-data",
  retry: { maxAttempts: 3, factor: 2 },
  run: async (payload: { userId: string }) => {
    // This runs in the background — can take minutes or hours
    const data = await fetchExternalAPI(payload.userId);
    await updateDatabase(data);
    return { synced: data.length };
  },
});
// In your API route or server action
import { syncData } from "@/trigger/tasks/sync-data";

await syncData.trigger({ userId: "user_123" });
// Returns immediately — task runs in background

Intro

Trigger.dev is an open-source background job framework for TypeScript that lets you write long-running tasks with retries, scheduling, and full observability with 10,000+ GitHub stars. Unlike BullMQ or Celery, you write jobs as regular TypeScript functions with zero infrastructure to manage — no Redis, no workers, no queue servers. Deploy alongside your Next.js or Node.js app. Best for TypeScript teams who need background processing without the DevOps overhead. Works with: Next.js, Remix, Express, any Node.js app. Setup time: under 5 minutes.


Why Trigger.dev

Old Way Trigger.dev
Redis + BullMQ + Worker Just TypeScript functions
Manage queue infrastructure Zero infrastructure
Custom retry logic Built-in retries and backoff
Build your own dashboard Full observability UI
Cron via OS or Lambda Built-in scheduling

Background Tasks

export const generateReport = task({
  id: "generate-report",
  run: async (payload: { month: string }) => {
    const data = await queryDatabase(payload.month);    // 30 seconds
    const pdf = await generatePDF(data);                // 2 minutes
    const url = await uploadToS3(pdf);                  // 10 seconds
    await sendEmail({ to: "team@company.com", attachment: url });
    return { url };
  },
});

Scheduling (Cron)

export const dailyCleanup = schedules.task({
  id: "daily-cleanup",
  cron: "0 2 * * *",  // 2 AM daily
  run: async () => {
    await deleteExpiredSessions();
    await cleanupTempFiles();
  },
});

Retries and Error Handling

export const processPayment = task({
  id: "process-payment",
  retry: {
    maxAttempts: 5,
    factor: 2,         // Exponential backoff
    minTimeout: 1000,  // Start at 1s
    maxTimeout: 60000, // Max 60s between retries
  },
  run: async (payload) => {
    // Automatically retries on failure
    await stripeCharge(payload);
  },
});

Observability Dashboard

Real-time dashboard showing:

  • Active, completed, failed runs
  • Execution timeline
  • Logs and errors per run
  • Retry history
  • Queue depth

Deploy Options

# Self-hosted (Docker)
docker compose up -d

# Trigger.dev Cloud (managed)
npx trigger.dev@latest deploy

Key Stats

  • 10,000+ GitHub stars
  • Zero infrastructure needed
  • Built-in retries, cron, observability
  • TypeScript-native
  • Self-hosted or cloud

FAQ

Q: What is Trigger.dev? A: An open-source background job framework for TypeScript with retries, scheduling, and observability — no Redis or queue infrastructure needed.

Q: Is Trigger.dev free? A: Open-source and free to self-host. Cloud plan has a free tier.

Q: How is it different from BullMQ? A: BullMQ requires Redis and worker management. Trigger.dev needs zero infrastructure — just TypeScript functions with a built-in dashboard.


🙏

Source & Thanks

Created by Trigger.dev. Licensed under Apache 2.0.

trigger.dev — stars 10,000+

Thanks for making background jobs as simple as writing a function.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets