tech

Introduction to GraphQL

graphqlapibackend

GraphQL gives clients control over what data they receive.

The Problem with REST

/api/users/123 returns the entire user object. What if you only need the name? Over-fetching.

The GraphQL Way

query {
  user(id: "123") {
    name
    email
  }
}

The server returns exactly those fields. No more, no less.

GraphQL shines when clients have diverse data needs. For simple CRUD, REST is still perfectly fine.