Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @airbnb/lunar-apollo with all npm packages installed. Try it out:

require("@airbnb/lunar/package.json"); // @airbnb/lunar is a peer dependency. require("graphql/package.json"); // graphql is a peer dependency. require("graphql-tag/package.json"); // graphql-tag is a peer dependency. require("react/package.json"); // react is a peer dependency. require("react-apollo/package.json"); // react-apollo is a peer dependency. var lunarApollo = require("@airbnb/lunar-apollo")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@airbnb/lunar-apollo v3.0.2

Apollo and GraphQL utilities.

Lunar Apollo

Provides out of the box support for GraphQL, powered by Apollo.

yarn add @airbnb/lunar-apollo

This package relies on GraphQL related packages to also be installed.

yarn add graphql graphql-tag


Initialize the package to create an Apollo client. The following option settings may be passed to customize this package.

  • links (ApolloLink[]) - Collection of Apollo links (middleware) to apply to the client.
import Apollo, { HttpLink } from '@airbnb/lunar-apollo';

const httpLink = new HttpLink({
  uri: '/api/graphql',
  credentials: 'same-origin',

  links: [httpLink],

The client can be accessed with Apollo.getClient().


Once the Apollo client has been created, we can make it available to our queries and mutations by wrapping our application in a provider.

import { Provider } from '@airbnb/lunar-apollo';

function Root() {
  return (
      <App />


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free