Apollo Client vs Relay
Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.
Open source · MIT
A JavaScript and TypeScript library for loading and caching GraphQL data in web apps.
Open source · MIT
JavaScript framework for building data-driven React apps using GraphQL.
The short answer
Choose Apollo Client if you need…
- Developers building React apps that query a GraphQL API
- Teams using TypeScript who want typed GraphQL operations
- Apps that need a client-side cache for GraphQL responses
Choose Relay if you need…
- React developers who already use GraphQL
- Teams with large React apps that need consistent data across many components
- Developers who want fetching handled by the framework rather than hand-written imperative code
- Apps that need optimistic updates when users change data
Side-by-side
| Apollo Client | Relay | |
|---|---|---|
| Type | Library | Framework |
| Price | Free and open source | Free and open source |
| Licence | MIT | MIT |
| GitHub stars | 19.8k | 19k |
| Setup difficulty | Intermediate | Intermediate |
| How you get it | Install with a package manager | Clone and build from source |
| Main language | TypeScript | Rust |
| Last code update | 5 days ago | 4 days ago |
What each one is
Apollo Client
Apollo Client is a library that lets a front-end app fetch data from a GraphQL server and keep the results in a local cache. It works with React, Vue, Angular, and plain JavaScript, according to the README. The README says it offers caching, APIs for queries, and developer tools.
Relay
Relay is a JavaScript framework for building React apps that load data. You declare what data each component needs using GraphQL, and Relay works out how and when to fetch it. Queries sit next to the views that use them, and Relay combines them into network requests for only the data needed.
Best for
Apollo Client
- Developers building React apps that query a GraphQL API
- Teams using TypeScript who want typed GraphQL operations
- Apps that need a client-side cache for GraphQL responses
Relay
- React developers who already use GraphQL
- Teams with large React apps that need consistent data across many components
- Developers who want fetching handled by the framework rather than hand-written imperative code
- Apps that need optimistic updates when users change data
Strengths
Apollo Client
- Caching is included out of the box, per the README
- Works across several front-end frameworks
- Has TypeScript support and an active maintainer team listed in the README
Relay
- Components declare their data needs, which keeps data logic next to the views that use it
- Relay batches queries into efficient network requests, according to the README
- Mutations support automatic data consistency, optimistic updates and error handling
Not ideal for
Apollo Client
- Projects that do not use GraphQL, since the library is built around GraphQL queries
- Developers who only need a simple HTTP request library, since this adds a larger set of concepts
- Non-developers, because it is code you add to an app
Relay
- Projects that do not use React, since Relay is built for React applications
- Teams without a GraphQL API, because Relay's queries are written in GraphQL
- Beginners new to both React and GraphQL, who would face two learning curves at once
Trade-offs
Apollo Client
- Requires understanding GraphQL and the library's caching model
- The README is truncated, so the full feature list and edge cases are not covered here
Relay
- Relay depends on GraphQL and React, so it cannot be used on its own with other stacks
- The README is short and points to external docs for most setup and usage detail
- The metadata lists the primary language as Rust, which does not match a JavaScript framework; this entry follows the README
Getting started
Apollo Client
Install the client and GraphQL package
npm install @apollo/client graphqlRelay
Clone the example repository
git clone https://github.com/relayjs/relay-examples.gitEnter the TodoMVC example folder
cd relay-examples/todoFrequently asked questions
What is the difference between Apollo Client and Relay?
Apollo Client: A JavaScript and TypeScript library for loading and caching GraphQL data in web apps. Relay: JavaScript framework for building data-driven React apps using GraphQL. Apollo Client suits developers building react apps that query a graphql api, while Relay suits react developers who already use graphql.
Are Apollo Client and Relay free?
Apollo Client: Free and open source. Relay: Free and open source.
Is Apollo Client or Relay more popular?
Apollo Client has more GitHub stars (19.8k) than Relay (19k). Popularity isn't the same as fit — check which one matches your use case above.
What are other alternatives to Apollo Client and Relay?
Other options people compare them with include Apollo Server.
Keep comparing
Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.