Static pages
SSG and ISR for published routes, plus middleware for preview and variants.
The Node SDK pre-renders published pages at build (SSG) and caches new routes after the first request (ISR). Personalization is selected on Edge; the site caches HTML per variant combo. See Architecture for how tiers choose a variation.
Build
→ Edge GET /v1/routes + /v1/resolve (default layout)
→ static HTML (SSG)
Visitor, default variant (~95%)
→ cached default HTML
Visitor, personalized (returning, cookie + matching rules)
→ middleware asks Edge /v1/variants
→ rewrite to /__p/{combo}/… (URL in the browser stays the same)
→ first hit: SSR that combo, then ISR cache
Client overlay
→ fallback when there is no cookie yet, or middleware times out
Next.js page
Do not read searchParams on the live page — that forces every request to be dynamic.
// app/[[...slug]]/page.tsx
import { fetchPageConfigServer, generateAmplifyStaticParams } from '@amplifyup/sdk/server';
export const revalidate = 60;
export const dynamicParams = true;
export async function generateStaticParams() {
return generateAmplifyStaticParams(process.env.NEXT_PUBLIC_AMPLIFYUP_TRACKING_ID!);
}
export default async function Page({ params }) {
const route = '/' + (params.slug || []).join('/');
const pageConfig = await fetchPageConfigServer(route, process.env.NEXT_PUBLIC_AMPLIFYUP_TRACKING_ID!, false);
return <AmplifyPageContent pageConfig={pageConfig} renderComponent={renderComponent} fallback={<StaticPage />} />;
}
Middleware
Use amplifyMiddleware from @amplifyup/sdk/middleware. Composer preview rewrites to /__preview. Personalized combos rewrite to /__p/{keys} (browser URL unchanged).
clientPersonalization (default true) overlays after paint when there is no cookie yet or middleware times out.
Build needs Edge reachable to pre-render every published path. If Edge is down, generateAmplifyStaticParams still returns / so the build can finish; missing routes SSR on first visit, then cache.