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.
- 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