GraphQL 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)¶
-
GQL-7(9) Check authorization in the business logic layer that resolvers call, for every object and field a request reaches, including lookups by ID such asnode(id:)and connection edges. (specific/graphql)
Recommended (6–8)¶
-
GQL-1(8) Evolve the schema without versions: add fields and types, mark what you plan to remove with@deprecated(reason: …)naming the replacement, and remove it only after usage tracking shows that clients have migrated, or the announced deadline has passed. (specific/graphql) Automatable: GraphQL ESLint, GraphQL Inspectordiff. -
GQL-2(8) Change data only in mutations: keep query fields free of side effects, and don't execute a mutation sent withGET. (specific/graphql) -
GQL-8(8) Limit what one request can cost: reject operations above a maximum depth, number of aliases and root fields, and number of operations in a batch, and stop execution after a timeout. For public APIs, also consider query cost analysis and rate limits based on cost. (specific/graphql) -
GQL-3(7) Design the schema around the business domain and the way clients use the data, not around the database tables behind it. (specific/graphql) -
GQL-4(7) Paginate every list field that can grow, with cursor-based connections that follow the Relay connection specification, and cap the page size. (specific/graphql) Automatable: GraphQL ESLint. -
GQL-9(7) If only your own clients call the API, execute only trusted documents in production: operations registered at build time and sent by ID. (specific/graphql) -
GQL-10(7) Mask unexpected errors in production, and turn off stack traces and debug output. (specific/graphql) -
GQL-13(7) Load data in resolvers through DataLoader or an equivalent, which batches and caches the loads within each request. (specific/graphql) -
GQL-5(6) Choose nullability field by field: keep a field nullable if it can fail or be denied on its own, make it non-null only where clients need the guarantee, and return lists as[Item!]!. (specific/graphql) -
GQL-6(6) Return expected business errors, such as failed validation or a broken business rule, as typed results in the mutation's payload type, and keep the top-levelerrorsarray for unexpected failures. (specific/graphql) -
GQL-11(6) Refuse requests that a browser can send cross-site without a CORS preflight, such as form-encoded or multipart bodies andGETrequests without a custom header, to prevent cross-site request forgery. (specific/graphql)
Conditional (1–5)¶
-
GQL-12(5) Turn off introspection and GraphiQL in production for APIs that only your own clients use, and don't count on it as protection. (specific/graphql) -
GQL-14(5) Start with one GraphQL service, and adopt federation only when several teams need to own and deploy parts of the graph independently. (specific/graphql)