v1
Serve
Schema Registry
Hive

Integration with GraphQL Hive

GraphQL Hive is a schema registry, monitoring and analytics tool for your GraphQL API, and it is possible to integrate your GraphQL Mesh application to GraphQL Hive.

GraphQL Mesh Serve can fetch the supergraph from Hive’s High-Availablity CDN, and serve it with a few lines of configuration.

By using the built-in Hive plugin, it allows you to monitor and analyze the operation performance.

Learn more about GraphQL Hive

Fetching Supergraph from Hive CDN

GraphQL Mesh can fetch the supergraph directly from GraphQL Hive CDN by a few lines of configuration without any additional setup for Federation projects.

Learn more about how to setup an Federation project on Hive

Once you get the credentials for Hive CDN, you can setup your GraphQL Mesh configuration to fetch the supergraph from Hive CDN.

Configuration

mesh.config.ts
import { defineConfig as defineServeConfig } from '@graphql-mesh/serve-cli'
 
export default defineServeConfig({
  hive: {
    // The endpoint of CDN
    endpoint: 'CDN_ENDPOINT',
    // The API key provided by GraphQL Hive
    key: 'API_KEY'
  }
})
💡

Instead of providing endpoint and key, you can provide these two using environment variables HIVE_CDN_ENDPOINT and HIVE_CDN_KEY without any configuration file needed.

HIVE_CDN_ENDPOINT=CDN_ENDPOINT HIVE_CDN_KEY=API_KEY npx mesh-serve

Publishing subgraphs to Hive CDN

If you generate a subgraph using Mesh Compose, you can publish the subgraph to Hive CDN. Before publishing the subgraph, you need to output your subgraph as a GraphQL SDL file like schema.graphql. Basically you can export a subgraph by using the following command of Mesh Compose;

npx mesh-compose --subgraph SUBGRAPH_NAME > SUBGRAPH_NAME.graphql

Then you can publish the subgraph to Hive CDN by using the following command;

npx hive schema:publish \
  --registry.accessToken YOUR_TOKEN_HERE \
  --service="SUBGRAPH_NAME" \
  --url="http://my-subgraph.com" \
  --author "Me" \
  --commit "First" \
  SUBGRAPH_NAME.graphql

Learn more about how to export a subgraph using Mesh Compose

Learn more about how to publish a subgraph to Hive

Usage Reporting and Monitoring

Hive allow you to collect usage data from your GraphQL operations and use the data collected for Monitoring, Observability, Schema Usage and Coverage and Schema Evolution.

Learn more about Usage Reporting and Monitoring in Hive

In order to get started, you need to make sure you have a registry token from Hive.

Learn more about how to get a registry token

Then you can setup your GraphQL Mesh configuration to send the usage data to Hive.

Configuration

mesh.config.ts
import { defineConfig as defineServeConfig } from '@graphql-mesh/serve-cli'
 
export default defineServeConfig({
  hive: {
    // The registry token provided by GraphQL Hive
    token: 'MY-REGISTRY-TOKEN'
  }
})
💡

Instead of providing token, you can provide it using environment variable HIVE_REGISTRY_TOKEN without any configuration file needed.

HIVE_REGISTRY_TOKEN=MY-REGISTRY-TOKEN npx mesh-serve

You can refer to the official documentation of Hive Client to learn more about the all options

Persisted Operations

TODO: Add documentation for Persisted Operations with Hive