GraphQL Clients Compared

  • Apollo: The Apollo client does more than simply run your queries against your GraphQL server. It analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run, fetching more results from the server. This means that your UI can be internally consistent and fully up-to-date with the state on the server with the minimum number of queries required.
  • Relay is a performant, opinionated, React-specific GraphQL client built by Facebook for their mobile applications. It focuses on enabling the co-location of queries and components, and is opinionated about the design of your GraphQL schema, especially in the case of pagination. Apollo has an analogous set of features to Relay, but is designed to be a general-purpose tool that can be used with any schema or any frontend architecture. Relay’s coupling to a specific kind of schema and architecture enables some benefits but with the loss of some flexibility, which also lets the Apollo community iterate more rapidly and quickly test experimental features.
  • Lokka is a simple GraphQL Javascript client with a basic query cache. Apollo is more complex, but includes a much more sophisticated cache and set of advanced features around updating and refetching data.

Apollo and Relay share many features, but they’re clearly not identical. So, here’s a breakdown of how they’re different. In order to keep this brief, I’ve included links to what I believe are good resources for more information.

CODA

Ultimately, it comes down to you and the specifics of your project. Apollo offers a friendly developer experience and works great for learning and adopting GraphQL into an existing project, especially if it doesn’t use React. Relay is being built with mobile performance and scalability–at the Facebook level–in mind.

AS GRAPHQL CONTINUES TO MATURE, BOTH TECHNOLOGIES HAVE GREAT COMMUNITIES DEDICATED TO CREATING A BETTER INTERNET, SO YOU CAN’T REALLY GO WRONG WITH EITHER ONE.

My team decided to go with Relay. Why? The Relay team at Facebook is hard at work on some major improvements, and the future of Relay looks pretty bright. Also, because Relay and GraphQL are both developed at Facebook, we expect any updates for GraphQL will be supported faster by Relay 2 than Apollo.

 

ref: https://www.codazen.com/choosing-graphql-client-apollo-vs-relay/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s