rmosolgo / graphql_defer_example

Demo of GraphQL-Ruby + Rails + `@defer` directive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL-Ruby Defer Example

This app demonstrates how to use @defer with Rails, GraphQL-Ruby, Apollo Client and React.

The app is a deck builder for Magic the Gathering:

  • Decks are persisted in the app's local database (::Deck and ::Slot)
  • Cards are fetched from Scryfall's REST API (::Scryfall::Card)

@defer is used to reduce time-to-first-byte: local data is returned immediately, but external calls are deferred.

rails-with-defer

Development

  • Clone the repo
  • bundle install
  • bundle exec db:create db:migrate
  • Install & compile the local apollo-client fork (https://github.com/rmosolgo/apollo-client/):
    • cd app/javascript/apollo-client
    • npm install
  • yarn install
  • bundle exec rails server

About

Demo of GraphQL-Ruby + Rails + `@defer` directive


Languages

Language:Ruby 68.0%Language:JavaScript 21.1%Language:HTML 9.6%Language:CSS 1.2%