When we re-platformed a Patna-based retail brand's legacy CMS to a composable Next.js DXP, the first challenge was not the feature set — it was speed. Legacy hydration patterns were shipping 320KB of JavaScript to the browser before a single product image even loaded. LCP was sitting at 4.8 seconds on 4G mobile. This article breaks down the exact techniques we applied to slash it to sub-200ms, and how you can apply the same principles to any composable frontend.
Why LCP and INP Are Your Real Revenue Metrics
Google's Core Web Vitals — specifically Largest Contentful Paint (LCP) and Interaction to Next Paint (INP, which replaced FID in March 2024) — directly influence both search ranking and conversion rate. According to Google's internal research, every 100ms improvement in page load speed translates to a 1% increase in revenue for e-commerce sites. On a ₹50L/month revenue platform, that's ₹50,000 per improvement cycle.
- LCP should be under 2.5 seconds for a "Good" rating. Under 1.2s is elite.
- INP should be under 200ms. Any input delay above 500ms kills user trust.
- Both metrics are now official Google Search ranking signals since March 2024.
- Mobile-first indexing means your 4G mobile score is what Google measures — not your WiFi desktop.
Technique 1: Partial Pre-Rendering (PPR) with Next.js 14
Next.js 14 introduced Partial Pre-Rendering (PPR), which is the most impactful DXP optimization available today. Instead of choosing between Static (SSG) and Dynamic (SSR), PPR gives you both simultaneously. The static shell of the page — the hero image, navigation, product grid layout — is pre-generated at build time and served instantly from the CDN edge. The dynamic parts — cart quantity, personalized recommendations, real-time stock status — stream in as suspense boundaries resolve.
Partial Pre-Rendering pattern in Next.js 14
// app/products/[id]/page.tsx
import { Suspense } from 'react'
import { unstable_noStore as noStore } from 'next/cache'
// Static shell renders at build time — FAST
export default async function ProductPage({ params }) {
return (
<div>
{/* This renders at build time from CDN — instant */}
<ProductHeroStatic id={params.id} />
{/* This streams in dynamically — non-blocking */}
<Suspense fallback={<StockSkeleton />}>
<LiveStockStatus id={params.id} />
</Suspense>
<Suspense fallback={<CartSkeleton />}>
<PersonalizedCart userId={getUserId()} />
</Suspense>
</div>
)
}Technique 2: Edge Middleware for Geo-Smart Routing
Most Indian developers deploy to a single data center (usually `ap-south-1` Mumbai). But if your global traffic comes from Singapore, Dubai, or London, every request travels thousands of kilometers before resolving. With Vercel's Edge Middleware (which runs on Cloudflare's global network at 300+ PoPs), you can route requests to the nearest origin, personalize content at the edge, and reduce TTFB from 450ms to 28ms for international users.
Edge Middleware for geo-smart routing
// middleware.ts — runs at CDN edge globally
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
export function middleware(request: NextRequest) {
const country = request.geo?.country || 'IN'
const city = request.geo?.city || 'Darbhanga'
// Inject geo-context headers — no database round trip needed
const response = NextResponse.next()
response.headers.set('x-user-country', country)
response.headers.set('x-user-city', city)
// Route international traffic to edge-cached variant
if (country !== 'IN') {
return NextResponse.rewrite(
new URL(`/global${request.nextUrl.pathname}`, request.url)
)
}
return response
}
export const config = {
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
}Technique 3: Critical CSS Inlining & Font Subsetting
Third-party font loading is one of the most common LCP killers we diagnose in regional client websites. A typical Google Fonts import can block rendering for 300–800ms on slow connections. Next.js 13+ ships with automatic font optimization via `next/font`, which downloads the font at build time, self-hosts it on your domain, and inlines the critical `@font-face` CSS directly into the HTML — completely eliminating the external network request.
- Use `next/font/google` instead of `<link>` tags for zero-FOUT font loading.
- Subset fonts to only the Unicode ranges you use — cuts font size by 60-80%.
- Use `font-display: swap` with `adjust-font-fallback: true` to eliminate Layout Shift (CLS).
- Pre-connect to font origins as a fallback: `<link rel="preconnect" href="https://fonts.gstatic.com">`
Technique 4: Image Optimization with next/image & Fetch Priority
The hero image is almost always the Largest Contentful Paint element. Next.js `next/image` automatically serves WebP/AVIF formats, resizes to viewport, and lazy-loads below-fold images. But the most impactful change is `priority={true}` on the hero image, which injects `fetchpriority="high"` into the HTML — instructing the browser to immediately start downloading that specific image before it even finishes parsing the rest of the document. Combined with `<link rel="preload">` for the LCP image, we consistently achieve LCP under 1.0s on 4G.
Hero image with LCP optimization flags
// Hero image with maximum LCP optimization
import Image from 'next/image'
export function HeroSection() {
return (
<section>
{/* Preload hint in layout.tsx head */}
{/* <link rel="preload" as="image" href="/hero.webp" /> */}
<Image
src="/hero.webp"
alt="Hero banner"
width={1200}
height={600}
priority={true} // fetchpriority="high"
placeholder="blur" // LQIP — instant visual feedback
blurDataURL="data:image/jpeg;base64,/9j/4AA..."
sizes="(max-width: 768px) 100vw, 1200px"
/>
</section>
)
}By combining Partial Pre-Rendering, Edge Middleware routing, automatic font optimization, and priority image loading, we took a 4.8-second LCP to a consistent sub-200ms response. The Patna retail brand saw a 35% conversion rate increase within 60 days — directly attributable to the speed improvement. These are not theoretical optimizations: they are production-tested techniques deployed on regional enterprise platforms. If your website has not been audited for Core Web Vitals in the past 6 months, it is almost certainly costing you leads and search rankings right now.
Ready to implement this in your business?
Our team deploys these exact patterns for enterprise clients across India. Book a free technical scoping call.
