Skip to content

Next.js checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • NEXTJS-1 (9) Treat every Server Action as a public endpoint: authenticate, authorize and validate its input inside the action. (specific/nextjs)
  • NEXTJS-2 (9) Give an environment variable the NEXT_PUBLIC_ prefix only if its value may be public. (specific/nextjs)
  • NEXTJS-3 (8) Put data access in a server-only Data Access Layer that checks authorization and returns minimal data transfer objects (DTOs). (specific/nextjs) Automatable: server-only import guard.
  • NEXTJS-4 (8) Pass Client Components, and return from Server Actions, only the fields the UI renders. (specific/nextjs)
  • NEXTJS-5 (7) Add import 'server-only' to modules that use secrets or the database. (specific/nextjs) Automatable: server-only import guard.
  • NEXTJS-6 (7) Keep "use client" boundaries small: mark the interactive components, not whole layouts or pages, and pass server-rendered content to them as children or props. (specific/nextjs) Automatable: Lighthouse CI.
  • NEXTJS-7 (7) Decide caching per data source, and invalidate the cache in every mutation that changes the data. (specific/nextjs)
  • NEXTJS-8 (6) Read data in Server Components and change it with Server Actions. (specific/nextjs)
  • NEXTJS-9 (6) Avoid request waterfalls: start independent requests in parallel, and stream slow parts behind <Suspense> or loading.js. (specific/nextjs)
  • NEXTJS-10 (6) Return expected errors, such as failed validation, from Server Actions as values, and let error.js and global-error.js boundaries catch uncaught exceptions. (specific/nextjs)
  • NEXTJS-11 (6) Use next/image, next/font and next/script instead of plain <img> tags, font links and script tags. (specific/nextjs) Automatable: eslint-config-next, Lighthouse CI.