Next.js performance: diagnose the slow part first

·3 min read

Investigate Next.js performance through server work, client JavaScript, rendering boundaries, image delivery and production-build measurements.

A solid dark structure transitioning into lighter modules beneath a silver ring.

A slow Next.js page can be delayed by server work, resource delivery, client JavaScript or a combination of all three. Begin with a production build and a reproducible journey. Development-mode behaviour is useful for debugging but is not a reliable production baseline. Record the route, device, network conditions and whether the visit is cold, cached or a client-side navigation.

Separate waiting from browser work

Inspect the initial response and the data requests required to render the page. Trace slow database queries or external calls rather than assuming that the framework is the bottleneck. Then inspect downloaded JavaScript and main-thread activity. A fast HTML response can still produce a sluggish interaction if a large client component performs expensive work. Conversely, reducing a bundle will not fix a server request blocked on a remote service.

Review rendering and data boundaries

Use the project’s Next.js version and routing model when evaluating caching and rendering. Do not apply a rule copied from another version without checking its behaviour. Keep interactive client boundaries as small as practical and avoid sending data or dependencies to the browser when they are only needed on the server. Review serial request chains and whether independent work can run concurrently. Any cache change needs explicit freshness and invalidation expectations for the affected data.

Inspect assets and third parties

  • Check image dimensions, responsive sizes and whether important images are discovered early without loading every image eagerly.
  • Inspect fonts and layout stability, including fallback behaviour while resources load.
  • Analyse large dependencies and client imports before replacing them or introducing dynamic loading.
  • Test analytics, chat and marketing scripts separately to understand their contribution to loading and interaction work.

Validate the real journey after each change

Measure the same production scenario again and verify content, accessibility, authentication and cache correctness. A fast page showing stale prices or another user’s data is not a successful optimisation. Compare cold and warm requests, direct visits and navigation from another page. Document what changed, the observed improvement and the remaining constraint. Keep the result tied to user experience and operating cost rather than an isolated bundle-size target. Finally, add an appropriate regression check for the shared template or critical journey.

Frequently asked questions

Should every component be a client component?

No. Use client boundaries for required interactivity and keep server-only work out of the browser bundle.

Will caching always improve the page?

It may reduce work, but only if freshness, invalidation and user-specific data boundaries remain correct.

Can we benchmark in development mode?

Use a production build for comparable performance conclusions; development mode adds different work and behaviour.

Should all images load with high priority?

No. Prioritise the genuinely important initial resource and let noncritical images load appropriately.

What should a performance ticket include?

A reproducible route and journey, baseline evidence, a causal hypothesis, acceptance checks and a comparable post-change result.

Bring the scope. We will help make it buildable.

Share the user journey, integrations and launch constraints. We can clarify the scope and prepare an estimate with assumptions and exclusions.

Further reading

Core Web Vitals audit: turn measurements into fixes

Audit LCP, INP and CLS using field evidence, reproducible lab diagnosis and template-level priorities rather than a single performance score.

API performance audit: find the work behind the latency

Audit API latency with percentile distributions, traces, database evidence, queue timing and bounded load experiments tied to business journeys.

Legacy application modernisation: a phased roadmap

Modernise a legacy application with dependency mapping, baseline evidence, bounded replacements, migration checks and explicit retirement criteria.