Trigger.dev v3 early access

The open source Background Jobs framework for TypeScript

Create long-running jobs directly in your codebase with features like API integrations, webhooks, scheduling and delays.

Get started now

Supported frameworks

  • subscription.ts
    1
    client.defineJob({
    2
    id: "subscription-plan-changed",
    3
    name: "Subscription plan changed",
    4
    version: "0.1.1",
    5
    integrations: { slack, resend },
    6
    trigger: stripe.customer.subscriptionUpdated(),
    7
    run: async (payload, io, ctx) => {
    8
    const user = await db.users.find({ stripeId: payload.customer });
    9
    10
    const planId = getNewPlanId(payload);
    11
    12
    if (user.planId !== planId) {
    13
    await db.users.update(user.id, { planId });
    14
    15
    await io.resend.sendEmail("Plan changed email", {
    16
    to: user.email,
    17
    18
    subject: "Your plan has changed",
    19
    html: planEmail(payload),
    20
    });
    21
    22
    if (isPlanUpgraded(user.planId, planId)) {
    23
    await io.slack.postMessage("Notify team", {
    24
    text: `Plan upgraded for ${user.email} to ${planId}`,
    25
    channel: "subscriptions",
    26
    });
    27
    }
    28
    }
    29
    },
    30
    });

    Webhook Trigger

    When a customer's Stripe subscription updates, check if their plan has changed. If it has, update it in your database, send them an email, and notify the team of upgrades.

  • tweet-generator.ts
    1
    client.defineJob({
    2
    id: "tweet-generator",
    3
    name: "Generate tweets from an idea",
    4
    version: "0.1.4",
    5
    integrations: { openai, twitter },
    6
    trigger: eventTrigger({
    7
    name: "tweet.idea",
    8
    schema: z.object({
    9
    idea: z.string(),
    10
    scheduledTime: z.date(),
    11
    }),
    12
    }),
    13
    run: async (payload, io, ctx) => {
    14
    const generatedTweet = await io.openai.createCompletion("Generate ✨", {
    15
    model: "text-davinci-003",
    16
    prompt: tweetPrompt(payload.idea),
    17
    });
    18
    19
    await io.wait("Wait 🕘", { date: payload.scheduledTime });
    20
    21
    await io.twitter.tweet("Tweet 🐥", {
    22
    text: generatedTweet,
    23
    });
    24
    },
    25
    });
    26
    // Send the "tweet.idea" event to trigger the tweet-generator job
    27
    await client.sendEvent("tweet.idea", {
    28
    idea: "Write a funny javascript joke",
    29
    scheduledTime: new Date(),
    30
    });

    Event Trigger

    When one of your users submits an idea, generate a tweet using OpenAI. Wait until the time they selected, then send the tweet using their Twitter authentication.

  • weeky-summary.ts
    1
    client.defineJob({
    2
    id: "weekly-user-activity-summary",
    3
    name: "Weekly user activity summary",
    4
    version: "0.1.4",
    5
    integrations: { sendgrid },
    6
    trigger: cronTrigger({
    7
    cron: "0 16 * * 5",
    8
    }),
    9
    run: async (payload, io, ctx) => {
    10
    const users = await db.users.findMany({ summariesEnabled: true });
    11
    12
    for (const user of users) {
    13
    await io.sendgrid.sendEmail(`Weekly summary for ${user.id}`, {
    14
    to: user.email,
    15
    16
    subject: "Your weekly summary",
    17
    html: weeklySummaryEmail(user),
    18
    });
    19
    }
    20
    21
    await io.slack.postMessage("Notify team", {
    22
    text: `Weekly summary sent to ${users.length} users`,
    23
    channel: "summaries",
    24
    });
    25
    },
    26
    });

    Scheduled Trigger

    Every Friday at 4pm UTC, get all users who have opted to receive a summary, then send them an email. Notify your team that they've all been sent.

Developer-first features

Trigger.dev is designed to seamlessly fit into your existing workflow.

Long running jobs diagram

Long running jobs on serverless

Reliably run jobs and don’t worry about function timeouts, we handle those for you.

Auto-resume after a function timeout

Auto-resume after a server outage

Add delays of up to a year

In your codebase

Create jobs where they belong: in your codebase. Version control, localhost, test, review, and deploy like you're already used to.

Secure by design

We only receive Triggers and the data you choose to send to us. You can even completely self-host the entire platform.

Trigger.dev cloud diagram

Don't worry about deployment

Just use our SDK to write jobs in your codebase. There's nothing extra to deploy and no CI to configure, your jobs just connect to our cloud. Or you can always self-host.

Retrieved records

Fetching commits

Generate changelog

Show progress with React hooks

Display the real-time status of your long-running jobs anywhere in your UI, so your users always know what’s going on.

Full visibility of every run

View every task in every run so you can tell exactly what happened.

Webapp

Step-by-step

Follow the flow of a job from the trigger to the tasks.

All the details

See the input and output data of every task, including retries and detailed errors.

Re-run jobs

Quickly re-run a job to check if you've fixed a bug.

It all starts with a Trigger

Trigger jobs from a webhook, on a schedule or from a custom event.

Trigger types

Webhooks

Subscribe to webhooks without creating API endpoints

Full types for payloads

Test with examples from the dashboard

Works with localhost without tunneling

On a schedule

Subscribe to a recurring schedule

Use human-readable code or CRON syntax

Events

Define your own custom events

Trigger jobs from anywhere

Type safety as standard

Webhook overlay
client.defineJob({
id: "subscription-plan-changed",
name: "Subscription plan changed",
version: "0.1.1",
integrations: { slack, resend },
trigger:

All the APIs you need

Easily integrate with third-party APIs – including your own.

Use our built-in integrations

Easily subscribe to webhooks and perform any actions you want.

Use an existing Node.js SDK

Use io.runTaskto make it resumable and appear in the dashboard

OAuth or API key authentication

Use API keys (which never leave your server) or let us handle OAuth for you.

Bring-your-own authentication

Supply your user’s auth credentials using Clerk or Nango, or use our custom auth resolvers.

APIs with code examples

We are backed by some of the world’s best investors, founders & operators

Y Combinator
Supabase
PagerDuty
Dropbox
Raycast
Instabug
Atlassian
Amazon Web Services

Our mission

The complete open source background jobs framework

We’re building the most comprehensive and easy-to-use background jobs framework for developers.

Loved by developers

I ****ing love Trigger.dev - really has been the missing piece in the puzzle for me going full serverless.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/d60cc0d1-a132-420a-b7fa-bdb67267f800/public

Pontus Abrahamsson

Midday

Midday + ' logo'

Trigger.dev helps us process bounties & tips on Algora without having to duct-tape queues & crons. With standardized timeouts, retries & logging we get full resilience & observability!

/testimonials/algora/zafer-cesur.png

Zaf Cesur

Algora

Algora + ' logo'

Trigger.dev has become my go-to tool for new projects. I no longer need an additional server and can forget about horizontal scaling!

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/f577a1b5-e9bc-46ae-af2e-517c8ebef700/public

Nevo David

Novu

Novu + ' logo'

For AI powered products, Trigger.dev is my clear go-to tool for building robust serverless pipelines stitching together various LLM calls.

/testimonials/blee/evan-sandler.png

Evan Sandler

Blee

Blee + ' logo'

Trigger.dev is redefining background jobs for modern developers.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/e82deee8-b8ec-4092-3980-b268688d1900/public

Paul Copplestone

Supabase

Supabase + ' logo'

We love Trigger.dev and it’s had a big impact in dev iteration velocity already.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/3e6a3e0f-e4c9-41e9-3881-ffe4cfc50400/public

André Neves

ZBD

ZBD + ' logo'

We’ve been looking for a product like Trigger.dev for a long time - automation that's simple and dev-focused.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/4e3d1187-c27b-4bdc-feac-d2e5297e9a00/public

Han Wang

Mintlify

Mintlify + ' logo'

I’m in love with Trigger.dev – it’s so much better than the old bull.js + heroku + redis setup that I used to use. You’ve knocked it out of the park with this tool!

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/6738d30f-ccd5-4342-8764-a2194fc0d900/public

Kushal Byatnal

Extend

Extend + ' logo'

Trigger.dev is a great way to automate email campaigns with Resend.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/3aca9c05-4563-4924-61df-867ec8434200/public

Zeno Rocha

Resend

Resend + ' logo'

I really enjoyed using Trigger.dev to create jobs through code. I found the API integrations and scheduling features super useful.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/36535ea9-56b4-42e3-4e45-ef08d293dd00/public

Adam Shiervani

BuildJet

BuildJet + ' logo'

Using Trigger.dev for our Slack jobs saved us loads of time! It was much easier to set up than a no-code tool.

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/9c9e9c2e-5ff1-4227-f0d3-514aa2e49300/public

Vlad Matsiiako

Infisical

Infisical + ' logo'

Trigger is packaging end-to-end cron, queues and webhooks platform in a slick interface. Integration was quick and we love the support ❤️

https://imagedelivery.net/3TbraffuDZ4aEf8KWOmI_w/521fe3ce-20f6-4f9b-d8de-b1c3b4724100/public

Aseem Gupta

Shaktimaan

Shaktimaan + ' logo'

Frequently asked questions

Get started today

Try for free