Relay

What Relay is
Relay is a free GraphQL client for React that gathers components’ data requirements into optimized queries that can be prepared in advance. Components declare the data they need, and Relay consolidates those needs, including duplicate fields. Its normalized data store keeps components observing the same data in sync. For interface work, it supports loading states, pagination, refetching, optimistic updates, and rollbacks when mutations fail. Queries can defer some data and progressively render as more arrives. Relay generates TypeScript types for GraphQL snippets and provides editor support for schema autocompletion and go-to-definition. Developers can configure its network layer for HTTP, WebSockets, authentication, caching, telemetry, or form-data uploads. Relay requires GraphQL, a Babel plugin, and the Relay Compiler; production guidance recommends running the compiler in CI and keeping generated artifacts in source control. Documentation covers setup with React, Vite, TypeScript, and Babel, as well as React Native. The homepage says it works out of the box with Create React App and Next.js. Relay recommends persisted queries to restrict clients to queries fixed at build time.
Who it suits
It suits React developers building GraphQL applications who want generated types, a shared normalized data store, and built-in interface patterns. Teams need to be prepared to use GraphQL, Babel, and the Relay Compiler.
What it does well
- Combines component data needs into optimized queries
- Normalized store keeps observed data in sync
- Supports optimistic updates and rollbacks
- Generates TypeScript types and editor support
What to know first
- Requires GraphQL
- Requires a Babel plugin and Relay Compiler
- Production guidance calls for CI compilation and tracked artifacts
Limits
Relay requires GraphQL plus Babel and the Relay Compiler. Its server-side conventions include GraphQL Connections when available and globally unique object IDs for caching and refetching.
Getting started
- Open the Relay website and prepare a React project
- Add GraphQL, Babel, and the Relay Compiler
- Configure Relay with React, Vite, TypeScript, or supported tooling
- Set up the network layer for HTTP, WebSockets, and authentication
- Define component GraphQL data requirements
- Run the Relay Compiler and keep generated artifacts in source control
Verdict
Relay offers query generation, data consistency, and interface features for React applications using GraphQL. Its setup requires GraphQL, Babel, and the Relay Compiler; persisted queries are recommended for restricting client queries.
Questions
Is Relay free?
Yes. Relay is listed with a free pricing model and a free plan.
Which platforms does Relay support?
The listing names Android, iOS, and web. Documentation also covers React Native.
What languages can Relay servers use?
Listed server languages are JavaScript, TypeScript, and Flow.
Does Relay generate client code?
Yes. It generates Flow or TypeScript types for GraphQL snippets, and client code generation is listed.
Which integrations are documented?
The quick start documents React, Vite, TypeScript, Babel, and the Relay Compiler.
How can Relay network requests be customized?
The network layer can use HTTP or WebSockets, application authentication, caching, telemetry, and form-data uploads.
Facts from Relay's own pages
- Built-in UI patterns
- Relay supports loading states, pagination, refetching, optimistic updates, and rollbacks. · relay.dev, 2 Oct 2026
- Company and project
- The site identifies Meta Platforms, Inc. in its copyright notice and says Relay was built in tandem with GraphQL and is used at Facebook scale. · relay.dev, 2 Oct 2026
- Data consistency
- Relay maintains a normalized data store so components observing the same data stay in sync. · relay.dev, 3 Oct 2026
- Declarative data
- Components declare the data they need, and Relay generates queries to fetch it. · relay.dev, 3 Oct 2026
- Editor support
- Relay editor support provides GraphQL schema autocomplete and go-to-definition. · relay.dev, 3 Oct 2026
- Generated types
- Relay generates TypeScript types for GraphQL snippets, and the homepage also describes generated Flow or TypeScript types. · relay.dev, 3 Oct 2026
- Integrations
- The quick start documents setup with React, Vite, TypeScript, Babel, and the Relay Compiler. · relay.dev, 3 Oct 2026
- More features
- Relay includes loading states, pagination, refetching, optimistic updates, rollbacks, and streamed or deferred data. · relay.dev, 3 Oct 2026
- Mutations
- Relay supports optimistic updates, error handling, and automatically reverting optimistic changes when mutations fail. · relay.dev, 3 Oct 2026
- Network customization
- The network layer can be customized for behaviors such as network-level caching, telemetry, or form-data uploads for mutations. · relay.dev, 2 Oct 2026
- Network transports
- Developers can configure HTTP, WebSockets, and application-appropriate authentication through Relay's network layer. · relay.dev, 2 Oct 2026
- Optimizations
- Relay aggregates and optimizes component data requirements, including deduplicating identical fields for efficient GraphQL requests. · relay.dev, 3 Oct 2026
- Product
- Relay is a GraphQL client for React that coordinates component data needs into efficient, pre-loadable queries. · relay.dev, 3 Oct 2026
- Production setup
- The production guide recommends running the Relay Compiler in CI and keeping generated artifacts in source control. · relay.dev, 2 Oct 2026
- React Native
- The official documentation says Relay also works with React Native. · relay.dev, 3 Oct 2026
- Requirements
- Relay requires GraphQL; its homepage says users need a Babel plugin and must run the Relay Compiler. · relay.dev, 3 Oct 2026
- Scale
- The homepage says Relay is used in Facebook infrastructure across tens of thousands of components and has full-time staff working to improve it. · relay.dev, 3 Oct 2026
- Security guidance
- Relay recommends persisted queries, also called trusted documents, to restrict clients to queries locked in at build time. · relay.dev, 2 Oct 2026
- Server conventions
- Relay provides first-class support for GraphQL Connections when the server supports them and relies on globally unique object IDs for caching and refetching. · relay.dev, 3 Oct 2026
- Shared state
- Relay maintains a normalized data store that keeps components observing the same data in sync. · relay.dev, 2 Oct 2026
- Streaming
- Relay can defer parts of a query and progressively re-render the UI as data streams in. · relay.dev, 2 Oct 2026
- Supported usage
- The homepage says Relay works out of the box with Create React App and Next.js, and identifies Flow or TypeScript users as a likely fit. · relay.dev, 3 Oct 2026
- Type safety
- Relay generates TypeScript types for GraphQL snippets to catch errors statically. · relay.dev, 2 Oct 2026
Where Relay stands on Freedom251
- GraphQL Tools#21 of 32