Light rays
Announcing our $3m seed round

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
    });

    A Webhook example

    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
    });

    An event example

    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
    });

    A Scheduled example

    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.

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 integrations you need

Easily integrate with hundreds of 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.com, Nango, or rolling your own with our custom auth resolvers.

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.

Integration kit

Official Trigger.dev integrations or build your own

Self-hosting

Host the platform yourself

Cloud

Just write code, no deployment required

Dashboard

View every Task in every Run

Serverless

Long-running Jobs on your serverless backend

React hooks

Easily update your UI with Job progress

Offload long or intense tasks to our infrastructure

Support for Remix, Astro, RedwoodJS & more

Run Jobs on your long-running backend

Subscribe to changes without webhooks

Use integrations signed in as your users

Vercel integration

Easy deploy and preview environment support

Streaming

Receive data from your Jobs in realtime

100+ integrations

Comprehensive support for popular APIs

File IO

Create Tasks that have file outputs

We love the open source community. Get involved!

Contribute to Trigger.dev

Frequently asked questions

Get started today

Try for free