wealth/docs/decisions/0026-landing-is-prerendered.md

1.8 KiB

0026 The landing is prerendered and revalidated

Status: Accepted · Area: architecture · Date: 2026-10-07 · Decided by: user

Context

/ became the guest landing (design, Oct 2026). It changes rarely, reads no session, and its only live data is the featured analysts. The skill renders every page fresh per request with no server cache, and both root layouts declared dynamic = 'force-dynamic', which made any static page impossible.

Decision

  • (landing)/page.tsx in bull and bear declares dynamic = 'force-static' and revalidate = 600: the page is prerendered and its featured analysts are read again every 10 minutes.
  • force-dynamic moves from the root layouts to each route group's layout ((main), (auth), (flow), (onboarding)), so every other route still renders fresh per request.
  • A failed read of the featured analysts (loadLandingPage) hides their section during next build (the app passes NEXT_PHASE from its server env), so the build never depends on the API; at a revalidation it throws, so Next keeps serving the last good page.

Alternatives

  • Render it fresh per request like every other page: rejected by the user; the page is the same for everyone and rarely changes.
  • Static with no revalidation: rejected; the featured analysts are live.

Consequences

  • An exception to the skill's "no server cache" and "fresh page per request" rules, for / only. The response carries s-maxage=600, so a CDN may cache it too.
  • A new route group must declare force-dynamic in its own layout; the root layout no longer does. The root not-found page is now static.
  • A page built while the API was down has no analysts section until the first successful revalidation.
  • The landing namespace is server-only (SERVER_RESOURCES), added to the i18n instance by each app's server bootstrap, so no client bundle carries it.