<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raafi Infotech</title>
    <description>The latest articles on DEV Community by Raafi Infotech (@raafi_infotech).</description>
    <link>https://dev.to/raafi_infotech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3950741%2Ff60165f0-b66f-40b8-9ada-077664a1337a.png</url>
      <title>DEV Community: Raafi Infotech</title>
      <link>https://dev.to/raafi_infotech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raafi_infotech"/>
    <language>en</language>
    <item>
      <title>How We Built a High-Performance Next.js Website That Scores 95+ on PageSpeed Insights</title>
      <dc:creator>Raafi Infotech</dc:creator>
      <pubDate>Mon, 25 May 2026 14:30:26 +0000</pubDate>
      <link>https://dev.to/raafi_infotech/how-we-built-a-high-performance-nextjs-website-that-scores-95-on-pagespeed-insights-id1</link>
      <guid>https://dev.to/raafi_infotech/how-we-built-a-high-performance-nextjs-website-that-scores-95-on-pagespeed-insights-id1</guid>
      <description>&lt;h1&gt;
  
  
  How We Built a High-Performance Next.js Website That Scores 95+ on PageSpeed Insights
&lt;/h1&gt;

&lt;p&gt;Website performance is no longer just a “nice-to-have” feature. In 2026, speed directly impacts SEO rankings, user experience, engagement, and conversion rates.&lt;/p&gt;

&lt;p&gt;At Raafi Infotech, we recently worked on optimizing our own Next.js website with a strong focus on Core Web Vitals, mobile performance, and real-world loading speed. The result was a website consistently achieving 95+ PageSpeed scores while maintaining modern UI/UX and rich animations.&lt;/p&gt;

&lt;p&gt;In this article, I’ll share the optimization techniques, architecture decisions, and performance strategies we used to achieve those results.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Performance Matters More Than Ever
&lt;/h2&gt;

&lt;p&gt;A slow website affects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SEO rankings&lt;/li&gt;
&lt;li&gt;Bounce rate&lt;/li&gt;
&lt;li&gt;User engagement&lt;/li&gt;
&lt;li&gt;Conversion rate&lt;/li&gt;
&lt;li&gt;Mobile experience&lt;/li&gt;
&lt;li&gt;Crawl efficiency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though Next.js provides excellent performance out of the box, many websites still suffer from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large JavaScript bundles&lt;/li&gt;
&lt;li&gt;Poor image handling&lt;/li&gt;
&lt;li&gt;Excessive animations&lt;/li&gt;
&lt;li&gt;Render-blocking resources&lt;/li&gt;
&lt;li&gt;Third-party script overload&lt;/li&gt;
&lt;li&gt;Layout shifts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Performance optimization requires intentional engineering decisions.&lt;/p&gt;




&lt;h1&gt;
  
  
  Our Optimization Approach
&lt;/h1&gt;

&lt;p&gt;Instead of relying on a single trick, we focused on improving every layer of the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Optimizing Images Properly
&lt;/h2&gt;

&lt;p&gt;Images are often the largest contributor to slow loading times.&lt;/p&gt;

&lt;p&gt;We used the &lt;code&gt;next/image&lt;/code&gt; component extensively to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically resize images&lt;/li&gt;
&lt;li&gt;Serve modern formats like WebP&lt;/li&gt;
&lt;li&gt;Lazy load offscreen images&lt;/li&gt;
&lt;li&gt;Deliver responsive images for different devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Image&lt;/span&gt;
  &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/hero.webp"&lt;/span&gt;
  &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Hero Banner"&lt;/span&gt;
  &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;700&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;priority&lt;/span&gt;
&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Improvements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Converted PNG/JPG assets to WebP&lt;/li&gt;
&lt;li&gt;Removed unnecessary large background images&lt;/li&gt;
&lt;li&gt;Used compressed thumbnails for mobile devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This significantly improved Largest Contentful Paint (LCP).&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Reducing JavaScript Bundle Size
&lt;/h2&gt;

&lt;p&gt;One of the biggest reasons many Next.js sites score poorly is excessive client-side JavaScript.&lt;/p&gt;

&lt;p&gt;We optimized this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using dynamic imports&lt;/li&gt;
&lt;li&gt;Avoiding unnecessary libraries&lt;/li&gt;
&lt;li&gt;Minimizing client components&lt;/li&gt;
&lt;li&gt;Splitting large modules&lt;/li&gt;
&lt;li&gt;Removing unused packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;dynamic&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/dynamic&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HeavyComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dynamic&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./HeavyComponent&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;ssr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reduced initial page load time and improved Interaction to Next Paint (INP).&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Using Server Components Strategically
&lt;/h2&gt;

&lt;p&gt;Next.js App Router provides powerful server component capabilities.&lt;/p&gt;

&lt;p&gt;Instead of rendering everything on the client side, we moved non-interactive sections to server components wherever possible.&lt;/p&gt;

&lt;p&gt;Benefits included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smaller JS bundles&lt;/li&gt;
&lt;li&gt;Faster rendering&lt;/li&gt;
&lt;li&gt;Better SEO&lt;/li&gt;
&lt;li&gt;Improved caching efficiency&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Font Optimization
&lt;/h2&gt;

&lt;p&gt;Fonts can easily become hidden performance bottlenecks.&lt;/p&gt;

&lt;p&gt;We optimized fonts using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;next/font&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Limited font weights&lt;/li&gt;
&lt;li&gt;Preloading important fonts&lt;/li&gt;
&lt;li&gt;&lt;code&gt;font-display: swap&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Poppins&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/font/google&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;poppins&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Poppins&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;subsets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;latin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;400&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;500&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;600&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;swap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helped reduce layout shifts and improve CLS scores.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Eliminating Layout Shifts (CLS)
&lt;/h2&gt;

&lt;p&gt;Unexpected movement during loading creates a poor user experience.&lt;/p&gt;

&lt;p&gt;We fixed CLS issues by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Defining explicit image dimensions&lt;/li&gt;
&lt;li&gt;Reserving space for dynamic content&lt;/li&gt;
&lt;li&gt;Avoiding late-loading UI elements&lt;/li&gt;
&lt;li&gt;Optimizing font rendering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A stable layout improved both usability and Core Web Vitals.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Optimizing Animations Carefully
&lt;/h2&gt;

&lt;p&gt;Modern UI animations look great, but they can hurt performance if implemented incorrectly.&lt;/p&gt;

&lt;p&gt;We optimized animations by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoiding heavy animation libraries where unnecessary&lt;/li&gt;
&lt;li&gt;Reducing excessive motion effects&lt;/li&gt;
&lt;li&gt;Using GPU-friendly transitions&lt;/li&gt;
&lt;li&gt;Lazy loading animation-heavy sections&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal was balancing visual appeal with performance.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Improving Caching &amp;amp; Delivery
&lt;/h2&gt;

&lt;p&gt;Performance is not just frontend optimization.&lt;/p&gt;

&lt;p&gt;We also improved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser caching&lt;/li&gt;
&lt;li&gt;CDN delivery&lt;/li&gt;
&lt;li&gt;Compression&lt;/li&gt;
&lt;li&gt;Asset minification&lt;/li&gt;
&lt;li&gt;Cache headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using modern hosting infrastructure and caching strategies dramatically improved repeat visits and global loading speed.&lt;/p&gt;




&lt;h1&gt;
  
  
  Tools We Used
&lt;/h1&gt;

&lt;p&gt;We continuously tested performance using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google PageSpeed Insights&lt;/li&gt;
&lt;li&gt;Lighthouse&lt;/li&gt;
&lt;li&gt;Chrome DevTools&lt;/li&gt;
&lt;li&gt;Core Web Vitals reports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of optimizing only for synthetic scores, we focused on real-world usability.&lt;/p&gt;




&lt;h1&gt;
  
  
  Key Lessons We Learned
&lt;/h1&gt;

&lt;p&gt;After multiple optimization cycles, here are the biggest takeaways:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Performance is Continuous
&lt;/h3&gt;

&lt;p&gt;Optimization is not a one-time task.&lt;/p&gt;

&lt;p&gt;Every new feature, dependency, or animation can affect performance.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Less JavaScript = Better UX
&lt;/h3&gt;

&lt;p&gt;Reducing unnecessary client-side code had the biggest impact overall.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Image Optimization Matters More Than Most Developers Think
&lt;/h3&gt;

&lt;p&gt;Even small image improvements can drastically improve mobile performance.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Third-Party Scripts Are Dangerous
&lt;/h3&gt;

&lt;p&gt;Analytics, chat widgets, tracking scripts, and external embeds can severely impact performance if not managed carefully.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Results
&lt;/h1&gt;

&lt;p&gt;After implementing these optimizations, we achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;95+ PageSpeed scores&lt;/li&gt;
&lt;li&gt;Improved mobile usability&lt;/li&gt;
&lt;li&gt;Faster Largest Contentful Paint (LCP)&lt;/li&gt;
&lt;li&gt;Lower Cumulative Layout Shift (CLS)&lt;/li&gt;
&lt;li&gt;Better SEO performance&lt;/li&gt;
&lt;li&gt;Improved overall user experience&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, the website feels significantly faster in real-world usage.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Next.js is an incredibly powerful framework, but achieving high performance requires thoughtful engineering decisions.&lt;/p&gt;

&lt;p&gt;A fast website is not only good for SEO — it directly improves user trust, engagement, and conversions.&lt;/p&gt;

&lt;p&gt;At Raafi Infotech, we focus on building high-performance web applications using modern technologies like Next.js, Laravel, Flutter, and scalable cloud infrastructure.&lt;/p&gt;

&lt;p&gt;If you're interested in performance-focused development, feel free to explore our work:&lt;br&gt;
&lt;a href="https://www.raafiinfotech.com/" rel="noopener noreferrer"&gt;https://www.raafiinfotech.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>performance</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
