Performance standards
Performance model
Section titled “Performance model”- Static Astro output is the baseline performance strategy.
- Edge workers and headers layer on caching and optimization behavior.
Image strategy
Section titled “Image strategy”- Source images live under
src/assets/images. - Optimized delivery is supported by the image worker route set (
wrangler.image.toml) andimage-optimizer.js. - Image resize path expects supported extension plus a
widthquery parameter.
Cache-header standards
Section titled “Cache-header standards”public/_headers is the deploy-critical source of cache and security headers.
Expected classes:
/assets/*: long-lived immutable cache.- Image extensions (
*.jpg,*.png,*.webp, etc.): medium-lived cache with stale-while-revalidate. /api/*: no-store/no-cache headers with CORS declarations.
Validation tools
Section titled “Validation tools”Workspace scripts:
yarn workspace cosmos-digital-services test:performanceyarn workspace cosmos-digital-services test:web-vitals
Caveats
Section titled “Caveats”- Performance scripts include assumptions and placeholder endpoints (for example
/api/testchecks intests/performance.test.mjs) and may not represent every production route. test:web-vitalsuses Puppeteer + Vitest-style APIs; validate local prerequisites before treating failures as regressions.- Use these scripts as guardrails, then confirm with real browser/network profiling for major launches.