DEV Community

Cover image for How We Built a 99+ Mobile PageSpeed Website with Zero Framework Bloat
TechWeave Digital
TechWeave Digital

Posted on Edited on Originally published at techweavedigital.com

How We Built a 99+ Mobile PageSpeed Website with Zero Framework Bloat

Most modern web applications are heavily over-engineered.

You run a Google Lighthouse audit on an emulated Moto G Power over throttled slow 4G, and the numbers are brutal: Mobile Performance scores between 35 and 65, Total Blocking Time (TBT) exceeding 800ms, and megabytes of JavaScript re-hydrating static text nodes.

When architecting the production platform for Techweave Digital, our engineering rule was simple: Achieve a 99+ Mobile Lighthouse score, 100 SEO, and 100 Best Practices on day one.

Here is our live Google PageSpeed result on mobile:

  • Mobile Performance Score: 99 / 100
  • First Contentful Paint (FCP): 1.2s (Desktop: 0.4s)
  • Largest Contentful Paint (LCP): 1.2s (Desktop: 0.4s)
  • Total Blocking Time (TBT): 40ms
  • Cumulative Layout Shift (CLS): 0.006

Here are the 5 architectural decisions that made this possible — and how you can implement them in your next project.


1. Eliminate Hydration Overhead on Content Pages

The fastest JavaScript is the JavaScript you never send to the client.

For marketing, service, and landing pages, running a client-side Single Page Application (SPA) runtime is an anti-pattern. If your page does not require complex state management before the user interacts, render static HTML with semantic markup and layer micro-interactions with vanilla, zero-dependency JavaScript.

The Rule:

  • Static Content: Pure HTML5 + optimized utility CSS.
  • Interactivity: Self-contained vanilla JS modules attached on DOMContentLoaded.

2. Event Delegation Over Multiple Listeners

Attaching individual click and touch listeners to dozens of buttons (navigation drawers, accordions, modals, pricing cards) degrades memory and causes jank on low-powered mobile chipsets.

Instead of document.querySelectorAll('.btn').forEach(...), we use document-level event delegation:

// Single listener handling all modal triggers across the entire application
document.addEventListener('click', (e) => {
  const trigger = e.target.closest('.open-booking-modal-btn, a[href="#book-call"]');
  if (trigger) {
    e.preventDefault();
    if (typeof window.openBookingModal === 'function') {
      window.openBookingModal();
    }
  }
}, { passive: false });
Enter fullscreen mode Exit fullscreen mode

Why this matters for Core Web Vitals:

  • TBT drops to near zero (40ms): The browser thread isn't blocked registering hundreds of listener closures during initial render.
  • Zero element coupling: Elements dynamically added or lazy-loaded automatically respond without re-binding.

3. Speculative Hover & Touch Prefetching

Users take roughly 100ms to 300ms between hovering over a link (or resting their finger on mobile) and actually releasing the click.

We take advantage of that micro-window with speculative prefetching:

const prefetched = new Set();

function prefetchUrl(url) {
  if (!url || prefetched.has(url) || url.startsWith('#') || url.startsWith('mailto:')) return;

  prefetched.add(url);
  const link = document.createElement('link');
  link.rel = 'prefetch';
  link.href = url;
  document.head.appendChild(link);
}

// Mobile touch anticipation
document.addEventListener('touchstart', (e) => {
  const anchor = e.target.closest('a');
  if (anchor && anchor.href && anchor.origin === window.location.origin) {
    prefetchUrl(anchor.href);
  }
}, { passive: true });
Enter fullscreen mode Exit fullscreen mode

By the time the user's click registers, the destination document is already cached in memory, delivering 0ms perceptible page transitions.


4. Eliminate Cumulative Layout Shift (CLS: 0.006)

CLS is often caused by dynamically injected badges, unreserved image containers, or asynchronous web fonts.

How to get CLS under 0.01:

  1. Always reserve dimensional aspect ratios: Use Tailwind's aspect-video or explicit CSS min-height on cards and calculator containers so the page doesn't shift when content loads.
  2. Font Display Swap with Fallback Metric Matching: Use font-display: swap paired with system font fallbacks matching the x-height of your custom typeface.
  3. Container Padding for Horizontal Tracks: For mobile swipeable pill navs, use overflow-x: auto with smooth momentum touch scrolling and zero auto-resizing:
.subpage-pill-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subpage-pill-nav::-webkit-scrollbar {
  display: none;
}
Enter fullscreen mode Exit fullscreen mode

5. Aggressive Immutable Asset Caching

In our .htaccess production server configuration, static assets (SVGs, minified CSS, modular JS) are served with 1-year immutable cache headers:

<IfModule mod_headers.c>
  <FilesMatch "\.(ico|jpg|jpeg|png|webp|js|css|svg|woff2)$">
    Header set Cache-Control "max-age=31536000, public, immutable"
  </FilesMatch>
</IfModule>
Enter fullscreen mode Exit fullscreen mode

When repeat visitors or web crawlers hit subpages, network latency drops from ~500ms down to 0ms (served from memory disk cache).


The Takeaway

High performance is not about doing clever micro-optimizations at the end of a sprint; it's about what you decide NOT to import.

By rejecting heavy third-party tracking scripts, eliminating client runtime bloat, and embracing native browser APIs, achieving a 99+ mobile score is not only possible — it's repeatable.


What techniques are you using to keep your mobile Core Web Vitals green? Let's discuss in the comments below.


About the Author:

Engineered by the team at Techweave Digital — delivering scalable custom software, enterprise AI workflows, and dedicated senior developer pods with guaranteed North American and European timezone overlap.

Top comments (0)