65fa8300ad
* Removed next references in the ReadMe * FAQ improvements to update Next.js references * Added a new Frameworks page with logos to link to the quick start guides * Renamed the mdx file so the link works * Added basic platform guides * Introduction doesn’t reference next.js only * Added a note about serverless and restructured the side menu * Added more frameworks pages to the manual install section * Fixed SVG error * Coming soon guides now using snippets so they can be in 2 places while we work on them * Removed redirects * Added a new named icon * increased fireworks particle count slightly * Creating a route for the onboarding and link to access it anytime from the side menu * Moved the onboarding into new components * Updated the routes for the onboarding page * Onboarding is now Setup and the frameworks overview page now links to different framework page in the onboarding side nav * URLs and pages renamed to ‘setup’ * URLs and pages renamed to ‘setup’ * Fixed some old named component imports * WIP on a new less hacked-in background image * Added svg logos for all the frameworks * New paths for the new framework pages * Side menu collapses once you selected a framework * Temporary Nuxt page * New routes for the new frameworks * New ‘framework coming soon’ component - now used in the coming soon framework pages * Moved/removed files * Moved all svg framework logos into a new folder and file * balanced the logo sizes * Framework coming soon pages take a name and url * New express svg logo * New component for a Framework item in the grid * Added information and design for the coming soon frameworks * Change the grid to 1 row if jobs === 0 * Updated the framework coming soon snippet and added it to the relevant pages * Express now 2nd in all lists * Added link to long running server support discussion * New logo to include next.js + supabase quick start * roadmap now links to homepage with page anchor to roadmap section * changelog now links to Github releases page * Removed reference to Next.js * Docs pages with coming soon info all share the same framework snippets * Fixed issue of missing props * Moved the fireworks effect into a separate file to make it easier for adding more framework onboarding pages * Info callouts have a more muted style * Added a callout to the top of the next onboarding to reference Serverless-only support * Moved the callout explaining scheduled triggers not working in dev to the bottom of the test panel This is to resolve eric’s UX ticket: https://github.com/triggerdotdev/trigger.dev/issues/416 * Added groundwork for Nest.js framework * Using framer motion for the menu transition instead of css - now has a slight spring and is snappier * redirect the manual setup page to the new nextjs setup page * Fixed broken docs link * Added a readme.md to next.js package * Capital I for integration * Renamed component: NextDevCommand to RunDevCommand * Made required props non-optional * CLI now points at manual install guides if no Next project detected * Explicitly made supported default to false (it was working but a bit hard to read) * Added links to all github issues for the frameworks coming soon component --------- Co-authored-by: Matt Aitken <matt@mattaitken.com>
106 lines
5.0 KiB
Plaintext
106 lines
5.0 KiB
Plaintext
---
|
|
title: "What is Trigger.dev?"
|
|
sidebarTitle: "What is Trigger.dev?"
|
|
---
|
|
|
|
Trigger.dev is a platform, SDK and API for building and running Jobs in your codebase, triggered by various sources, but without having to worry about managing any complicated orchestration infrastructure.
|
|
|
|
It can be used from _any_ Node.js (support versions) or TypeScript backend application (including serverless applications and microservices).
|
|
|
|
## What we take care of for you:
|
|
|
|
- We make it possible to run long-running Jobs on serverless platforms that have short timeouts (e.g. 30 seconds).
|
|
- We provide an SDK for building Jobs in your codebase, triggered by various sources such as [events](/triggers/events), [scheduled events](/triggers/scheduled-events), and [webhooks](/triggers/webhooks).
|
|
- We provide an orchestration platform for running Jobs in your codebase.
|
|
- We provide out-of-the-box Integrations with popular services such as [Slack](/integrations/apis/slack), [OpenAI](/integrations/apis/openai), [GitHub](/integrations/apis/github) and [more](/integrations), which vastly simplifies the process interacting with 3rd-party services.
|
|
- We handle OAuth for you
|
|
- We provide a nice UI for viewing and debugging your Jobs.
|
|
|
|
## What you take care of:
|
|
|
|
- You write your Jobs in your codebase.
|
|
- You get a Trigger.dev API Key and add it to your codebase.
|
|
- You deploy your codebase.
|
|
|
|
## How it works
|
|
|
|
To get an idea of how Trigger.dev works, let's take a look at a simple Job that sends a Slack message when a GitHub issue is labelled as `critical`:
|
|
|
|
```ts
|
|
import { Job } from "@trigger.dev/sdk";
|
|
import { Github, events } from "@trigger.dev/github";
|
|
import { Slack } from "@trigger.dev/slack";
|
|
|
|
//GitHub integration with API Key (it supports OAuth too)
|
|
const github = new Github({
|
|
id: "github",
|
|
token: process.env.GITHUB_API_KEY!,
|
|
});
|
|
|
|
//Slack integration with OAuth
|
|
const slack = new Slack({
|
|
id: "slack",
|
|
});
|
|
|
|
client.defineJob({
|
|
id: "critical-issue-alert",
|
|
name: "Critical Issue Alert",
|
|
version: "0.1.0",
|
|
//When a GitHub issue is modified on the triggerdotdev/trigger.dev repo
|
|
trigger: github.triggers.repo({
|
|
event: events.onIssue,
|
|
owner: "triggerdotdev",
|
|
repo: "trigger.dev",
|
|
}),
|
|
//include any integrations you want to use
|
|
integrations: {
|
|
slack,
|
|
},
|
|
//this function gets executed when the trigger fires
|
|
run: async (payload, io, ctx) => {
|
|
await io.logger.info(`Action was ${payload.action}`);
|
|
|
|
if (payload.action === "labeled" && payload.label?.name === "critical") {
|
|
//use the Slack integration to post a message
|
|
await io.slack.postMessage("post message", {
|
|
channel: "C04GWUTDC3W",
|
|
text: `Issue ${payload.issue.number}: ${payload.issue.title} is critical!`,
|
|
});
|
|
}
|
|
},
|
|
});
|
|
```
|
|
|
|
This code lives in a file inside your project repo.
|
|
|
|
It is listening for the [issueEvent](/integrations/apis/github/triggers) GitHub webhook, and when it receives one, we will take care of calling the `run` function supplied to the `Job` constructor with the webhook payload. This gives you the following advantages over traditional webhooks:
|
|
|
|
- We will automatically register the webhook with GitHub for you, and verify the payload signature.
|
|
- We provide a nicely typed `event` payload to your `run` function, so you don't have to setup webhook payload types.
|
|
- If your server isn't running, we will wait until it's back online before attempting to run the Job.
|
|
- It is very easy to test your Job locally using our [Test Run](/guides/running-tests) feature.
|
|
|
|
As you can see the above Job also makes a call to our Slack [postMessage](/integrations/apis/slack) function, which provides the following advantages over using the raw Slack API:
|
|
|
|
- We automatically handle the OAuth flow for you, so you don't have to worry about setting up a Slack app and dealing with credentials in your code (see our [Authentication](/concepts/authentication) guide for more details).
|
|
- We will automatically retry the request if the Slack API returns an error.
|
|
- We provide a nicely typed `response` object from your `postMessage` function, so you don't have to setup Slack API types.
|
|
|
|
## Why use Trigger.dev?
|
|
|
|
Apart from the reasons mentioned above, there are a few other reasons why you might want to use Trigger.dev:
|
|
|
|
- You want to access your database or other internal services from your Jobs, without having to expose them to the internet.
|
|
- You want to colocate your Jobs with your code, so you can deploy them together in one atomic unit.
|
|
- You want to build event-driven architectures without having to manage any complicated orchestration infrastructure.
|
|
- You want to add in delays or retries to your Jobs, without having to worry about managing a queue.
|
|
|
|
## Architecture
|
|
|
|
Below is a simplified architecture diagram of how Trigger.dev works:
|
|
|
|
{/* https://www.tldraw.com/r/v2_KEeyTalIH0NRKdsb01Lqt?viewport=36%2C-165%2C2234%2C1420&page=page%3AOecar06rEOb6Kpu9XzDKo */}
|
|

|
|
|
|
As you can see above, we communicate between your code and the Trigger.dev platform. This allows us to send events to your code, and receive tasks from your code.
|