Production usage

You have created a GraphCDN app for your GraphQL API and enabled caching for your queries. Fantastic!

Now, how do you start using GraphCDN to cache your queries for your users in production?

Step 1 (optional): Configure cache rules

You will likely need to configure some cache rules. With cache rules, you can apply different cache settings (e.g. maxAge or scope) when queries contain certain types or fields.

See the cache configuration documentation for more information!

Step 2 (optional): Push schema changes from CI

To make sure your GraphCDN service always knows your up-to-date GraphQL schema you should push it to us whenever it changes. While you and your team could handle that manually, it's better to do it automatically from CI if possible.

See the CLI documentation for more information!

Step 3: Update your GraphQL client's configuration

The last step to enabling GraphCDN in production!

Rather than sending requests to your origin directly, your GraphQL client should ping your app's <name>.graphcdn.app URL in production. For example, with Apollo Client this looks something like this:

const client = new ApolloClient({
  uri:
    process.env.NODE_ENV === 'production'
      ? 'https://<name>.graphcdn.app'
      : 'http://localhost:3000/graphql',
})

Once you deploy that change to your users your API will be up and running on GraphCDN! 🎉