Performance Monitoring: Mastering Web Vitals in Next.js
Learn to run Lighthouse audits and interpret Core Web Vitals to optimize your Next.js application's performance and eliminate production bottlenecks.
Previously in this course, we discussed testing components to ensure your application logic is sound. Now that your blog is functional and tested, it's time to ensure it feels fast to your users.
Performance isn't just a "nice-to-have" feature—it is a core pillar of user experience. If your site takes too long to load or janks during interaction, users will leave. In this lesson, we will focus on measuring performance using Lighthouse and Core Web Vitals to identify and resolve bottlenecks in our ongoing blog project.
Understanding Performance from First Principles
Performance monitoring falls into two main categories: Synthetic Monitoring and Real User Monitoring (RUM).
- Synthetic Monitoring: Lab-based tests (like Lighthouse) that simulate a user's experience under controlled conditions. It is perfect for catching regressions during development.
- Real User Monitoring: Data collected from actual users visiting your site. This is the only way to understand how your app performs on varying network speeds and devices in the real world.
When we talk about "speed," we focus on Core Web Vitals, the industry-standard metrics for user-centric performance:
| Metric | What it measures | Goal |
|---|---|---|
| LCP | Largest Contentful Paint (Loading) | < 2.5s |
| INP | Interaction to Next Paint (Interactivity) | < 200ms |
| CLS | Cumulative Layout Shift (Stability) | < 0.1 |
Running Lighthouse Audits
Lighthouse is built directly into Chrome DevTools. To audit our blog:
- Open your local development server (or your deployed Vercel URL).
- Open Chrome DevTools (F12 or Cmd+Option+I).
- Navigate to the Lighthouse tab.
- Select "Desktop" or "Mobile" and click Analyze page load.
Lighthouse provides a score and, more importantly, a list of "Opportunities." These might include "Reduce unused JavaScript," "Properly size images," or "Eliminate render-blocking resources."
Interpreting Core Web Vitals
While Lighthouse gives you a snapshot, you should also look at the Network and Performance tabs in DevTools to see exactly what blocks the main thread.
If your LCP is high, check if your header image is being lazy-loaded unnecessarily or if your font files are too large. If your CLS is high, it usually means your UI elements (like a newsletter sign-up form) are jumping around as content loads. We previously touched on this when optimizing images and font loading.
Hands-on Exercise: Optimize a Bottleneck
Let's assume our Lighthouse report indicates that our "Recent Posts" section is causing a layout shift because the images don't have defined dimensions.
- Run the audit: Identify the specific element causing the shift.
- Apply the fix: In your
PostCardcomponent, ensure you are using thenext/imagecomponent with explicitwidthandheightorfillprops within a relative container. - Verify: Run the audit again to see the CLS score improve.
Common Pitfalls
- Testing in Development: Never measure performance using the
npm run devbuild. Development mode includes extra overhead for HMR (Hot Module Replacement). Always build your app locally (npm run build && npm run start) before running an audit. - Ignoring the "Low-Hanging Fruit": Developers often obsess over code minification while ignoring huge, unoptimized images. Always prioritize the fixes Lighthouse suggests first.
- Chasing 100s: Don't obsess over a perfect 100/100 score. Focus on keeping your Core Web Vitals within the "Good" threshold.
Moving Beyond Synthetic Tests
While Lighthouse is a great starting point, professional teams rely on RUM to catch issues that synthetic tests miss. You can learn more about this in our guides on Performance Observer API and Real User Monitoring. If you want to build your own system, see Performance Monitoring Without Bloat. For a broader strategy, read about Monitoring Production Performance.
Recap
We've learned that performance is about more than just speed; it's about stability and responsiveness. By using Lighthouse to identify bottlenecks and focusing on Core Web Vitals, you can ensure your blog provides a professional experience.
Up next: We will explore Static Site Generation (SSG) to make our blog even faster by pre-rendering pages at build time.
Work with me

Next.js Full-Stack Web App Development
A fast, SEO-ready full-stack web app built with Next.js 16 — from idea to deployed product, by an engineer who ships to production.

Laravel Bug Fixes, Maintenance & Optimization
Stuck on a Laravel bug or a slow app? Fast, reliable fixes, upgrades, and performance tuning from an experienced Laravel engineer.

