# 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. ## Install Save as a script file and run: ## Quick Use ```bash npx trigger.dev@latest init ``` ```typescript // 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 }; }, }); ``` ```typescript // 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 ```typescript 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) ```typescript export const dailyCleanup = schedules.task({ id: "daily-cleanup", cron: "0 2 * * *", // 2 AM daily run: async () => { await deleteExpiredSessions(); await cleanupTempFiles(); }, }); ``` ### Retries and Error Handling ```typescript 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 ```bash # 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](https://github.com/triggerdotdev). Licensed under Apache 2.0. > > [trigger.dev](https://github.com/triggerdotdev/trigger.dev) — stars 10,000+ Thanks for making background jobs as simple as writing a function. --- ## 快速使用 ```bash npx trigger.dev@latest init ``` ```typescript export const syncData = task({ id: "sync-data", retry: { maxAttempts: 3 }, run: async (payload) => { await fetchAndSync(payload.userId); }, }); ``` --- ## 简介 Trigger.dev 是一个开源 TypeScript 后台任务框架,GitHub 10,000+ stars。编写长时间运行任务,内置重试、定时调度和可观测性。零基础设施管理,无需 Redis。适合需要后台处理的 TypeScript 团队。 --- ## 来源与感谢 > Created by [Trigger.dev](https://github.com/triggerdotdev). Licensed under Apache 2.0. > > [trigger.dev](https://github.com/triggerdotdev/trigger.dev) — stars 10,000+ --- Source: https://tokrepo.com/en/workflows/1290f820-eb6a-4d56-a572-700fd1a65d38 Author: Script Depot