Skip to content

Rendering Runtime and Proxy

Pack: nextjs Parent skill: Next.js Rendering Runtime and Middleware Source: nextjs/nextjs-rendering-runtime-and-middleware/references/rendering-runtime-and-proxy.md

  • Server Component:
    • default choice
    • use for data access, secrets, and heavy server-only work
  • Client Component:
    • only when browser APIs, local interaction state, or client hooks are required
  • Node.js runtime:
    • safest default
    • widest package compatibility
  • Edge runtime:
    • use when low-latency request handling matters and dependencies are compatible
  • Use it for request interception, redirects, rewrites, header mutation, auth gates, or coarse traffic shaping.
  • Keep matcher coverage explicit.
  • Do not move full endpoint logic into proxy when a Route Handler is the cleaner surface.
  • Legacy middleware.ts guidance should be translated to proxy.ts unless the task is specifically about older code or migration history.