Project A: 100/100 PageSpeed Insights
A simulated case study demonstrating methods to achieve perfect Lighthouse scores across Performance, Accessibility, Best Practices, and SEO on production-ready builds.
Jump to Proof of Work ↓Highlights
Stack & Tactics
- Critical CSS, defer non-critical JS, reduce main-thread work
- Self-hosted assets, preload key resources, image optimization (AVIF/WebP)
- HTTP/2 or HTTP/3 delivery via CDN edge; caching with immutable assets
- Strict CSP, minimal JS, semantic HTML, accessible components
Process
- Audit: Lighthouse, WebPageTest, Chrome Profiler
- Prioritize: render-blocking removal, payload reduction, preconnect/preload
- Implement: layout stability, responsive images, code-splitting
- Validate: repeat audits across devices and network profiles
Executive Summary
This simulated case study demonstrates how to achieve perfect Lighthouse scores in production-like conditions without gimmicks. The work focuses on first render speed, main-thread reduction, and visual stability, while maintaining accessibility and SEO compliance.
Context
Small team, limited time, real constraints. Fonts from a brand CDN we couldn’t remove on day one; legacy JS we phased out in steps. This is how most real projects feel.
What broke (and how I fixed it)
- CSP blocked fonts: updated policy or self‑hosted; verified with browser console and report‑only mode.
- CLS spikes on mobile: added explicit width/height and aspect-ratio to media; re-ran field tests.
- Over‑eager lazy-loading: hero image was delayed; removed lazy on above-the-fold, kept for below.
Tradeoffs
- Kept one analytics script; deferred it and used server-side tagging later.
- Did not add a complex bundler; used simple build steps to keep things debuggable.
If I had two more weeks
- Self-host all fonts and icons; remove external font CSS.
- Inline only critical CSS determined via trace-based tooling; ship a CSS budget in CI.
- Move to font-variant-alternates and fewer weights to trim bytes.
Objectives & Success Criteria
Objective | Target | Notes |
---|---|---|
Core Web Vitals | LCP ≤ 2.5s, INP ≤ 200ms, CLS ≤ 0.1 | Field-realistic thresholds |
Payload | HTML ≤ 40KB, CSS ≤ 50KB, JS ≤ 70KB (gzip) | Critical CSS inline ≤ 12KB |
Fonts | Preload + swap; ≤ 2 families | Self-host or allowlist via CSP |
Caching | Static assets cache ≥ 1 year, immutable | Versioned asset paths |
Architecture Overview
Key Optimizations
Rendering Path
- Inline minimal critical CSS; load rest async
- Defer non-critical JS; avoid large polyfills
- Remove unused CSS/JS with tree-shaking and CSS pruning
Images & Media
- Responsive images with srcset/sizes
- Modern formats: AVIF/WebP with fallbacks
- Reserve dimensions to eliminate CLS
Fonts
- Preload primary font; font-display: swap
- Subset fonts; limit weights/styles
- Self-host or update CSP to allow trusted CDNs
HTTP & Caching
- HTTP/2 or HTTP/3; brotli compression
- Cache-Control: public, max-age=31536000, immutable
- Versioned asset paths to bust cache on deploy
Before / After
Metric | Before | After | Delta |
---|---|---|---|
LCP | 3.4s | 1.9s | -1.5s |
INP | 280ms | 140ms | -140ms |
CLS | 0.18 | 0.02 | -0.16 |
Total JS | 210KB | 58KB | -152KB |
Requests | 56 | 18 | -38 |
Numbers are representative for demonstration.
Proof of Work
This is a demonstration. Artifacts simulate real deliverables to showcase capability.
Lighthouse Report (Sample)
Summary: P100 / A100 / BP100 / SEO100. Key wins: critical CSS, font-display swap, reserved media space, async JS. Includes mobile and desktop runs, throttling profile details, and trace highlights.
Architecture Deck (Outline)
- Before/After critical path
- Resource hints strategy
- Edge caching and invalidation
- Core Web Vitals remediation plan
Audit Checklist
- Eliminate render-blocking resources
- Compress assets (Brotli)
- Set long-term caching for static assets
- Reserve media space to prevent CLS
- Reduce JS execution time
Config & Headers (Excerpts)
# _headers /* X-Frame-Options: DENY X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' /assets/* Cache-Control: public, max-age=31536000, immutable <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preload" as="image" href="/hero.avif" imagesrcset="..." imagesizes="...">