Netlify Graph

Netlify Labs feature

This feature is available through Netlify Labs, which helps us collect early feedback on newer features. You may notice some changes to this feature’s functionality as we develop it further. We recommend trying it out in test sites or non-production environments only. Learn more in our Netlify Labs doc.

# Overview

Netlify Graph enables you to seamlessly integrate third-party APIs and services into web applications without writing API-specific code. Instead of connecting different APIs and SDKs with brittle code, you can abstract integrations behind a convenient GraphQL interface.

Essentially, Netlify handles the messy integration work so you can focus on solving other problems. Netlify Graph is available for all sites in your Netlify team.

Netlify Graph automatically deploys your site and generates a token

When you first visit the Graph page for your site, Netlify automatically generates a Netlify Graph token. This action triggers a site deploy and creates an entry in the Team audit log.

# Example repository and tutorial

If you’d like to try Netlify Graph in a test project, check out the gravity sample repository. It has a full tutorial that walks you through getting the gravity site running on Netlify to creating and using GraphQL queries.

# Netlify Graph concepts

Netlify Graph uses some terminology that you may not be familiar with. Here's a list of definitions to help you understand the different pieces of Netlify Graph.

  • Graph Explorer: the part of the Netlify UI where you can connect to and authenticate APIs, then create GraphQL operations to use with those APIs.
  • Cloud sandbox: an isolated environment where you can test GraphQL operations without directly affecting your project.
  • Operation: a GraphQL operation, such as a query, mutation, subscription, or fragment.
  • Session: what the Netlify CLI uses to connect your cloud sandbox to your local project.
  • Handlers: auto-generated Netlify functions that wrap your GraphQL operations.

# GraphQL concepts

You use standard GraphQL queries, mutations, subscriptions, and fragments to interact with your Netlify Graph data.

# Get started with Netlify Graph

There are a lot of pieces to Netlify Graph, but you can build your knowledge by following these steps:

  1. Create a Graph Explorer cloud sandbox
  2. Connect an API or service
  3. Create queries
  4. Work locally
  5. Use an operation handler in your project

# Access secrets with Netlify Graph

You can access secrets for all of the APIs and services that you connect to Netlify Graph. Check out the Authentication docs for details.

# Netlify Graph and Next.js

If you are building a Next.js application, you can automatically generate Netlify Graph bindings by running the Netlify Graph commands inside your application folder.

Run commands in the root folder

Make sure to run the Netlify Graph commands in the root folder where your Next.js application is located. In the current CLI release, running in the root of the repository and not the application will result in an error.

# Disable Netlify Graph

Not interested in Netlify Graph? You can opt out by selecting your avatar in the top-right, then selecting Netlify Labs. Under Experimental features, find Netlify Graph and select Disable.

# Add your service to Netlify Graph

You can become a Netlify Graph partner by adding your service to the Netlify Graph catalog. To do so, you need to meet the partner requirements.

# Feedback

If you have thoughts to share and want to get in touch, fill out our survey.