• Stars
    star
    253
  • Rank 160,776 (Top 4 %)
  • Language
    JavaScript
  • License
    Creative Commons ...
  • Created about 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use Relay without a GraphQL server

Relay Local Schema Travis npm

Use Relay without a GraphQL server.

Codecov Discord

Usage

import { Environment } from 'react-relay';
import { Network } from 'relay-local-schema';

import schema from './data/schema';

const environment = new Environment({
  network: Network.create({ schema }),
  /* ... */
});

This will execute queries against the specified schema locally, rather than against a separate GraphQL server.

You can also specify a GraphQL.js rootValue or contextValue:

const environment = new Environment({
  network: Network.create({
    schema,
    rootValue: 'foo',
    contextValue: 'bar',
  }),
  /* ... */
});

For more control over the network layer, you can use createFetch to create just the fetch function.

import { Environment, Network } from 'react-relay';
import { createFetch } from 'relay-local-schema';

import schema from './data/schema';

const environment = new Environment({
  network: Network.create(createFetch({ schema })),
  /* ... */
});

Caveat

This is intended for exploratory work, integration tests, demos, and working with local data. This is not generally intended as a substitute for a remote GraphQL back end in production.

More Repositories

1

react-router-relay

[Deprecated] Relay Classic integration for React Router
JavaScript
559
star
2

relay-hooks

Use Relay as React hooks
TypeScript
541
star
3

react-relay-network-modern

Relay Modern Network Layer with middlewares — cache, auth, retry, batch, logger, SSR
JavaScript
326
star
4

react-relay-network-layer

ReactRelayNetworkLayer with middlewares and query batching for Relay Classic.
JavaScript
276
star
5

found-relay

Relay integration for Found
JavaScript
276
star
6

relay-compiler-language-typescript

⛔️ Obsolete - A language plugin for Relay that adds TypeScript support, including emitting type definitions.
TypeScript
241
star
7

relay-subscriptions

[Deprecated] Subscription support for Relay Classic
JavaScript
176
star
8

react-relay-network-modern-ssr

SSR middleware for react-relay-network-modern
JavaScript
67
star
9

Relay.swift

Relay for GraphQL, ported to Swift and SwiftUI
Swift
65
star
10

relay-compiler-webpack-plugin

Automatically run the Relay Compiler from Webpack
JavaScript
65
star
11

relay-query-lookup-renderer

Same as Relay Modern's QueryRenderer, but will check the store for data before fetching
JavaScript
52
star
12

fetch-multipart-graphql

Cross browser function to fetch and parse streaming multipart graphql responses
JavaScript
51
star
13

vscode-apollo-relay

Simple configuration of vscode-apollo for Relay projects.
TypeScript
49
star
14

react-relay-mutation

Higher-level React mutation API for Relay
TypeScript
40
star
15

relay-commit-mutation-promise

Promise wrapper for Relay Modern's commit mutation
JavaScript
27
star
16

typescript-relayjs-examples

RelayJS typescript examples
TypeScript
24
star
17

relay-connection-handler-plus

Relay connection handler with additional functionality
TypeScript
21
star
18

relay-context-provider

JavaScript
16
star
19

relay-graphql-js

Relay tooling based on graphql-js
TypeScript
15
star
20

tslint-plugin-relay

tslint plugin for relay-compiler-language-typescript tool
TypeScript
6
star