Platform Elite Practices

Azure Well-Architected × Vercel production engineering

Best practices, with receipts

Five Azure pillars, each one pointed at a real file in this repo and a CI gate that fails if the file lies. Read the table; click the path; watch the gate run. No slideware.

Full contract: platform-elite-practices.md

Pillar I

Reliability

Design for failure. SWR caches, content-addressed assets, an offline cockpit bundle, health probes that keep telling the truth when something upstream goes down.

Implementation map

Gate: verify_all · curl smoke
PracticeStonewallGate
Tiered CDN cacheRoot vercel.json — HTML s-maxage=3600 + SWR 7d; CSS/JS immutablePost-deploy curl -sI
Content-hashed assetsasset_version_stamp.pyverify_all
Reproducible public buildvercel_build.sh — stdlib-only; install no-opVercel build log
Cockpit degraded modeoperator-snapshot.json + web/lib/api.ts fallbacksRunbook § bundled data

Pillar II

Security

Secrets out of git. Export guards on the public build. Clerk on the operator boundary. HSTS, frame-deny, nosniff — on every surface, not just the one with the login.

Implementation map

Gate: gitleaks · build fail
Secret scanninggitleaks on PR + mainBranch protection scan
Public export guardvercel_build.sh — no case_codex.md in docs/Build exit 1
Operator authClerk + STONEWALL_ALLOWED_OPERATOR_EMAILSweb/middleware.ts
HeadersHSTS preload, frame deny, nosniff — apex + cockpitvercel.json · next.config.ts
Supply chainSHA-pinned Actions; zizmorverify workflow

Pillar III

Performance efficiency

Defer the observability scripts past LCP. ISR on the cockpit routes. Perf invariants in CI so a regression fails the build before it reaches a phone.

Implementation map

Gate: check_web_perf_invariants
Speed Insightsvercel-observability.jsrequestIdleCallbackCanary script URL 200
Self-hosted fonts_shared/geist-fonts.min.cssPerf invariant tests
Cockpit TTFBforce-cache + revalidate; withShellBudget; Suspense dashboardcheck_web_perf_invariants.py
Bundle disciplineoptimizePackageImports in next.config.tspnpm check:bundles

Pillar IV

Operational excellence

Runbooks match what production actually does. Drift gets caught by an automated editor. Two Vercel projects share one truth file so they cannot disagree.

Implementation map

Gate: render_surface_docs --check
Surface truthcatalog/intake/state/surfaces.tomlaudit_surface_state.py
Doc drift watchdocs_api_drift.py dailyRolling editor PR →
Deploy runbooksvercel-deploy-playbook.md, cockpit runbookPR deploy checklist
Path-scoped CIverifyGitHub Actions

Pillar V

Cost optimization

Pay for what actually runs. The public build installs nothing — stdlib only. Doc PRs verify the corpus, not the cockpit.

Implementation map

Gate: detect_pr_change_scope
Public buildVercel installCommand no-opBuild minutes
Doc PR CIverify_all --corpus-onlyScope detector
Cockpit lockfilepnpm install --frozen-lockfileweb/vercel.json
# Cockpit pre-release cd web && pnpm install --frozen-lockfile && pnpm run test && pnpm run build python3 scripts/check_web_perf_invariants.py # Public apex parity bash scripts/vercel_build.sh python3 scripts/asset_version_stamp.py --check # Post-promote smoke curl -sS https://app.stonewall.esq/api/health curl -sI https://stonewall.esq/_vercel/speed-insights/script.js | head -4

One line per pillar

What proves each one

ReliabilityOffline cockpit + SWR + content-hashed assets + health probes
Securitygitleaks + export guards + Clerk + HSTS + pinned CI
PerformanceSpeed Insights discipline + ISR + perf invariant script
Operationssurfaces.toml + drift automation + runbooks
CostStatic public build + corpus-only CI + frozen lockfile