Struggling to run background jobs in serverless environment? That's why we made Next Cron. You can setup background jobs with just a few lines of code.
import { NextCron } from 'next-cron-node'
const nextCron = new NextCron('YOUR_API_KEY')
await nextCron.schedule.create({
name: "unique-name",
data: {
userId: "user1",
},
scheduledAt: new Date(),
endpoint: 'https://api.example.com/callback',
})
import { NextResponse } from 'next/server'
export async function POST(req: Request) {
const data = await req.json()
console.log(data.userId)
// OUTPUT: user1
return NextResponse.json({
success: true
})
}
Start for free and upgrade as you grow. No hidden fees or surprises.