Skip to main content

Nextjs GraphQL

GraphQL best practices.

Use with The Graph to read data from blockchains.

Context

  • Data Fetching — REST and server-side alternatives to GraphQL
  • Services — Service layer where GraphQL resolvers live
  • Components — Frontend consumers of GraphQL queries

Questions

When does GraphQL earn its complexity over REST?

  • What query patterns justify a graph layer versus direct database access?
  • How do you prevent N+1 queries from killing resolver performance?
  • When does The Graph's indexing model beat a custom GraphQL server for onchain data?