Questions
19 of 33
1Explain server-side rendering (SSR) in Next.js.
2List the benefits of Server-Side Rendering in Next.js.
3What are server components?
4How to use server components in next js?
5What is the React Server Component Payload (RSC)?
6Describe how server components are rendered.
7Describe server rendering strategies
8How can you keep Server-only Code out of the Client Environment
9What are the issues of using context provider at the root of the application?
10List dynamic functions available to server components.
11List all Dynamic APIs.
12How do we opt for Static Rendering, Dynamic Rendering and Streaming?
13Explain the difference between SSR, SSG, ISR, and CSR in Next.js. When would you choose each?
14How does getServerSideProps work internally? What is its execution context?
15What are the performance trade-offs of SSR vs SSG in a high-traffic production app?
16How does Next.js handle hydration? What is a hydration mismatch, and how do you debug it?
17What happens when getServerSideProps throws an error? How do you handle it gracefully?
18How would you architect a Next.js app that needs both personalised (SSR) and cacheable (SSG) pages at scale?
19Explain the App Router vs Pages Router SSR model differences. How does React Server Components change the SSR paradigm?
20How do React Server Components (RSC) differ from traditional SSR? Can they be used together?
21How does streaming SSR work in Next.js 13+? What role does Suspense play?
22How would you implement partial hydration or Islands Architecture in Next.js?
23Explain how Next.js handles data fetching waterfall problems in SSR and how you'd mitigate them.
24How would you implement partial hydration or Islands Architecture in Next.js?
25How do you implement caching strategies for SSR responses in Next.js? (CDN, Cache-Control, stale-while-revalidate)
26How would you reduce TTFB (Time to First Byte) in an SSR-heavy Next.js app?
27What's the difference between fetch caching in the App Router vs traditional getServerSideProps?
28How do you avoid redundant database/API calls across multiple server components on the same page?
29How do you securely handle authentication in SSR? What are the risks of passing tokens via cookies vs headers?
30How do you prevent sensitive server-side data from leaking to the client bundle?
31How would you implement role-based rendering on the server without exposing protected routes to the client?
32How do you debug SSR-only issues that don't appear in local development?
33How can we control dynamic rendering behaviour in next js?
19 / 33

Explain the App Router vs Pages Router SSR model differences. How does React Server Components change the SSR paradigm?

App Router replaces Pages Router's page-level SSR (getServerSideProps) with component-level SSR using Server Components, shifting from per-request data fetching to granular, streaming server rendering with selective hydration

The evolution from Pages Router to App Router in Next.js represents a fundamental shift in how Server-Side Rendering (SSR) is approached. Pages Router treats SSR as a page-level concern using getServerSideProps, while App Router integrates SSR at the component level through React Server Components (RSC). This change moves from a 'fetch-on-render' model to a 'render-with-fetch' model, where components can directly access server resources and stream their output progressively to the client, dramatically reducing client-side JavaScript and improving performance.

Core Conceptual Differences
  1. 1

    Pages Router SSR: Page-level, monolithic rendering with getServerSideProps running on every request, fetching all data before rendering begins, and sending complete HTML to client

  2. 2

    App Router SSR: Component-level, granular rendering with Server Components that can fetch data directly and stream progressively, allowing dynamic and static content to coexist in the same route

  3. 3

    Data fetching location: Pages Router requires data fetching in special functions outside components; App Router allows direct data fetching inside components using async/await

  4. 4

    Hydration approach: Pages Router hydrates entire pages; App Router selectively hydrates only Client Components, leaving Server Components as pure server output

Pages Router SSR with getServerSideProps
App Router SSR with Server Components

React Server Components (RSC) fundamentally redefine the SSR model by introducing a new rendering target. Instead of treating all components as potentially interactive, RSC establishes a default of server-only execution. Components run exclusively on the server, generate a special RSC Payload (a compact binary format containing rendered output and client component references), and never ship JavaScript to the client . This eliminates the traditional trade-off where SSR meant shipping the same component code twice—once for server HTML and again for client hydration. With RSC, only components explicitly marked with 'use client' become part of the client bundle, while the rest remain pure server-rendered output .

Key Innovations of React Server Components
  1. 1

    Zero bundle size for server components: Dependencies like date libraries, Markdown parsers, or database drivers used in Server Components never reach the client, dramatically reducing JavaScript payload

  2. 2

    Direct server access: Server Components can directly query databases, read files, or access internal APIs without creating separate API endpoints, eliminating the need for data-fetching layers

  3. 3

    Automatic code splitting: Server Components enable route-based automatic code splitting without manual React.lazy calls, as client components are naturally split at the server/client boundary

  4. 4

    Streaming with Suspense: Server Components work natively with React Suspense, allowing parts of the UI to stream as they become ready, improving perceived performance

When a Server Component renders, it produces an RSC Payload—a compact binary representation of the component tree. This payload contains the rendered HTML of Server Components, props to be passed to Client Components, and placeholder references where Client Components will be mounted. Unlike traditional SSR which sends HTML only, the RSC Payload maintains the component tree structure and enables seamless integration between server and client components. The client receives this payload and uses it to reconstruct the component tree, hydrating only the Client Component boundaries . This is why navigation in App Router feels instant even with Server Components—the RSC Payload can be fetched and rendered without full page reloads.

Streaming SSR in App Router
  1. 1

    Immediate shell delivery: The server sends the static shell (layout and fallback UI) immediately, improving Time to First Byte (TTFB)

  2. 2

    Progressive content streaming: As Server Components resolve their data, their output streams to the client in chunks, visible as they arrive

  3. 3

    Selective hydration: Only Client Components that are actually interactive (or wrapped in Suspense) hydrate, reducing main thread work

  4. 4

    Parallel data resolution: Multiple Suspense boundaries can resolve their data in parallel, each streaming independently when ready

Streaming with Suspense in App Router

The 'use client' directive creates a clear separation between server and client execution. Everything above the boundary (parent components) runs on the server; everything below (the component itself and its children) becomes client-rendered and hydrated. This boundary is where the RSC Payload includes references to JavaScript bundles. Crucially, client components can still render server components as children through composition, but the boundary itself marks where serialization happens—props passed from server to client must be serializable (no functions, dates, or circular references) . This forces developers to think deliberately about what belongs on the client versus server.

Practical Implications for Developers
  1. 1

    Mental model shift: Components are server-first by default; interactivity is opt-in via 'use client'

  2. 2

    Data fetching consolidation: Instead of separate API routes and client-side fetching, Server Components can directly access databases

  3. 3

    Performance optimization: Bundle size naturally optimized as server dependencies are excluded; no need for manual code splitting

  4. 4

    Progressive enhancement: Pages work without JavaScript initially, then enhance with client components

  5. 5

    Testing complexity: Server Components require different testing strategies as they run in Node.js environment, not browser

Next.js is evolving toward Partial Prerendering (PPR), which combines static and dynamic rendering within the same route. With PPR, a static shell is prerendered at build time, while dynamic components stream in at request time. In Next.js 16, PPR concepts are being integrated into a new 'Cache Component' model, further blurring the line between static and dynamic rendering. This represents the logical conclusion of the RSC paradigm: components declare their data dependencies and caching needs, and the framework determines at runtime whether to serve cached static content or generate fresh dynamic content . The future of SSR in Next.js is increasingly declarative rather than imperative.