Performance & SEO Review, Practice & Interview Prep
Summary & Key Takeaways
Section titled “Summary & Key Takeaways”Summary
Section titled “Summary”This guide covered the two most critical aspects of production Next.js applications:
Performance Optimization is about delivering fast, smooth user experiences by reducing what users download, loading only what’s needed, and rendering efficiently. Next.js provides powerful built-in tools — the <Image /> component, next/font, dynamic imports, Suspense streaming, and multi-layer caching — that make optimization accessible.
SEO in Next.js leverages server-side rendering to ensure search engines can always read your content. The Metadata API, generateMetadata(), structured data (JSON-LD), sitemaps, and robots.txt together create a comprehensive SEO foundation that would require complex manual configuration in a traditional React SPA.
Key Takeaways
Section titled “Key Takeaways”| Area | Key Insight |
|---|---|
| Core Web Vitals | LCP ≤2.5s, INP ≤200ms, CLS ≤0.1 are Google ranking factors |
| Images | Always use <Image /> with priority on LCP images, sizes attribute always |
| Code splitting | Next.js auto-splits per route; use dynamic() for component-level splitting |
| Server Components | Default to server; only use 'use client' when needed |
| Caching | 4 layers: Request Memoization, Data Cache, Full Route Cache, Router Cache |
| Streaming | loading.tsx + Suspense enables progressive page rendering |
| Metadata | Static metadata for layout/known pages, generateMetadata() for dynamic data |
| SEO vs CSR | Next.js SSR ensures crawlers see real HTML, not empty JS shells |
| JSON-LD | Add schema.org markup for rich snippets in search results |
| Sitemap | app/sitemap.ts auto-generates /sitemap.xml from your routes |
Practice Exercises
Section titled “Practice Exercises”-
Bundle Analysis: Add
@next/bundle-analyzerto a project, runANALYZE=true npm run build, and identify the 3 largest dependencies. Try to reduce each by at least 50%. -
Image Audit: Audit a Next.js project’s images — add
priorityto hero images, correctsizesvalues to all images, convert any<img>tags to<Image />. -
Dynamic Import: Take a component that uses a heavy third-party library (chart, editor, date picker) and convert it to a dynamic import with a loading skeleton.
-
Metadata Setup: Build a complete metadata setup for a blog —
layout.tsxwith default metadata,generateMetadata()for posts, OG image generation. -
Structured Data: Add Product JSON-LD to a product page and validate it using Google’s Rich Results Test tool.
-
Sitemap + robots.txt: Implement
app/sitemap.tsthat fetches blog posts from an API and combines them with static routes. Addapp/robots.tsto block the/adminroute. -
Performance Optimization: Take a slow dashboard page and: (a) convert data components to Server Components, (b) wrap sections in Suspense, (c) add
loading.tsx, (d) parallelize API calls.
Mini Project Ideas
Section titled “Mini Project Ideas”1. SEO-Optimized Blog
Section titled “1. SEO-Optimized Blog”Build a blog with:
- Dynamic
generateMetadata()for each post - Auto-generated OG images using
ImageResponse - Article JSON-LD structured data
sitemap.tswith all blog postsrobots.tswith proper directivesnext/fontfor typography<Image />for all media- Lighthouse score target: 95+
2. Product E-commerce Website
Section titled “2. Product E-commerce Website”Build a product catalog with:
- Product page Product JSON-LD (enables star ratings in search)
- Category page BreadcrumbList JSON-LD
- Dynamic metadata per product (name, price, brand in title)
- Canonical URLs for filtered/sorted views
- Image optimization for product gallery
- Dynamic import for reviews section
- Suspense streaming for related products
- Bundle analysis and optimization
3. Landing Page with Full SEO
Section titled “3. Landing Page with Full SEO”Build a SaaS landing page with:
- Organization JSON-LD for knowledge panel
- FAQPage JSON-LD for FAQ section
- Optimized metadata for social sharing
- Lighthouse performance score 90+
- Font optimization with
next/font - Core Web Vitals under the “good” threshold
- Search Console integration guidance
Interview Preparation
Section titled “Interview Preparation”Beginner Questions
Section titled “Beginner Questions”- What is the difference between LCP, INP, and CLS?
- What does the
<Image />component in Next.js do that a regular<img>tag doesn’t? - What is code splitting and how does Next.js implement it?
- What is the purpose of the
priorityprop on<Image />? - What is
useMemoand when should you use it? - What is SEO and why does Next.js have better SEO than a regular React app?
- What is the
metadataexport in App Router used for? - What is an OG (Open Graph) tag? Give an example.
Intermediate Questions
Section titled “Intermediate Questions”- Explain all four caching layers in Next.js App Router.
- What is tree shaking and how does Next.js support it?
- How do
useMemoanduseCallbackdiffer? When would you use each? - What is the difference between
dynamic()withssr: falsevsssr: true? - How does streaming with Suspense work in Next.js?
- What is
generateMetadata()and how does it differ from static metadata? - What is JSON-LD and what types of rich snippets can it enable?
- How do you generate a dynamic sitemap in Next.js App Router?
- What is a canonical URL and when do you need one?
- How would you implement parallel data fetching in a Server Component?
Advanced Questions
Section titled “Advanced Questions”- How does Next.js streaming differ from traditional SSR and when would you choose each?
- Explain request memoization vs data cache in Next.js. How do you control each?
- How would you optimize a Next.js e-commerce site to achieve Lighthouse score > 90?
- What are the performance trade-offs of moving a component from Server to Client?
- How would you implement tag-based cache invalidation in Next.js?
- Explain the rendering performance implications of putting
'use client'at a high level in the component tree. - How would you implement international SEO (hreflang) in Next.js?
- Describe a complete strategy to diagnose and fix a poor CLS (Cumulative Layout Shift) score.
- How does
React.cache()differ from Next.js’s data cache? - What is the impact of
generateStaticParamson SEO and when would you use ISR instead?
Next in the series: Part 4B — Testing in Next.js, Error Handling, and Deployment Strategies
Next.js Deep Dive Documentation — Part 4A | Performance Optimization & SEO
TypeScript · App Router · Production-Ready Examples