GraphQL

March 17, 2019

What is GraphQL

GraphQL is a Language for querying databases from client-side applications. On the backend, GraphQL specifies to the API on how to present the data to the client. GraphQL redefines developers’ work with APIs offering more flexibility and speed to market; it improves client-server interactions by enabling the former to make precise data requests and obtain no more and no less, but exactly what they need.

 

GraphQL was created by Facebook in 2012, and now open sourced. GraphQL was used internally for their mobile applications to reduce network usage by means of its specific data-fetching capabilities. Since GraphQL specifications and reference implementation in JavaScript were open-sourced in 2015, major programming languages now support it, including Python, Java, C#, Node.js, and more. The GraphQL ecosystem is expanding with libraries and powerful tools like Apollo, GraphiQL, and GraphQL Explorer.

 

Like most of the client-server application, GraphQL has both client and server:

 

Apollo Server is one of the most popular choices for using GraphQL in JavaScript applications. Building its ecosystem on top of GraphQL, Apollo provides a large ecosystem of libraries for both client- and server-side that solve many GraphQL challenges. Apollo Server can be queried from any GraphQL client.

 

GraphQL Ruby enables a Ruby implementation of GraphQL.

 

GraphQL Yoga. Developed by Prisma, this fully-featured GraphQL server has a number of configurations that improve the developer experience. GraphQL Yoga was built on Express and Apollo servers, well-established node servers, and GraphQL middleware libraries.

 

GraphQL clients are Libraries that construct queries and send them to the server.

 

Apollo Client caches requests and normalizes data saving valuable network traffiс. Beyond that, Apollo Client comes with many more features like error management, support for pagination and optimistic UI, prefetching of data, and connection of the data layer to the view layer.

 

Relay. An alternative to Apollo Client, Relay is Facebook’s JavaScript library for consuming GraphQL to build data-driven React applications.