Next.js Developer interview question · Most asked

What happens, step by step, when a request reaches a Next.js App Router application?

Summary

next.config headers, redirects and rewrites apply; the proxy (middleware.ts before Next.js 16) runs for matched paths and may redirect, rewrite or respond; routing serves static assets directly or matches an app route; server components render on the server (fetching data, using caches where configured) to HTML for the first load or an RSC payload for client navigations; route handlers and server actions handle API requests and mutations; in the browser, client components hydrate and links prefetch routes.

Longer Answer

Consequences: a proxy without a matcher runs for every asset and prefetch, so keep it cheap and authorise near the data (server components, route handlers, server actions). Layouts persist across client navigations, so they don't re-run for every page change.

Key Points

  • Config redirects/rewrites → proxy → routing.
  • Server components render on the server.
  • Route handlers and server actions for APIs and mutations.
  • Client components hydrate; links prefetch.

Deep dive: Request Lifecycle course: Next.js: Proxy (Middleware), Rendering and Caching

Explanation

What interviewers look for

The full order and the proxy matcher and authorisation implications.

More most-asked Next.js Developer questions

← All Next.js Developer questions