Documentation

Quickstart

Zero to a green check in under five minutes. LastRun monitors jobs you already have — no rewrite, no new runtime. Signed in? Open the dashboard.

01

Create a monitor

New monitor → name it, set the schedule your job is supposed to follow (cron expression with a real timezone, or "every N minutes"), and a grace period. You get a unique ping URL.

02

Ping from your job

Add one line at the end of the job. If the job dies — or never starts — the ping never arrives, and you get an alert.

# shell / GitHub Actions / anywhere
curl-fsS https://<engine>/p/<token>            # success
curl-fsS https://<engine>/p/<token>/start      # optional: marks start, enables duration
curl-fsS -X POST -d "wrote 1,240 rows" \
  https://<engine>/p/<token>                    # POST body (≤10KB) stored as run output
curl-fsS https://<engine>/p/<token>/fail       # explicit failure (body = error message)

03

Next.js route handler (Vercel cron)

Vercel crons hit a route handler. Ping LastRun when it finishes — fire-and-forget so it never slows the job:

// app/api/cron/route.ts
export async function GET() {
  try {
    await doNightlyWork();
    fetch("https://<engine>/p/<token>").catch(() => {});   // success
    return Response.json({ ok: true });
  } catch (err) {
    fetch(`https://<engine>/p/<token>/fail`, {
      method: "POST",
      body: String(err),
    }).catch(() => {});
    throw err;
  }
}

Match the monitor schedule to your vercel.json cron (remember: Vercel cron expressions are UTC-only — LastRun schedules can use any timezone):

{
  "crons": [{ "path": "/api/cron", "schedule": "0 5 * * *" }]
}

Or skip the boilerplate with the SDK — withMonitor() handles start/success/fail pings (and create: true auto-provisions the monitor on first run, no dashboard step):

import { withMonitor } from"lastrun";

export const GET = withMonitor(handler, { slug: "api-cron", create: true });

npx lastrun sync reads your vercel.json and creates/updates a monitor per cron. Plain pings remain the stable contract.

04

Route the alerts

Channels → add email, Slack, Discord, Telegram, or a generic webhook, then attach channels on each monitor's page. One incident per outage: a single down alert (with the captured error output), a daily reminder until it's resolved or acknowledged, a single recovery alert. No spam.

emailslackdiscordtelegramwebhook

05

Go further

  • Stuck-run detection — set a max runtime on a monitor; a job that pings /startbut never finishes in time goes down with cause "stuck".
  • Status badges — public SVG per monitor (and a fleet badge in Settings), safe for READMEs.
  • Public status pages (Pro) — a no-login page per project at /status/<slug> with 30-day history and uptime.
  • Weekly digest — Monday-morning fleet summary by email; toggle in Settings.

That's the whole integration. Green check or alert — either way, you know.

Start free