Supergraph / Proxy Source
Hive Gateway can retrieve a supergraph from a wide range of sources.
This includes:
- Hive Schema Schema Registry
- Apollo GraphOS / Studio
- Custom Sources
In addition you can also proxy any GraphQL API, by either introspection or providing a schema file.
Supergraph
Hive Gateway has built in support for fetching supergraphs from the Hive Schema Registry. You can either choose to provide the configuration via CLI parameters, environment variables or a configuration file.
hive-gateway supergraph <endpoint> --hive-cdn-key <api_key>
Polling
You can configure the polling interval for the supergraph source.
import { defineConfig } from '@graphql-hive/gateway'
export const gatewayConfig = defineConfig({
supergraph: {
/* Supergraph Configuration */
},
// By default it polls the schema registry every 10 seconds
pollingInterval: 10_000
})
If you use a source like Hive CDN or a custom URL as a source for the supergraph schema,
CLI will automatically poll the source for changes and update the schema accordingly with 10 seconds interval.
If you want to change this behavior by setting the --polling=10s
flag or pollingInterval
in the configuration file.
Learn more about the configuration file Learn more about the CLI flags
Proxy
Instead of serving a supergraph, you can also use Hive Gateway to proxy any existing GraphQL API. This allows you to add features such as usage reporting or persisted documents without modifying your existing GraphQL API.
hive-gateway proxy https://example.com/graphql