This is an example showing a minimal app using Relay with the @defer and @stream directives.
pnpm install
pnpm run start
- Client
- Server
- [graphql-js] - GraphQL Schema
- Dev Setup
- TypeScript - Typed JavaScript
- Parcel - Bundler for client code
- ts-node - Run TypeScript files directly
- Prettier - Auto-format code
- concurrently - Run multiple watch commands concurrently
See fetchGraphQL.ts for an example translation layer that converts the latest incremental delivery GraphQL response format to the Facebook internal format that Relay understands.
This requires a small modification to relay-runtime to ignore errors thrown from missing fields in deferred responses. If a field is included in both a deferred and non-deffered fragment, Relay expects the server to return this field twice. The latest spec algorithm ensures the same field is not executed multiple times.