Prerequisites
- A Remix project
- A Trigger.dev account with a project created
- Node.js 18 or later
Initial setup
1
Run the CLI init command
In the root of your Remix project, run:This creates
trigger.config.ts and a sample task at src/trigger/example.ts.2
Start the dev server
Run the Trigger.dev dev server (keep your Remix dev server running in a separate terminal):
3
Run a test
Open the Trigger.dev dashboard, navigate to your project, and use
the Test page to trigger the
hello-world task.4
View your run
Click through to the run page to see live logs and the task output.
Set your secret key locally
Add yourTRIGGER_SECRET_KEY to the .env file in the root of your Remix project. Get your DEV
secret key from the API Keys page in the dashboard:
Find your DEV API key under API Keys in the Trigger.dev dashboard.
Triggering tasks from Remix
1
Create an API route
Create
app/routes/api.hello-world.ts:app/routes/api.hello-world.ts
2
Test your route
With both the Remix dev server and the Trigger.dev dev server running, visit
http://localhost:5173/api/hello-world. The task will be triggered and the run handle returned
as JSON.Add environment variables
Add any environment variables your tasks require to the Trigger.dev dashboard under Environment Variables before deploying.Deploying your task
Deploying to Vercel Edge Functions
The@trigger.dev/sdk package supports the edge runtime out of the box. Use a type-only import
for the task to ensure compatibility.
1
Update your API route for edge
app/routes/api.hello-world.ts
2
Create or update vercel.json
vercel.json
3
Update package.json scripts
Add the
vercel-build script which copies static assets to the expected output path:package.json
4
Deploy to Vercel
Push your code to a Git repository, then create a new project in the Vercel dashboard and
connect it to your repo.
5
Add your secret key to Vercel
In your Vercel project settings, add the environment variable:Get your production secret key from the API Keys page in the Trigger.dev dashboard.
6
Test in production
After deploying, send a POST request to verify the task triggers correctly:
The
runtime: "edge" configuration improves cold-start times on Vercel’s Edge Network. The
type-only import (import type) ensures the task code itself is never bundled into the edge
function — only the type information is used at compile time.Additional resources
Build extensions
Add Python, browsers, FFmpeg, and other system dependencies to your tasks
Deployment guide
Learn how to deploy your tasks to production