advanced

GraphQL API design

Design GraphQL schemas, queries, mutations, subscriptions, resolvers, DataLoader batching, federation, and complexity limits.

GraphQL API interviews focus on schema design, resolver performance, batching, federation, and protecting the server from expensive queries—not replacing REST by default.

Subtopics: schema and operations, resolvers with N+1 and DataLoader, and federation with query complexity limits.

On interviews: sketch a schema for a nested read, explain how you prevent N+1, and describe depth/cost limits at the gateway.

Common pitfalls: resolvers that hit the database per field, missing authorization on nested fields, and public GraphQL without persisted operations or complexity rules.

Checklist:

  • Model types and nullability deliberately.
  • Batch per-request data access with DataLoader.
  • Enforce auth at field or object boundaries.
  • Limit depth, cost, and introspection in production.