Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply Next.js best practices for RSC boundaries, async APIs, routing, metadata, and optimization.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
runtime-selection.md
1# Runtime Selection23## Use Node.js Runtime by Default45Use the default Node.js runtime for new routes and pages. Only use Edge runtime if the project already uses it or there's a specific requirement.67```tsx8// Good: Default - no runtime config needed (uses Node.js)9export default function Page() { ... }1011// Caution: Only if already used in project or specifically required12export const runtime = 'edge'13```1415## When to Use Each1617### Node.js Runtime (Default)1819- Full Node.js API support20- File system access (`fs`)21- Full `crypto` support22- Database connections23- Most npm packages work2425### Edge Runtime2627- Only for specific edge-location latency requirements28- Limited API (no `fs`, limited `crypto`)29- Smaller cold start30- Geographic distribution needs3132## Detection3334**Before adding `runtime = 'edge'`**, check:351. Does the project already use Edge runtime?362. Is there a specific latency requirement?373. Are all dependencies Edge-compatible?3839If unsure, use Node.js runtime.40