Uploaded July 2026 | Updated November 2026, 3 days ago
If you've ever built a long-running task in Next.js, you've hit the wall: Server Actions and route handlers time out on Vercel's serverless functions — and you get no retries, no queue, no scheduling, and no observability out of the box.
In this video I set up Trigger.dev in a Next.js app from scratch, first try, to fix exactly that. We go from an empty project to a real background task you can trigger from your app, watch in real time, and deploy.
⏳ Trigger.dev: fandf.co/3PGZ9qP
What we cover:
– Why long-running tasks break on Vercel, and what Trigger.dev solves
– Spinning up a Next.js app and initializing Trigger.dev with the CLI
– Writing and testing your first task from the dashboard
– Built-in logging and observability (no extra tooling)
– Triggering a task from a route handler, plus the run ID and public access token
– Realtime hooks to show progress to your users
– Deploying to Trigger.dev and managing environment variables
– Other ways to trigger: Server Actions and webhooks (e.g. a Clerk welcome sequence)
This is a getting-started walkthrough. In upcoming videos we'll wire Trigger.dev into real apps, including an AI tool for real estate photographers. Subscribe so you don't miss those.
Chapters
0:00 The problem with long-running tasks in Next.js
1:00 What is Trigger.dev (open source + cloud)
1:40 Creating the Next.js project
2:56 Initializing Trigger.dev with the CLI
4:36 Your first task: Hello World
5:50 Running a test from the dashboard
6:46 Built-in logging & observability
7:40 Triggering from Next.js (secret key + env)
9:01 Environments & API keys
10:00 Triggering via a route handler
11:11 Run ID, public token & realtime hooks
12:51 Deploying to Trigger.dev
13:40 Triggering with Server Actions
15:14 Triggering from a webhook (Clerk)
16:00 What's next
#nextjs #triggerdev #backgroundjobs #webdev #react #vercel #serverless
If you've ever built a long-running task in Next.js, you've hit the wall: Server Actions and route handlers time out on Vercel's serverless functions — and you get no retries, no queue, no scheduling, and no observability out of the box.
In this video I set up Trigger.dev in a Next.js app from scratch, first try, to fix exactly that. We go from an empty project to a real background task you can trigger from your app, watch in real time, and deploy.
⏳ Trigger.dev: fandf.co/3PGZ9qP
What we cover:
– Why long-running tasks break on Vercel, and what Trigger.dev solves
– Spinning up a Next.js app and initializing Trigger.dev with the CLI
– Writing and testing your first task from the dashboard
– Built-in logging and observability (no extra tooling)
– Triggering a task from a route handler, plus the run ID and public access token
– Realtime hooks to show progress to your users
– Deploying to Trigger.dev and managing environment variables
– Other ways to trigger: Server Actions and webhooks (e.g. a Clerk welcome sequence)
This is a getting-started walkthrough. In upcoming videos we'll wire Trigger.dev into real apps, including an AI tool for real estate photographers. Subscribe so you don't miss those.
Chapters
0:00 The problem with long-running tasks in Next.js
1:00 What is Trigger.dev (open source + cloud)
1:40 Creating the Next.js project
2:56 Initializing Trigger.dev with the CLI
4:36 Your first task: Hello World
5:50 Running a test from the dashboard
6:46 Built-in logging & observability
7:40 Triggering from Next.js (secret key + env)
9:01 Environments & API keys
10:00 Triggering via a route handler
11:11 Run ID, public token & realtime hooks
12:51 Deploying to Trigger.dev
13:40 Triggering with Server Actions
15:14 Triggering from a webhook (Clerk)
16:00 What's next
#nextjs #triggerdev #backgroundjobs #webdev #react #vercel #serverless



![Build a Fullstack App with Authentication & Rate-limiting in NextJs 14
In this video, we’ll build an AI blog generator powered by OpenAI GPT-4 and DALL.E 3, Supabase backend for database and storage, Clerk authentication, Zuplo for our API Gateway, and NextJs 14 as our frontend application.
👉🏼 The Ultimate NextJs 14 Course
→ https://www.hamedbahram.io/courses/nextjs
👉🏼 Project source code, links, and notes
→ https://www.hamedbahram.io/notes/ai-blog-generator
👉🏼 Work with me
→ https://www.hamedbahram.io/hire
Chapters
0:00 Intro
2:30 High-level architecture
4:00 Setting up supabase
6:20 Setting up NextJs
8:30 Connecting to supabase
11:00 Header, home page & form component
14:00 Adding form action
16:40 Adding server action
20:00 Using OpenAI SDK
23:45 Using supabase storage
26:25 Using supabase db
28:30 Add form pending state
30:00 Creating dynamic blog [id] page
34:50 Adding the Recent blog section
39:00 Adding Clerk authentication
45:10 Adding Clerk UI components
51:00 Adding API Gateway
1:01:00 Updating NextJs to use the API Gateway
1:03:10 Quick review
1:04:40 Server function timeout setting
1:06:24 Recap Build a Fullstack App with Authentication & Rate-limiting in NextJs 14](https://i.ytimg.com/vi/n5dsBONfwjE/mqdefault.jpg)






![Creating a Clerk account & connecting your project [3/6]
Use the link below and click Sign Up or Get Started to create your free Clerk account.
👉🏼 Clerk auth
→ https://go.clerk.com/s1mVa9u Creating a Clerk account & connecting your project [3/6]](https://i.ytimg.com/vi/pKEQtrwjwfM/mqdefault.jpg)