ae39e45460
NOVAS SKILLS: - next-best-practices v0.1.0 (CLEAN) — Next.js App Router, RSC, caching, data - nextjs-patterns v1.0.0 (CLEAN) — Next.js 15: Server Actions, route handlers - vite v1.0.0 (CLEAN) — env vars, aliases, proxy, CJS compat - uncle-bob v1.0.0 (CLEAN) — Clean Code, SOLID, Clean Architecture - clean-code-review v1.0.0 (CLEAN) — naming, guard clauses, anti-patterns, refactoring - vue v1.0.0 (CLEAN) — Vue framework - vue-composition-api-best-practices v1.0.0 (CLEAN) — composables, Pinia, reactivity BIBLIOTECA INTELIGENTE libs/ (10 dominios, 11 arquivos): - typescript/ — TS safe + generics gotchas - react/ — Next.js App Router + Vite config - vue/ — Composition API + Pinia - linux/ — System diagnostic cheatsheet - database/ — PostgreSQL + MySQL patterns - browser/ — Chromium CLI + E2E testing - security/ — SAST audit (OWASP Top 10) - best-practices/ — Clean Code + SOLID + Clean Architecture - deploy/ — Docker multi-stack + OpenClaw ops - + INDEX.md como guia de navegacao .learnings/ — LRN-20260519-003 criado (biblioteca compartilhada)
40 lines
985 B
Markdown
40 lines
985 B
Markdown
# Runtime Selection
|
|
|
|
## Use Node.js Runtime by Default
|
|
|
|
Use 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.
|
|
|
|
```tsx
|
|
// Good: Default - no runtime config needed (uses Node.js)
|
|
export default function Page() { ... }
|
|
|
|
// Caution: Only if already used in project or specifically required
|
|
export const runtime = 'edge'
|
|
```
|
|
|
|
## When to Use Each
|
|
|
|
### Node.js Runtime (Default)
|
|
|
|
- Full Node.js API support
|
|
- File system access (`fs`)
|
|
- Full `crypto` support
|
|
- Database connections
|
|
- Most npm packages work
|
|
|
|
### Edge Runtime
|
|
|
|
- Only for specific edge-location latency requirements
|
|
- Limited API (no `fs`, limited `crypto`)
|
|
- Smaller cold start
|
|
- Geographic distribution needs
|
|
|
|
## Detection
|
|
|
|
**Before adding `runtime = 'edge'`**, check:
|
|
1. Does the project already use Edge runtime?
|
|
2. Is there a specific latency requirement?
|
|
3. Are all dependencies Edge-compatible?
|
|
|
|
If unsure, use Node.js runtime.
|