Trigger.dev runs long-running background jobs in TypeScript. No queue setup, no worker management, no Redis. Define a task, trigger it from your app, monitor in the dashboard.
Quick Start
npx trigger.dev@latest init
Define a Task
import { task } from '@trigger.dev/sdk/v3'
export const processOrder = task({
id: 'process-order',
run: async (payload: { orderId: string }) => {
// This runs in the background, not in your request handler
const order = await db.orders.findUnique({ where: { id: payload.orderId } })
await sendConfirmationEmail(order.email)
await updateInventory(order.items)
await notifyShipping(order)
return { processed: true }
}
})
Trigger from Your App
import { processOrder } from './trigger/process-order'
// In your API route
app.post('/orders', async (req, res) => {
const order = await db.orders.create({ data: req.body })
// Fire and forget — runs in background
await processOrder.trigger({ orderId: order.id })
res.json({ status: 'created' }) // Responds immediately
})
Scheduled Tasks (CRON)
import { schedules } from '@trigger.dev/sdk/v3'
export const dailyReport = schedules.task({
id: 'daily-report',
cron: '0 9 * * *', // 9 AM daily
run: async () => {
const stats = await calculateDailyStats()
await sendSlackMessage(stats)
}
})
Retry and Error Handling
export const riskyTask = task({
id: 'risky-task',
retry: { maxAttempts: 3, minTimeoutInMs: 1000, factor: 2 },
run: async (payload) => {
// Automatically retries on failure with exponential backoff
await callUnreliableAPI(payload)
}
})
Free Tier
| Feature | Free | Pro ($30/mo) |
|---|---|---|
| Tasks | Unlimited | Unlimited |
| Runs | 1,000/month | 25,000/month |
| Concurrency | 5 | 100 |
| Log retention | 7 days | 30 days |
The Bottom Line
Trigger.dev replaces BullMQ + Redis + worker infrastructure with TypeScript functions. If you need background jobs in a serverless world, this is the simplest path.
Need to automate data collection or build custom scrapers? Check out my Apify actors for ready-made tools, or email spinov001@gmail.com for custom solutions.
Top comments (0)