Skip to main content

Static assets are compressed (build config enables it)

ab-002592 · project-snapshot.performance.assets-compressed
Severity: mediumactive

Why it matters

Serving uncompressed JS, CSS, and HTML over the wire costs roughly 5–8x the bytes Brotli would send and 3–4x what gzip would — a typical 800KB Next.js bundle balloons to a multi-megabyte download, pushing LCP past the 2.5s "good" threshold on median mobile connections and chewing through the bandwidth quotas of users on metered plans. Managed platforms (Vercel, Netlify, Cloudflare, Fly) enable Brotli or gzip at the edge automatically; the failing shape is almost always a self-hosted Node app — Express without the compression() middleware, Fastify without @fastify/compress, or an nginx reverse proxy missing gzip on / brotli on. AI coding tools produce this gap because they scaffold a bare app.use(express.static(...)) in the server entry and never add the compression middleware, which is not part of the framework defaults.

Severity rationale

Medium because every page load pays the bandwidth and LCP tax for every user until it is fixed, but the remediation is one `app.use(compression())` line or one nginx directive — a minutes-long change with site-wide leverage.

Remediation

For Express:

import compression from 'compression'
app.use(compression())

Deeper remediation guidance and cross-reference coverage for this check lives in the performance-load Pro audit — run that after applying this fix for a more exhaustive pass on the same topic.

Detection

  • ID: project-snapshot.performance.assets-compressed
  • Severity: medium
  • What to look for: Check the framework config and hosting config. Most modern hosts (Vercel, Netlify, Cloudflare) auto-enable Brotli/gzip. For self-hosted: check nginx.conf for gzip on / brotli on, Express for compression() middleware, Fastify for @fastify/compress. Also check Next.js compress: true (default true).
  • Pass criteria: Either deployed on a platform that auto-compresses (Vercel/Netlify/Cloudflare/Fly), or self-hosted config explicitly enables compression.
  • Fail criteria: Self-hosted setup with no compression enabled in config.
  • Skip (N/A) when: Cannot determine hosting; quote what was checked.
  • Do NOT pass when: Compression is configured for some routes but not others (e.g., gzip for HTML but not JSON API responses).
  • Report even on pass: "Hosting: {platform}; compression: auto-enabled by platform / explicit config."
  • Detail on fail: "Self-hosted Express server, no compression() middleware found in app entry".
  • Remediation: For Express:
    import compression from 'compression'
    app.use(compression())
    

Taxons

History