MCPcopy Index your code
hub / github.com/facebook/relay

github.com/facebook/relay @v21.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v21.0.1 ↗ · + Follow
10,761 symbols 38,052 edges 3,158 files 1,400 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Relay · GitHub license npm version

Relay is a JavaScript framework for building data-driven React applications.

  • Declarative: Never again communicate with your data store using an imperative API. Simply declare your data requirements using GraphQL and let Relay figure out how and when to fetch your data.
  • Colocation: Queries live next to the views that rely on them, so you can easily reason about your app. Relay aggregates queries into efficient network requests to fetch only what you need.
  • Mutations: Relay lets you mutate data on the client and server using GraphQL mutations, and offers automatic data consistency, optimistic updates, and error handling.

See how to use Relay in your own project.

Example

The relay-examples repository contains an implementation of TodoMVC. To try it out:

git clone https://github.com/relayjs/relay-examples.git
cd relay-examples/todo
yarn
yarn build
yarn start

Then, just point your browser at http://localhost:3000.

Contribute

We actively welcome pull requests, learn how to contribute.

Users

We have a community-maintained list of people and projects using Relay in production.

License

Relay is MIT licensed.

Thanks

We'd like to thank the contributors that helped make Relay in open source possible.

The open source project relay-hooks allowed the community to experiment with Relay and React Hooks, and was a source of valuable feedback for us. The idea for the useSubscription hook originated in an issue on that repo. Thank you @morrys for driving this project and for playing such an important role in our open source community.

Thank you for helping make this possible!

Extension points exported contracts — how you extend this code

SchemaDefault (Interface)
Utilities for building up a schema set based on parts of a schema. Each of the utility add-methods should do the *smalle [7 …
compiler/crates/schema-set/src/from_schema.rs
IMap (Interface)
(no doc) [6 implementers]
packages/react-relay/relay-hooks/QueryResource.js
Subscribable (Interface)
(no doc) [12 implementers]
packages/relay-runtime/network/RelayObservable.js
Chalk (Interface)
(no doc) [1 implementers]
flow-typed/npm/chalk_v4.x.x.js
MockEnvironment (Interface)
(no doc)
packages/relay-test-utils/RelayModernMockEnvironment.js
SetEmptyClone (Interface)
Given self, create clone of an empty representation of Self. Basically keep the name and location, but remove any fields [9 …
compiler/crates/schema-set/src/from_schema.rs
IMap (Interface)
(no doc) [6 implementers]
packages/react-relay/relay-hooks/legacy/FragmentResource.js
Subscribable (Interface)
(no doc) [12 implementers]
packages/relay-runtime/network/RelayObservable.d.ts

Core symbols most depended-on inside this repo

toEqual
called by 2979
flow-typed/npm/jest_v29.x.x.js
toBe
called by 2205
flow-typed/npm/jest_v29.x.x.js
toBeCalledTimes
called by 1803
flow-typed/npm/jest_v29.x.x.js
graphql
called by 1495
packages/relay-runtime/query/GraphQLTag.js
create
called by 1379
packages/relay-runtime/store/RelayStoreTypes.d.ts
lookup
called by 1048
packages/relay-runtime/store/RelayStoreTypes.d.ts
push
called by 1041
compiler/crates/relay-compiler/src/artifact_content/content_section.rs
subscribe
called by 864
packages/relay-runtime/store/RelayStoreTypes.d.ts

Shape

Function 5,534
Method 3,777
Class 911
Interface 276
Enum 263

Languages

Rust75%
TypeScript25%

Modules by API surface

compiler/crates/relay-compiler/tests/compile_relay_artifacts_test.rs308 symbols
compiler/crates/schema-flatbuffer/src/graphqlschema_generated.rs196 symbols
compiler/crates/graphql-syntax/src/parser.rs169 symbols
compiler/crates/relay-typegen/tests/generate_flow_test.rs168 symbols
packages/relay-runtime/store/RelayStoreTypes.d.ts129 symbols
compiler/crates/relay-compiler/tests/relay_compiler_integration_test.rs117 symbols
compiler/crates/relay-typegen/tests/generate_typescript_test.rs110 symbols
packages/relay-runtime/store/RelayStoreTypes.js105 symbols
compiler/crates/schema/src/in_memory.rs103 symbols
compiler/crates/schema-set/src/find_subset_violations.rs96 symbols
compiler/crates/graphql-ir/tests/parse_test.rs94 symbols
compiler/crates/schema-set/src/schema_set.rs91 symbols

For agents

$ claude mcp add relay \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact