Sequence — Build and search sync

What happens when the site is built and published: next build runs, then every page's search record is pushed to Algolia.

  • Status: Current
  • Last updated: 2026-10-31
  • Related ADRs: none yet — scaffold behaviour

Snapshot of the system as it stands today. Edit in place; never record what changed.

Trigger

bun run build. It runs next build, then node --env-file-if-exists=.env.local scripts/sync-content.ts.

Diagram

Build and search syncOpen full screen

Failure paths

StepFailureBehaviourRecovery
2Invalid MDX or frontmatternext build fails; the sync never runsFix the page, rebuild
5SITE_URL missing from the environmentThe script throws, naming the variable, before reading anything; the index is unchanged (ADR-0035)Set SITE_URL, then re-run the build
6static.json.body not found (unknown build adapter layout)The script throws reading an undefined path; the index is unchangedCheck the build output layout; adjust the glob
8Algolia variables missing from the environmentThe script does not check for them (non-null assertions), so undefined reaches the Algolia client; where it fails has not been verifiedSet the variables (content/docs/maintain/security/secrets.mdx)
8Algolia rejects or is unreachableThe script fails after a successful buildRe-run the build, or the sync step alone

Post-conditions

The Algolia index document holds exactly the pages in this build — every page in content/. Anyone with the public search-only key can query all of them.

On this page

2 min read