Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.3 KB

README.md

File metadata and controls

28 lines (20 loc) · 1.3 KB

GraphQL

A guide for building great GraphQL servers and clients.

Best Practices

  • Follow the Apollo Schema Naming Conventions document for conventions on naming types, fields, and arguments.
  • Avoid accepting overloaded or multiple arguments for a field, ie donor(id: ID, email: String), create multiple fields instead, ie findDonorByID(id: ID!) and findDonorByEmail(email: String!)
  • Use the GraphQL Dataloader pattern to eager load associations and avoid n + 1 queries. For example, GraphQL Batch.
  • Use a single argument called input when creating mutations, following the Relay spec. Example

Apollo

  • Always include a type's ID field if it has one for caching.
  • Colocate queries and mutations in the components they are used
  • Colocate fragments to split up query logic between components.

Learning

Production Ready GraphQL