Skip to main content

GraphQL

GraphQL is an API query language that lets clients request exactly the data they need.

What Is GraphQL

GraphQL APIs expose a schema of types, queries, mutations, and subscriptions.

Clients send a query that describes the shape of the response.

How To Use GraphQL

Define a schema on the server, create resolvers for data, and call the API with GraphQL queries from clients.

Basic Example

query GetUser {
user(id: "1") {
id
name
email
}
}

Common Concepts

  • Schemas define available data.
  • Queries read data.
  • Mutations change data.
  • Resolvers connect fields to real data sources.

What To Learn Next

Learn schema design, resolvers, fragments, pagination, caching, authorization, and error handling.