This plugin will set up a Gatsby project for use with Apollo Client, in the most minimal way imaginable.

Note: This plugin accepts only a few of the options accepted by the ApolloClient constructor. If you need to use a more advanced Apollo Client configuration, try gatsby-theme-apollo instead.


To use this plugin, you’ll also need to install your own copy of @apollo/client. This is what you’ll use to make GraphQL queries in your React components.

$ npm install gatsby-plugin-apollo @apollo/client


Add the plugin to your Gatsby config, and supply the location of your desired GraphQL API to the uri option. There are more options available for slighty advanced configurations.

// gatsby-config.js
module.exports = {
  plugins: [
      resolve: 'gatsby-plugin-apollo',
      options: {
        uri: ''


Option Type Description
uri string A string representing your GraphQL server endpoint. Defaults to /graphql.
credentials string Is set to same-origin by default. This option can be used to indicate whether the user agent should send cookies with requests.
headers Object Header key/value pairs to pass along with the request.