This application is optimized for excellent Lighthouse scores with focus on Core Web Vitals:
- LCP (Largest Contentful Paint): < 2.5s
- TTI (Time to Interactive): < 3.8s
- FID (First Input Delay): < 100ms
- CLS (Cumulative Layout Shift): < 0.1
All below-the-fold components are lazy loaded using:
React.lazy()for code splittingSuspenseboundaries for loading states- Intersection Observer for viewport-based loading
Implementation:
// Components are lazy loaded
const AudienceSection = lazy(() => import('@domains/audience'));
// With Suspense boundaries
<Suspense fallback={<SectionShimmer />}>
<AudienceSection />
</Suspense>Replaced loading spinners with shimmer loaders for better UX:
- PageShimmer: Full page loading state
- SectionShimmer: Section-level loading state
- ShimmerLoader: Generic shimmer component
Benefits:
- Better perceived performance
- Reduced layout shift
- Smoother loading experience
Vite is configured for optimal code splitting:
- Vendor chunks separated by library
- React, Router, Query, Animation, State, Utils in separate chunks
- Automatic chunk optimization
Chunk Strategy:
react-vendor: React & React DOMrouter-vendor: TanStack Routerquery-vendor: TanStack Queryanimation-vendor: Framer Motionstate-vendor: Zustandutils-vendor: Underscore.js
Custom hook useIntersectionObserver for viewport-based loading:
- Loads components when they're about to enter viewport
- Configurable root margin (default: 200px)
- Trigger once for performance
Configured for optimal hydration:
- 5-minute stale time
- Structural sharing enabled
- No refetch on window focus
- Automatic retry (1 attempt)
Vite Configuration:
- ESBuild minification (faster than Terser)
- CSS minification
- Target: ESNext for modern browsers
- Optimized chunk naming for better caching
HTML Optimizations:
- Preconnect to external domains
- DNS prefetch for external resources
- Preload critical CSS
- Inline critical CSS for faster LCP
Above the Fold (Immediate Load):
- HeroSection (critical for LCP)
Below the Fold (Lazy Load):
- AudienceSection
- ServicesSection
- ProcessSection
- AboutSection
- CTASection
- Footer
Use browser DevTools to monitor:
- Network tab: Check chunk loading
- Performance tab: Analyze rendering
- Lighthouse: Measure Core Web Vitals
- Keep Hero Section Light: Hero section loads immediately, keep it minimal
- Lazy Load Everything Below Fold: Use
LazySectioncomponent - Use Shimmer Loaders: Better UX than spinners
- Monitor Bundle Size: Keep chunks under 200KB
- Optimize Images: Use WebP format, lazy load images
- Minimize JavaScript: Tree shaking removes unused code
# Build for production
npm run build
# Preview production build
npm run preview
# Run Lighthouse audit
# Use Chrome DevTools > Lighthouse tab- LCP: < 2.5s (Hero section loads immediately)
- TTI: < 3.8s (Code splitting reduces initial bundle)
- FID: < 100ms (Minimal JavaScript on initial load)
- CLS: < 0.1 (Shimmer loaders prevent layout shift)
- FCP: < 1.8s (Optimized HTML and CSS)
- Image optimization with next-gen formats
- Service Worker for offline support
- HTTP/2 Server Push for critical resources
- Resource hints (prefetch, preload)
- Critical CSS extraction