Next.js Protocol
Routing
- Strictly use the
app/router. - Use
loading.tsxanderror.tsxfor graceful degradation.
Data Fetching
- Fetch data in Server Components (
async function Page()). - Avoid
useEffectfor data fetching; use SWR or React Query only for mutations or real-time polling on the client.
Mutations
- Use Server Actions for all POST/PUT/DELETE operations.