GraphQL Hive Integration
GraphQL Hive is a schema registry, monitoring and analytics tool for your GraphQL API.
GraphQL Mesh Serve can be configured to fetch the supergraph from Hive’s High-Availablity CDN and report usage data to Hive’s registry.
Serve Supergraph from GraphQL Hive
For Federation projects on GraphQL Hive, you can fetch the supergraph directly from GraphQL 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.
Before getting started, make sure you have obtained the credentials for the Hive CDN.
Configuration
For running Mesh Serve with the Hive CDN, you need to provide the HIVE_CDN_ENDPOINT
and
HIVE_CDN_KEY
environment variables.
HIVE_CDN_ENDPOINT="CDN_ENDPOINT" HIVE_CDN_KEY="API_KEY" npx mesh-serve
Instead of providing the environment variables HIVE_CDN_ENDPOINT
and HIVE_CDN_KEY
, you can also
provide them using a configuration file.
import { defineConfig } from '@graphql-mesh/serve-cli'
export default defineConfig({
hive: {
// The endpoint of CDN
endpoint: 'CDN_ENDPOINT',
// The API key provided by GraphQL Hive
key: 'API_KEY'
}
})
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.
Before getting started, make sure you have obtained a registry token from Hive.
Configuration
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
Instead of using environment variables, you can also use a configuration file, which allows further customization for the configuration.
import { defineConfig } from '@graphql-mesh/serve-cli'
export default defineConfig({
hive: {
// The registry token provided by GraphQL Hive
token: 'MY-REGISTRY-TOKEN'
}
})
Refer to to the Hive Client documentation for further customization, such as usage reporting sampling and more.