Skip to content

Commit 0c0fd71

Browse files
committed
Added additional resources links to nextjs and remix
1 parent 49c9248 commit 0c0fd71

File tree

2 files changed

+49
-33
lines changed

2 files changed

+49
-33
lines changed

docs/guides/frameworks/nextjs.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,24 @@ Here are the steps to trigger your task in the Next.js App and Pages router and
244244

245245
</Tabs>
246246

247-
<AddEnvironmentVariables/>
247+
<AddEnvironmentVariables />
248248

249-
<DeployingYourTask/>
249+
<DeployingYourTask />
250250

251251
## Troubleshooting
252252

253253
<NextjsTroubleshootingMissingApiKey/>
254254
<NextjsTroubleshootingButtonSyntax/>
255255
<WorkerFailedToStartWhenRunningDevCommand/>
256256

257+
## Additional resources for Next.js
258+
259+
<Card
260+
title="Next.js - triggering tasks using webhooks"
261+
icon="N"
262+
href="/guides/frameworks/nextjs-webhooks"
263+
>
264+
How to create a webhook handler in a Next.js app, and trigger a task from it.
265+
</Card>
266+
257267
<UsefulNextSteps />

docs/guides/frameworks/remix.mdx

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ description: "This guide will show you how to setup Trigger.dev in your existing
55
icon: "r"
66
---
77

8-
import Prerequisites from '/snippets/framework-prerequisites.mdx';
9-
import CliInitStep from '/snippets/step-cli-init.mdx';
10-
import CliDevStep from '/snippets/step-cli-dev.mdx';
11-
import CliRunTestStep from '/snippets/step-run-test.mdx';
12-
import CliViewRunStep from '/snippets/step-view-run.mdx';
13-
import UsefulNextSteps from '/snippets/useful-next-steps.mdx';
8+
import Prerequisites from "/snippets/framework-prerequisites.mdx";
9+
import CliInitStep from "/snippets/step-cli-init.mdx";
10+
import CliDevStep from "/snippets/step-cli-dev.mdx";
11+
import CliRunTestStep from "/snippets/step-run-test.mdx";
12+
import CliViewRunStep from "/snippets/step-view-run.mdx";
13+
import UsefulNextSteps from "/snippets/useful-next-steps.mdx";
1414
import TriggerTaskRemix from "/snippets/trigger-tasks-remix.mdx";
1515
import AddEnvironmentVariables from "/snippets/add-environment-variables.mdx";
1616
import DeployingYourTask from "/snippets/deplopying-your-task.mdx";
@@ -20,10 +20,10 @@ import DeployingYourTask from "/snippets/deplopying-your-task.mdx";
2020
## Initial setup
2121

2222
<Steps>
23-
<CliInitStep />
24-
<CliDevStep />
25-
<CliRunTestStep />
26-
<CliViewRunStep />
23+
<CliInitStep />
24+
<CliDevStep />
25+
<CliRunTestStep />
26+
<CliViewRunStep />
2727
</Steps>
2828

2929
## Set your secret key locally
@@ -40,27 +40,24 @@ For more information on authenticating with Trigger.dev, see the [API keys page]
4040

4141
<Step title="Create an API route">
4242

43-
Create a new file called `api.hello-world.ts` (or `api.hello-world.js`) in the `app/routes` directory like this: `app/routes/api.hello-world.ts`.
43+
Create a new file called `api.hello-world.ts` (or `api.hello-world.js`) in the `app/routes` directory like this: `app/routes/api.hello-world.ts`.
4444

4545
</Step>
4646

4747
<Step title="Add your task">
4848

49-
Add this code to your `api.hello-world.ts` file which imports your task:
49+
Add this code to your `api.hello-world.ts` file which imports your task:
5050

51-
```ts app/routes/api.hello-world.ts
52-
import type { helloWorldTask } from "../../src/trigger/example";
53-
import { tasks } from "@trigger.dev/sdk/v3";
51+
```ts app/routes/api.hello-world.ts
52+
import type { helloWorldTask } from "../../src/trigger/example";
53+
import { tasks } from "@trigger.dev/sdk/v3";
5454

55-
export async function loader() {
56-
const handle = await tasks.trigger<typeof helloWorldTask>(
57-
"hello-world",
58-
"James"
59-
);
55+
export async function loader() {
56+
const handle = await tasks.trigger<typeof helloWorldTask>("hello-world", "James");
6057

61-
return new Response(JSON.stringify(handle), {
62-
headers: { "Content-Type": "application/json" },
63-
});
58+
return new Response(JSON.stringify(handle), {
59+
headers: { "Content-Type": "application/json" },
60+
});
6461
}
6562
```
6663

@@ -74,13 +71,14 @@ For more information on authenticating with Trigger.dev, see the [API keys page]
7471

7572
</Steps>
7673

77-
<AddEnvironmentVariables/>
74+
<AddEnvironmentVariables />
7875

79-
<DeployingYourTask/>
76+
<DeployingYourTask />
8077

8178
## Deploying to Vercel Edge Functions
8279

8380
Before we start, it's important to note that:
81+
8482
- We'll be using a type-only import for the task to ensure compatibility with the edge runtime.
8583
- The `@trigger.dev/sdk/v3` package supports the edge runtime out of the box.
8684

@@ -104,10 +102,7 @@ export const config = {
104102
export async function action({ request }: { request: Request }) {
105103
// This is where you'd authenticate the request
106104
const payload = await request.json();
107-
const handle = await tasks.trigger<typeof helloWorldTask>(
108-
"hello-world",
109-
payload
110-
);
105+
const handle = await tasks.trigger<typeof helloWorldTask>("hello-world", payload);
111106
return new Response(JSON.stringify(handle), {
112107
headers: { "Content-Type": "application/json" },
113108
});
@@ -155,7 +150,6 @@ Push your code to a Git repository and create a new project in the Vercel dashbo
155150

156151
</Step>
157152

158-
159153
<Step title="Add your Vercel environment variables">
160154

161155
In the Vercel project settings, add your Trigger.dev secret key:
@@ -174,7 +168,10 @@ You can find this key in the Trigger.dev dashboard under API Keys and select the
174168

175169
Once you've added the environment variable, deploy your project to Vercel.
176170

177-
<Note>Ensure you have also deployed your Trigger.dev task. See [deploy your task step](/guides/frameworks/remix#deploying-your-task-to-trigger-dev).</Note>
171+
<Note>
172+
Ensure you have also deployed your Trigger.dev task. See [deploy your task
173+
step](/guides/frameworks/remix#deploying-your-task-to-trigger-dev).
174+
</Note>
178175

179176
</Step>
180177

@@ -200,5 +197,14 @@ The `vercel-build` script in `package.json` is specific to Remix projects on Ver
200197

201198
The `runtime: "edge"` configuration in the API route allows for better performance on Vercel's Edge Network.
202199

200+
## Additional resources for Remix
201+
202+
<Card
203+
title="Remix - triggering tasks using webhooks"
204+
icon="R"
205+
href="/guides/frameworks/remix-webhooks"
206+
>
207+
How to create a webhook handler in a Remix app, and trigger a task from it.
208+
</Card>
203209

204210
<UsefulNextSteps />

0 commit comments

Comments
 (0)