Skip to content

Performance standards

  • Static Astro output is the baseline performance strategy.
  • Edge workers and headers layer on caching and optimization behavior.
  • Source images live under src/assets/images.
  • Optimized delivery is supported by the image worker route set (wrangler.image.toml) and image-optimizer.js.
  • Image resize path expects supported extension plus a width query parameter.

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.

Workspace scripts:

  • yarn workspace cosmos-digital-services test:performance
  • yarn workspace cosmos-digital-services test:web-vitals
  • Performance scripts include assumptions and placeholder endpoints (for example /api/test checks in tests/performance.test.mjs) and may not represent every production route.
  • test:web-vitals uses 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.