Relay Runtime is the core runtime library for building GraphQL-driven applications with the Relay framework, developed by Facebook. Current stable version is 21.0.1, released bi-weekly alongside the Relay compiler. It provides client-side GraphQL execution, data fetching, caching with normalized stores, and reactivity. Key differentiators: strong type safety via generated TypeScript types, declarative data fetching with fragments, and optimized batching. Supports React and other JS frameworks. Ships TypeScript definitions natively.
npm install relay-runtimeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a Relay environment with a network layer and store.
Review data fetching patterns if migrating from <8.0 to avoid stale data.
Change `import Relay from 'relay-runtime'` to `import { Environment, ... } from 'relay-runtime'`.Use hooks from 'react-relay' or 'relay-hooks' instead.
Import only from the package root: `import { ... } from 'relay-runtime'`.Ensure relay-compiler is run before consuming types.
Run `npm install relay-runtime` and ensure tsconfig.json includes `node_modules/@types` or the package ships types (v11+).
Use named import: `import { Environment } from 'relay-runtime'`.Add `type: 'module'` in package.json or configure webpack to handle .mjs files.
Run `relay-compiler` to generate the query artifacts, then import the generated file.