Rendering Runtime and Proxy
Pack:
nextjsParent skill: Next.js Rendering Runtime and Middleware Source:nextjs/nextjs-rendering-runtime-and-middleware/references/rendering-runtime-and-proxy.md
Rendering boundary heuristics
Section titled “Rendering boundary heuristics”- 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
Runtime selection
Section titled “Runtime selection”- Node.js runtime:
- safest default
- widest package compatibility
- Edge runtime:
- use when low-latency request handling matters and dependencies are compatible
proxy.ts guidance
Section titled “proxy.ts guidance”- 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.
Migration note
Section titled “Migration note”- Legacy
middleware.tsguidance should be translated toproxy.tsunless the task is specifically about older code or migration history.