Facebook's Relay JavaScript framework gets GraphQL


Facebook has reconstructed its for building data-driven applications for easier use.

Renamed , the updated framework features a GraphQL framework incorporating best practices from classic Relay, Facebook’s native mobile GraphQL clients, and the GraphQL community, Facebook software engineers Lee Byron and Joe Savona said this week.

“Relay Modern retains the best parts of Relay—co-located data and view definitions, declarative data fetching—while also simplifying the API, adding features, improving performance, and reducing the size of the framework,” the engineers said. “To accomplish this, we embraced two concepts: static queries and ahead-of-time optimization.”

Developers can use new Relay Modern APIs in the context of existing Relay applications thanks to a compatibility API, and Relay has combined Facebook’s React UI library with the GraphQL query language for data-fetching to enable scaling.

, the Facebook engineers said. Previously, Relay was composed of one library, but with Relay Modern, it features three, with a compiler, runtime, and React/Relay integration layer. This modularity could allow Relay’s use with other view libraries at some point or as a standalone library. Relay’s compiler is designed to add more capabilities based on GraphQL’s type system or to be used for tools beyond app development.