You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/frameworks/nextjs.mdx
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ For more information on authenticating with Trigger.dev, see the [API keys page]
45
45
46
46
## Triggering your task in Next.js
47
47
48
-
Here are the steps to trigger your task in the Next.js App and Pages router and Server Actions. Alternatively, check out this repo for a [full working example](https://github.com/triggerdotdev/example-projects/tree/main/nextjs/server-actions/my-app) of a Next.js app with a Trigger.dev task triggered using a Server Action.
48
+
Here are the steps to trigger your task in the Next.js App and Pages router and Server Actions.
49
49
50
50
<Tabs>
51
51
@@ -432,5 +432,18 @@ You can test your revalidation task in the Trigger.dev dashboard on the testing
432
432
<NextjsTroubleshootingMissingApiKey/>
433
433
<NextjsTroubleshootingButtonSyntax/>
434
434
435
+
## Realtime updates with React hooks
436
+
437
+
The `@trigger.dev/react-hooks` package lets you subscribe to task runs from your React components. Show progress bars, stream AI responses, or display run status in real time.
Copy file name to clipboardExpand all lines: docs/guides/frameworks/remix.mdx
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,19 @@ The `vercel-build` script in `package.json` is specific to Remix projects on Ver
197
197
198
198
The `runtime: "edge"` configuration in the API route allows for better performance on Vercel's Edge Network.
199
199
200
+
## Realtime updates with React hooks
201
+
202
+
The `@trigger.dev/react-hooks` package lets you subscribe to task runs from your React components. Show progress bars, stream AI responses, or display run status in real time.
Copy file name to clipboardExpand all lines: docs/quick-start.mdx
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,20 +26,30 @@ Sign up at [Trigger.dev Cloud](https://cloud.trigger.dev) (or [self-host](/open-
26
26
27
27
</Steps>
28
28
29
+
## Triggering tasks from your app
30
+
31
+
The test page in the dashboard is great for verifying your task works. To trigger tasks from your own code, you'll need to set the `TRIGGER_SECRET_KEY` environment variable. Grab it from the API Keys page in the dashboard and add it to your `.env` file.
32
+
33
+
```bash .env
34
+
TRIGGER_SECRET_KEY=tr_dev_...
35
+
```
36
+
37
+
See [Triggering](/triggering) for the full guide, or jump straight to framework-specific setup for [Next.js](/guides/frameworks/nextjs), [Remix](/guides/frameworks/remix), or [Node.js](/guides/frameworks/nodejs).
38
+
29
39
## Next steps
30
40
31
41
<CardGroupcols={2}>
32
42
<Cardtitle="Building with AI"icon="brain"href="/building-with-ai">
33
-
Learn how to build Trigger.dev projects using AI coding assistants
43
+
Build Trigger.dev projects using AI coding assistants
34
44
</Card>
35
45
<Cardtitle="How to trigger your tasks"icon="bolt"href="/triggering">
|`maxAttempts`| Total number of attempts (including the first). Default: 3 |
90
+
|`factor`| Exponential backoff multiplier. Each retry delay = previous delay x factor. With `factor: 1.8` and `minTimeoutInMs: 500`, retries wait 500ms, 900ms, 1620ms, etc. |
91
+
|`minTimeoutInMs`| Delay before the first retry |
92
+
|`maxTimeoutInMs`| Cap on the delay between retries |
93
+
|`randomize`| Add jitter to retry delays to prevent multiple failing tasks from retrying in lockstep |
94
+
95
+
<Note>Task-level retry settings override the defaults in your `trigger.config` file.</Note>
96
+
87
97
For more information read [the retrying guide](/errors-retrying).
88
98
89
99
It's also worth mentioning that you can [retry a block of code](/errors-retrying) inside your tasks as well.
@@ -145,7 +155,7 @@ You can register global lifecycle hooks that are executed for all runs, regardle
If you create a`init.ts` file at the root of your trigger directory, it will be automatically loaded when a task is executed. This is useful if you want to register global lifecycle hooks, or initialize a database connection, etc.
173
+
If you create an`init.ts` file at the root of your trigger directory, it will be automatically loaded when a task is executed. This is useful for registering global lifecycle hooks, initializing a database connection, etc.
Copy file name to clipboardExpand all lines: docs/triggering.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,10 @@ Trigger tasks **from inside a another task**:
29
29
30
30
When you trigger a task from your backend code, you need to set the `TRIGGER_SECRET_KEY` environment variable. If you're [using a preview branch](/deployment/preview-branches), you also need to set the `TRIGGER_PREVIEW_BRANCH` environment variable. You can find the value on the API keys page in the Trigger.dev dashboard. [More info on API keys](/apikeys).
31
31
32
+
<Note>
33
+
**Which trigger pattern should I use?** If your triggering code can import the task definition (same codebase), use `yourTask.trigger()` for full type safety. Use `tasks.trigger()` with a type-only import when the task runs in a separate service or you need to avoid bundling task code into your app (common in Next.js). Both do the same thing at runtime.
34
+
</Note>
35
+
32
36
<Note>
33
37
If you are using Next.js Server Actions [you'll need to be careful with
0 commit comments