Next.js: @infrakinetic/next
A React Server Component and three helpers. Your layout, our page, rendered on your server.
npm install @infrakinetic/next
Environment
Server-side only. Never prefix these with NEXT_PUBLIC_.
INFRAKINETIC_RENDER_KEY=iksr_…
INFRAKINETIC_SITE_URL=https://www.northwind-foods.in
The page address is built from INFRAKINETIC_SITE_URL, never from the request's Host header, so a forged Host cannot poison your cache.
The route
// app/careers/[[...path]]/page.jsx
import { InfrakineticPage, infrakineticMetadata } from "@infrakinetic/next";
export const generateMetadata = infrakineticMetadata({ basePath: "/careers" });
export default function Page(props) {
return <InfrakineticPage {...props} basePath="/careers" />;
}
This serves /careers and every page under it, including each job. Addresses that are not ours call notFound(), so your own 404 page shows.
Sitemap
// app/sitemap.js
import { infrakineticSitemap } from "@infrakinetic/next";
export default async function sitemap() {
return [...(await infrakineticSitemap()) /* , your own entries */];
}
Keeping pages fresh
Pages are fetched through Next's data cache, tagged by address, and refreshed after a minute. To clear exactly the pages that changed as soon as you publish, call pollChanges from a scheduled job (Vercel Cron, a GitHub Action, any scheduler) every few minutes. It reads the change feed and revalidates those addresses, or every Infrakinetic page when a change touches a whole area (a new job, a price).
// app/api/infrakinetic/changes/route.js (call it on a schedule)
import { pollChanges } from "@infrakinetic/next";
import { cursorStore } from "@/lib/cursor-store"; // { get(), set(cursor) } in your KV or database
export async function GET() {
return Response.json(await pollChanges({ cursorStore }));
}
Static export
With output: "export", use infrakineticStaticParams({ basePath: "/careers" }) as generateStaticParams. To rebuild on changes, poll the change feed from a scheduled job and call your host's deploy hook when it reports a change.
Safety
Importing the package from a "use client" file fails on purpose, so the key cannot end up in browser code. The package needs Next.js 14.2 or later and React 18.3 or later.
Other React frameworks
Remix, Astro, SvelteKit and others use the framework-free core, @infrakinetic/delivery. See server snippets.