GraphQL is a query language for APIs, together with a server-side engine, created by Facebook in 2012 and released as open source in 2015. It lets the client request exactly the data it needs, in a single query.
With a classic REST API, you often call several endpoints and receive fields you do not need. With GraphQL, the server exposes a typed schema describing all available data, and the client writes a query specifying the fields it wants. There are three types of operations: queries to read, mutations to write, subscriptions to receive real-time updates.
It is useful when several interfaces (web, mobile, partners) consume the same data with different needs. In return, caching, security (overly heavy queries) and server-side performance require more work than with REST.
The ecosystem includes Apollo, Relay and urql on the client side, and Apollo Server, GraphQL Yoga or Hasura on the server side. The specification is maintained by the GraphQL Foundation.
