A minimal Next.js app that triggers a background task from an API route. Click a button, fire a task, watch it run on Trigger.dev.
The whole thing is ~20 lines of task code in trigger/hello-world.ts.
- The frontend calls
POST /api/hello - The API route triggers the
hello-worldtask using the Trigger.dev SDK - The task runs on Trigger.dev's infrastructure (with retries, logging, the works)
cp .env.example .env.local
# Add your TRIGGER_SECRET_KEY from cloud.trigger.dev
pnpm install
pnpm dev # Next.js on :3000
npx trigger dev # Trigger.dev dev serverClick the deploy button above, then install the Trigger.dev Vercel integration to automatically sync your environment variables.