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.
Strongly recommended (9–10)¶
-
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 theNEXT_PUBLIC_prefix only if its value may be public. (specific/nextjs)
Recommended (6–8)¶
-
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-onlyimport guard. -
NEXTJS-4(8) Pass Client Components, and return from Server Actions, only the fields the UI renders. (specific/nextjs) -
NEXTJS-5(7) Addimport 'server-only'to modules that use secrets or the database. (specific/nextjs) Automatable:server-onlyimport 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 aschildrenor 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>orloading.js. (specific/nextjs) -
NEXTJS-10(6) Return expected errors, such as failed validation, from Server Actions as values, and leterror.jsandglobal-error.jsboundaries catch uncaught exceptions. (specific/nextjs) -
NEXTJS-11(6) Usenext/image,next/fontandnext/scriptinstead of plain<img>tags, font links and script tags. (specific/nextjs) Automatable: eslint-config-next, Lighthouse CI.