MainSDK
Search⌘K
Integrations

Trigger.dev

Use Trigger.dev for MainSDK background jobs - a planned driver with setup, main.yaml, retries, local testing and swapping.

1 interface1 driverWritten guide
Updated 2026-10-28

Trigger.dev is an open-source background jobs platform, hosted or self-hosted, and a planned driver behind events and jobs. Pick it when your team already runs long or heavy tasks on Trigger.dev and wants MainSDK's idempotency and dead letters on top.

Interfaces it serves

Pick Trigger.dev in main.yaml for any of these. Your calls stay the same, and you can swap later.

Before you start

  1. Create a Trigger.dev project, hosted or on your own instance.
  2. Copy the secret key for each environment (development, staging, production) into your secrets manager.

Configure

main.yaml
jobs:
  driver: trigger-dev   # [to be decided] key and project settings; suggested secret name TRIGGER_SECRET_KEY
  dead-letter: true

Use it

app/orders/ship.ts
import { jobs } from "mainsdk";

export async function queueLabel(orderId: string) {
  await jobs.run("orders.print-label", { orderId }, { idempotencyKey: `label:${orderId}` });
}

Local development and testing

Use the in-process local queue in development; mainsdk check refuses it in production. In tests, createTestApp() from @mainsdk/testing runs jobs on a fake, and chaos.on("jobs", { outage: true }) simulates Trigger.dev being down.

What MainSDK adds on top

  • Retries with backoff and a dead-letter queue.
  • A duplicate key never runs the side effect twice.
  • CloudEvents envelope with versioned schemas for events.

See Events and background jobs.

Limits and notes

  • Planned driver, not in the spec yet: the spec defers it to the driver kit.
  • Job inputs are stored by Trigger.dev or your own instance; choose a location that fits your region.

Swap to or from it

main.yaml
jobs:
  driver: trigger-dev   # was inngest

FAQ

Can I use Trigger.dev today? Not through MainSDK until the driver ships; check the drivers list for its status.

Will my task code change? No. You keep calling jobs.run() and jobs.schedule().

Next

Open questions

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet