Web Performance and Core Web Vitals

Measure and improve load speed and responsiveness with Core Web Vitals, smaller bundles, image optimisation and caching.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Rendering Strategies, Metadata and SEO

Many of your users are on mid-range Android phones and patchy 4G. Performance is a feature, and Google uses Core Web Vitals in search ranking.

Core Web Vitals

  • LCP (Largest Contentful Paint): how fast the main content appears. Aim for under 2.5 seconds.
  • INP (Interaction to Next Paint): how quickly the page responds to taps and clicks.
  • CLS (Cumulative Layout Shift): how much the layout jumps around while loading.

Measuring

Use Lighthouse and PageSpeed Insights for lab data, and real user monitoring (Vercel Analytics or the web-vitals library) for field data. Always test with mobile throttling.

Common fixes

  • Ship less JavaScript: keep components on the server, lazy-load heavy client widgets, and check bundle size before adding libraries.
  • Optimise images with next/image, modern formats and correct sizes.
  • Load fonts with next/font to avoid layout shift.
  • Set width and height (or aspect ratio) on media to prevent CLS.
  • Cache static assets aggressively and API responses where safe.
  • Fix slow backend queries; a fast frontend cannot hide a 3-second API.

Pitfalls

  • Optimising only on a fast laptop with good Wi-Fi.
  • Adding a large charting or date library for one small feature.
  • Chasing a perfect Lighthouse score instead of real user metrics.

You are ready to move on when your public pages hit good Core Web Vitals on a throttled mobile profile, and you can explain the biggest improvement you made and why it worked.

Key concepts

  • LCP, INP and CLS
  • Lighthouse and PageSpeed Insights
  • Real user monitoring
  • Bundle size and code splitting
  • Image and font optimisation
  • HTTP caching
  • Bundle analyzer

Mini project

Run Lighthouse on your portal with mobile throttling, fix the top three issues (images, JavaScript size, layout shift), and publish a before and after report in the README.

Check yourself

Your LCP is 5 seconds on mobile. Name three likely causes and how you would confirm each.

Free resources