Skip to main content

Cron Jobs

The platform uses Vercel's built-in cron job system to run scheduled tasks. Currently, there is one cron job configured for automated reminders.

Configuration

Cron jobs are defined in vercel.json at the project root:

{
"crons": [
{
"path": "/api/auto_reminder",
"schedule": "0 8 * * *"
}
]
}

Each entry specifies:

  • path — The API route to invoke
  • schedule — A cron expression defining when to run

Current Cron Jobs

Auto Reminder

PropertyValue
Path/api/auto_reminder
Schedule0 8 * * * (daily at 08:00 UTC)
Handlersrc/app/api/auto_reminder/route.ts
MethodGET
PurposeSends email reminders for MOCs with approaching or overdue target timelines

See Auto Reminders for full details on urgency levels and email content.

Adding a New Cron Job

Step 1: Create the API Route

Create a new API route handler in src/app/api/:

// src/app/api/your_new_cron/route.ts
import { NextResponse } from "next/server";

export async function GET() {
try {
// Your scheduled task logic here

return NextResponse.json({
message: "Task completed",
timestamp: new Date().toISOString(),
});
} catch (error) {
return NextResponse.json(
{ error: "Task failed" },
{ status: 500 }
);
}
}

Step 2: Register in vercel.json

Add a new entry to the crons array in vercel.json:

{
"crons": [
{
"path": "/api/auto_reminder",
"schedule": "0 8 * * *"
},
{
"path": "/api/your_new_cron",
"schedule": "0 0 * * 1"
}
]
}

Step 3: Deploy

Cron jobs are registered with Vercel during deployment. After deploying:

  1. Go to the Vercel dashboard
  2. Navigate to your project → Settings → Cron Jobs
  3. Verify the new cron job appears in the list
  4. Check the execution logs after the scheduled time

Cron Expression Reference

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *

Common Schedules

ExpressionDescription
0 8 * * *Every day at 08:00 UTC
0 8 * * 1-5Weekdays at 08:00 UTC
0 0 * * 0Every Sunday at midnight UTC
0 */6 * * *Every 6 hours
0 8 1 * *First day of each month at 08:00 UTC
0 0 * * 1Every Monday at midnight UTC

Vercel Cron Limitations

note
  • Hobby plan: 2 cron jobs, invoked once per day maximum
  • Pro plan: 40 cron jobs, minimum interval of 1 minute
  • Timeout: Cron-triggered routes have the same timeout as regular serverless functions (10s on Hobby, 60s on Pro)
  • Timezone: All cron expressions use UTC

Monitoring

Cron job executions can be monitored in:

  • Vercel Dashboard → Project → Cron Jobs tab (shows execution history)
  • Vercel Logs → Filter by the cron endpoint path
  • Response data — Each cron handler returns a JSON response with execution details
PurposePath
Vercel configurationvercel.json
Auto reminder handlersrc/app/api/auto_reminder/route.ts