# relay-runtime

> A core runtime for building GraphQL-driven applications.

Latest version **21.0.1** (published 2026-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install relay-runtime
pnpm add relay-runtime
yarn add relay-runtime
bun add relay-runtime
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; high maintenance score; popular repo.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 21.0.1 |
| Published | 2026-05-27 |
| First published | 2017-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 2.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 18962 |
| Maintainers | fb, yuzhi, relay-bot |
| Keywords | graphql, relay |

## Links

- npm: https://www.npmjs.com/package/relay-runtime
- Repository: https://github.com/facebook/relay
- Homepage: https://relay.dev
- Issues: https://github.com/facebook/relay/issues
- npm.io page: https://npm.io/package/relay-runtime

## Dependencies (3)

- [fbjs](https://npm.io/package/fbjs.md) ^3.0.2
- [invariant](https://npm.io/package/invariant.md) ^2.2.4
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.25.0

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 21.0.1 (latest) — 2026-05-27
- 0.0.0-main-f9a7c645 (main) — 2026-09-15
- 13.0.0-rc.2 (dev) — 2021-12-29
- 0.0.0-main-a4e82e93 — 2026-09-15
- 0.0.0-main-2dcfb056 — 2026-09-15
- 0.0.0-main-94e1e147 — 2026-09-15
- 0.0.0-main-0e8b24f7 — 2026-09-15
- 0.0.0-main-6b79359a — 2026-09-14
- 0.0.0-main-32b87557 — 2026-09-14
- 0.0.0-main-eeea4d56 — 2026-09-14
- 0.0.0-main-f491cfcc — 2026-09-14
- 0.0.0-main-8f3ea97e — 2026-09-14
- 0.0.0-main-820ed71e — 2026-09-13
- 0.0.0-main-64751f3e — 2026-09-13
- 0.0.0-main-a78d107c — 2026-09-13
- … 4255 more at https://npm.io/package/relay-runtime/versions

## README

## Relay Runtime

A set of Relay APIs responsible for data fetching, reading and normalization of
the GraphQL data.

Example:

```js
// @flow strict-local

import type {FetchFunction} from 'relay-runtime';

const {
  Environment,
  Network,
  Observable,
  RecordSource,
  Store,
  fetchQuery,
  graphql,
} = require('relay-runtime');

const fetchFn: FetchFunction = function (request, variables) {
  return new Observable.create(source => {
    fetch('/my-graphql-api', {
      method: 'POST',
      body: JSON.stringify({
        text: request.text,
        variables,
      }),
    })
      .then(response => response.json())
      .then(data => source.next(data));
  });
};

const network = Network.create(fetchFn);
const store = new Store(new RecordSource());
const environment = new Environment({
  network,
  store,
});

fetchQuery(
  environment,
  graphql`
    query AppQuery($id: ID!) {
      user(id: $id) {
        name
      }
    }
  `,
  {id: 'my-node-id'},
).subscribe({
  error: error => {
    console.error(error);
  },
  next: data => {
    console.log(data);
  },
});
```

For complete API reference, visit https://relay.dev/.

---
_Source: https://npm.io/package/relay-runtime · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
