Webhooks over polling: the only way to keep content in sync
Here's a scenario: you publish a new blog post, but your Next.js site doesn't show it for another 60 seconds. Or 5 minutes. Or however long your ISR cache lasts. That's polling. It's a hack.
Why polling fails
- Lag — content is stale until the next poll cycle
- Waste — most polls return "nothing changed"
- Complexity — you need cron jobs, cache invalidation, race condition handling
Webhooks are the answer
When content changes, PageKit fires a webhook. Your deploy pipeline listens. ISR revalidates. The content is fresh instantly.
// Next.js API route
export async function POST(req: Request) {
const event = await req.json();
if (event.type === "post.published") {
revalidatePath("/");
}
return Response.json({ ok: true });
}
One endpoint. One function. Content stays in sync forever.
The PageKit way
PageKit fires webhooks on every content event: post.published, post.updated, page.created, page.deleted. Your frontend stays in sync without polling, without cron jobs, without hacks.