Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.44 KB

File metadata and controls

38 lines (25 loc) · 1.44 KB

Next.js + Trigger.dev Hello World

Deploy with Vercel

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.

Demo screenshot

nextjs-trigger-demo

How it works

  1. The frontend calls POST /api/hello
  2. The API route triggers the hello-world task using the Trigger.dev SDK
  3. The 'hello-world' task runs on Trigger.dev's infrastructure

Local dev

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 server

Deploy to Vercel

Click the deploy button above, then install the Trigger.dev Vercel integration to automatically sync your environment variables.

Learn more about Trigger.dev