Skip to content
Arifur.
Home/Case Studies/Scaling Next.js SEO, Core Web Vitals, and PageSpeed to Perfection at Livora
Engineering Case Study48-Hour Engineering SprintClient: Livora

Scaling Next.js SEO, Core Web Vitals, and PageSpeed to Perfection at Livora

A deep-dive technical retrospective on diagnosing Google indexing roadblocks, optimizing Total Blocking Time (TBT) and Largest Contentful Paint (LCP), and systematically boosting Google Lighthouse metrics from 61 to 93+ on Desktop and 83 on Mobile with 100% scores in Accessibility and SEO.

Arifur Rahaman
Senior Software Engineer
September 2026
8 min read
#Next.js 15/16
#Core Web Vitals
#Technical SEO
#PageSpeed 93+
#Performance Engineering
#Schema.org JSON-LD
#Code Splitting
#SSR & Hydration
Sprint Core Web Vitals & Benchmark Highlights
Desktop Performance
93 / 100
+32 pts (from 61)

Entered Google's official Green Zone

Mobile Performance
83 / 100
+33+ pts (from <50)

Throttled CPU 4G benchmark

Accessibility Score
100 / 100
+18 pts (from 82)

Flawless ARIA & screen reader support

SEO & Indexability
100 / 100
Full Catalog Indexed

Rich Product & Breadcrumb schemas

Desktop LCP
0.6 s
-64% faster (from 1.7s)

Sub-second Largest Contentful Paint

Desktop TBT
180 ms
-72% reduction

Down from 640ms–890ms CPU blocking

Executive Summary

When scaling modern luxury e-commerce platforms like Livora, delivering a silky-smooth user experience while ensuring rapid organic search indexation is paramount. Over a high-intensity 48-hour engineering sprint, we diagnosed deep hydration stalls, unblocked Googlebot indexing, hardware-accelerated complex CSS, and drove Desktop PageSpeed from 61 to 93+ alongside 100% Accessibility and SEO.

Core Technical Challenges Targeted

01

Search Engine Visibility Barrier

Only a single product was indexing in Google Search due to legacy domain mismatches, restrictive crawl directives in robots.ts, and missing structured Schema.org markup.

02

Desktop Blocking & Accessibility

Initial audits showed a 61 Performance baseline with 640ms–890ms Total Blocking Time (TBT) driven by heavy hydration tasks, chained network dependencies, and generic ARIA labeling.

03

Mobile CPU Throttling & Render Delays

Eager-mounting off-canvas UI drawers, unoptimized third-party packages, and heavy SVG backdrop filters caused mobile LCP to balloon to 4.7 seconds under simulated 4G conditions.

Sprint Diagnostic Phase

Baseline Diagnostics: The Initial Bottlenecks

Before writing code, we performed exhaustive Lighthouse, PageSpeed Insights, and Chrome Performance profiling to map out the exact CPU execution bottlenecks, network waterfalls, and crawler barriers.

Initial Diagnostic Benchmarks

Measured on Desktop profile prior to sprint refactoring

Category / MetricInitial BenchmarkStatus / Diagnosed Issue
Performance (Desktop)61 / 100Needs urgent main-thread and critical-path optimization
Accessibility82 / 100Missing accessible names on buttons, generic image alt text
Best Practices96 / 100Minor security and crawler hygiene tweaks needed
SEO100 / 100Surface audit passed, but product indexing was failing in Google
First Contentful Paint (FCP)0.3 sFast initial HTML delivery from edge cache
Largest Contentful Paint (LCP)1.7 sDelayed by client-side hydration stalls and font swapping
Total Blocking Time (TBT)640 ms – 890 msHeavy hydration tasks holding the CPU during first render
Speed Index3.3 sDelayed visual completion of above-the-fold content
Initial Desktop PageSpeed Report - Score 61, TBT 640ms

Initial PageSpeed audit baseline: 61 Performance, 640ms TBT, and 1.7s LCP.

Root Cause Analysis & Critical Path Latency

1

Google Indexing Barrier

  • Codebase used hardcoded legacy domain references (https://livora.com vs https://livora4u.com), triggering canonical mismatch rejections.
  • robots.ts was wasting Googlebot crawl budget on authenticated routes (/app/, /checkout/).
  • Dynamic product pages lacked rich Schema.org Product and BreadcrumbList JSON-LD structured data.
2

Main-Thread Choking & Critical Path Chaining

  • Critical path latency reached 2,534 ms due to sequential script evaluation.
  • Redux logging middleware, state persistence gates, and synchronous device trackers executed immediately during React's initial hydration pass.
  • Font stylesheets triggered Flash of Invisible Text (FOIT) without explicit font-display: swap directives.
3

Eager Component Hydration

  • Modals and off-canvas drawers (MobileMenu, FloatingCart, AddCartProductOptions, Lottie runtimes) were rendered directly into the initial DOM.
  • Event listeners and Ant Design CSS-in-JS style tags registered on page load before any user interaction, inflating mobile CPU load.
Performance Diagnostics: Element Render Delay and Critical Path Chains

Chrome Performance Insights diagnostic illustrating 2,534ms critical path latency and forced reflow bottlenecks.

Execution Blueprint

Technical Roadmap & Implementation

To eliminate these bottlenecks without altering luxury branding or business logic, optimizations were rolled out systematically across four focused architectural phases.

Phase 01

Global SEO & Search Indexability Overhaul

f4f7292, f33528b
Phase 02

Main-Thread Liberation & Bundle Optimization

f57009e, f33528b
Phase 03

Mobile CPU & TBT Reductions via Lazy-Mounted Drawers

d351670
Phase 04

Server-Side Pre-Rendering, GPU Layers & UI Fixes

f57009e, d351670
Phase 01

Global SEO & Search Indexability Overhaul

Commits:f4f7292, f33528b

1. Centralized Domain Infrastructure

Established a single source of truth for canonical URL resolution across SSR, metadata, sitemaps, and robots.

src/config/variables.ts
export const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://livora4u.com";

2. Configured metadataBase & Googlebot Directives

Injected metadataBase and granular Googlebot directives into Next.js App Router root layout to maximize rich snippet display allowances.

src/app/layout.tsx
export const metadata: Metadata = {
  metadataBase: new URL(SITE_URL),
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      "max-video-preview": -1,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
};

3. Resilient Dynamic XML Sitemap

Refactored sitemap generation with isolated try/catch error boundaries to guarantee that single upstream API anomalies will never break the XML feed.

  • Added dynamic category and product URL generators with priority weighting.
  • Added lastModified timestamps based on CMS change records.

4. Rich Schema.org Product & Breadcrumb JSON-LD

Injected Schema.org Product (BDT currency, availability, pricing, brand) and BreadcrumbList schemas into product detail pages for Google rich snippet qualification.

5. Agentic & AI Search Crawler Optimization

Published public/llms.txt and tailored crawler directives for modern AI search engines including ChatGPT, Perplexity, and ClaudeBot.

Phase 02

Main-Thread Liberation & Bundle Optimization

Commits:f57009e, f33528b

1. Non-Blocking Analytics with requestIdleCallback

Deferred user activity tracking (ActivityTracker.tsx) and session restoration (AppContext.tsx) to idle periods, freeing the CPU during hydration.

2. Streamlined State & Styling Providers

Purged Redux logging overhead in production, resolved double-mounting cycles in ThemeProvider.tsx, and added display: swap to font imports to prevent FOIT.

3. Compiler Tree-Shaking & Next.js Image Caching

Configured optimizePackageImports in next.config.ts to tree-shake heavy UI packages and enabled 1-year immutable caching for modern AVIF/WebP image formats.

next.config.ts
experimental: {
  optimizePackageImports: ["antd", "@reduxjs/toolkit", "@apollo/client"],
},
images: {
  formats: ["image/avif", "image/webp"],
  minimumCacheTTL: 31536000, // 1-year immutable cache
}
Phase 03

Mobile CPU & TBT Reductions via Lazy-Mounted Drawers

Commits:d351670

1. Dynamic Imports with Conditional Mounting

Drawers and off-canvas components previously mounted hidden in the DOM were converted to dynamic imports and mounted strictly when opened by the user.

  • Shed hundreds of kilobytes of unexecuted JavaScript from initial critical render path.
  • Prevented Ant Design CSS-in-JS style injection during first paint.
src/layouts/MobileMenu.tsx & AddCartProductOptions.tsx
// Dynamic import with SSR disabled for heavy off-canvas components
const DynamicDrawer = dynamic(
  () => import("antd/es/drawer"),
  { ssr: false }
);

// Only renders and registers DOM nodes when explicitly opened
{open && (
  <DynamicDrawer open={open} onClose={onClose}>
    {/* Navigation / Cart Content */}
  </DynamicDrawer>
)}
Phase 04

Server-Side Pre-Rendering, GPU Layers & UI Fixes

Commits:f57009e, d351670

1. SSR Category Product Delivery

Pre-fetched the initial category product catalog on the server in LandingPageComponent, enabling instantaneous visual display with zero layout shift (CLS = 0).

2. GPU Hardware Compositing

Applied will-change: transform and transform: translateZ(0) to hero containers with Gaussian gradient blurs, offloading intensive rasterization from mobile CPU to GPU hardware layers.

3. Accessibility Boost (82 → 100)

Audited every interactive element, adding descriptive aria-labels to hamburger triggers, cart buttons, and dynamic image alt tags with fallback formatting.

4. Product Variant UI Polish

Refactored CartProductVariants.tsx with sleek interactive thumbnail pill selectors featuring distinct active selection rings (ring-2 ring-primary/30).

Verified Audit Benchmarks

The Final Results: Before vs. After

Following the 48-hour sprint, we ran verified PageSpeed Insights audits on both Desktop and throttled Mobile profiles.

Final Desktop Audit

🟢 Official Green Zone (93/100)
+32 Pts
93
Performance
100
Accessibility
96
Best Practices
100
SEO

Desktop Web Vitals Breakdown

Performance93 / 100
First Contentful Paint (FCP)0.3 s
Largest Contentful Paint (LCP)0.6 s
Total Blocking Time (TBT)180 ms
Cumulative Layout Shift (CLS)0.001
Final Desktop PageSpeed Insights Result: 93 Performance, 100 Accessibility, 100 SEO

Final Desktop Audit: 93 Performance 🟢, 100 Accessibility 🟢, 100 SEO 🟢, 0.6s LCP, 180ms TBT.

Final Mobile Audit

🟠 Throttled CPU 4G Simulation (83/100)
+33+ Pts
83
Performance
100
Accessibility
96
Best Practices
100
SEO

Mobile Web Vitals Breakdown

Performance83 / 100
First Contentful Paint (FCP)1.0 s
Largest Contentful Paint (LCP)2.5 s
Total Blocking Time (TBT)210 ms
Cumulative Layout Shift (CLS)0.001
Final Mobile PageSpeed Insights Result: 83 Performance, 100 Accessibility, 100 SEO

Final Mobile Audit under CPU throttling: 83 Performance, 100 Accessibility, 100 SEO.

Lighthouse Checkpoints & Agentic Crawl Verification

Mobile Lighthouse 100% SEO, Accessibility & Best Practices

Mobile Lighthouse report confirming 100% SEO, 100% Accessibility, and 96% Best Practices.

Intermediate Desktop Audit with 93 Accessibility & Agentic Crawl Verification

Mid-sprint desktop audit checkpoint reaching 93 Accessibility with verified Agentic Browsing directives.

Detailed Metrics Progression & Net Improvement

Complete before-and-after audit benchmarks across Core Web Vitals and Google indexing parameters

Metric / Audit DimensionInitial BaselineFinal Achieved StatusTotal Net Improvement
Desktop Performance61 / 10093 / 100+32 Points (Green Zone)
Mobile Performance~50 / 10083 / 100+33+ Points
Accessibility (A11y)82 / 100100 / 100+18 Points (Perfect 100)
Best Practices96 / 10096–100 / 100Production Grade
SEO Rating100 (1 Indexed)100 / 100Full Catalog & Schema
Desktop LCP1.7 s0.6 s64% Faster
Mobile LCP4.7 s2.5 sCut in half (47% drop)
Desktop TBT640 ms – 890 ms180 ms72% CPU Reduction
Mobile TBT390 ms+210 ms46% CPU Reduction
Cumulative Layout Shift (CLS)0.0000.001Absolute Visual Stability
Engineering Playbook

Key Engineering Takeaways

Core principles derived from this performance sprint that can be systematically applied across modern React and Next.js applications.

01Core Web Vitals

Don't just render drawers hidden; don't mount them until opened

Using CSS display: none or default Ant Design drawer components still forces the browser to evaluate JavaScript and construct DOM structures during initial hydration. Lazy-loading and conditional mounting ({open && <Drawer />}) saved over 2.2 seconds of mobile LCP delay.

02Main-Thread Efficiency

Keep Analytics and Life-Cycle Tasks Off the Critical Path

requestIdleCallback is one of the most underutilized browser APIs for Next.js applications. Moving route and device trackers to idle callbacks protects your Total Blocking Time (TBT).

03Technical SEO

Structured Data is the Key to E-Commerce SEO

Googlebot prioritizes crawl budgets when pages provide valid, error-free BreadcrumbList and Product schemas with correct canonical URLs and open robot permissions.

04CSS & Hardware

Hardware-Accelerate Complex CSS

Heavy SVG blur filters and animated gradient borders can heavily tax mobile CPUs. Adding transform: translateZ(0) offloads rendering to the GPU and prevents costly forced reflows.

Related Codebase References

Key modules and architectural anchors updated during this optimization sprint

Global Domain Configuration
Centralized SITE_URL canonical reference
src/config/variables.ts
Root Metadata & Googlebot Directives
Base canonical, indexing & preview allowances
src/app/layout.tsx
Next.js Performance Configuration
Package tree-shaking & AVIF/WebP image cache
next.config.ts
Dynamic Sitemap
Resilient dynamic XML sitemap with error isolation
src/app/sitemap.ts
Dynamic Robots & AI Crawlers
Crawler hygiene & LLM search engine policies
src/app/robots.ts & public/llms.txt
Structured Product Schema
Product & BreadcrumbList Schema.org JSON-LD
src/modules/products/components/ProductDetailsPage.tsx
Mobile Navigation Drawer
Conditional lazy mounting for off-canvas drawer
src/layouts/MobileMenu.tsx
Category SSR Pre-fetching
Pre-rendered server catalog with CLS = 0
src/modules/landingPage/components/index.tsx
Full-Stack & Performance Engineering

Want to scale your web application's speed and SEO?

Let's connect to discuss technical architecture, Core Web Vitals optimization, or full-stack Next.js engineering for your product.