Documentation
Integrations and Guides
Apollo Router

Apollo Router

Apollo Router (opens in a new tab) is the Rust implementation of the Apollo Federation runtime.

Hive ships a custom build of Apollo Gateway, because that's how native extensions works (opens in a new tab).

Installation and Supergraph from CDN

Once you have all services schemas pushed to Hive, and available in the CDN, you can create a CDN Access Token and gain access to the CDN endpoint.

Download Apollo Router for Linux (x86_64), MacOS (x86_64) or Windows (x86_64):

curl -fsSL https://graphql-hive.com/apollo-router-download.sh | bash

Start the router:

HIVE_CDN_ENDPOINT="..." HIVE_CDN_KEY="..." ./router

Configuration

  • HIVE_CDN_ENDPOINT - the endpoint Hive generated for you in the previous step
  • HIVE_CDN_KEY - the access key
  • HIVE_CDN_POLL_INTERVAL - polling interval (default is 10 seconds)
  • HIVE_CDN_ACCEPT_INVALID_CERTS - accepts invalid SSL certificates (default is false)
  • HIVE_REGISTRY_LOG - defines the log level for the registry (default is INFO)
💡

The HIVE_CDN_ENDPOINT variable should not include any artifact suffix (for example, /supergraph), it should be in the following format: https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID

Usage Reporting

You can send usage reporting to Hive registry by passing HIVE_TOKEN environment variable and enabling hive.usage plugin in the config file (router.yaml).

Start the router:

HIVE_TOKEN="..." HIVE_CDN_ENDPOINT="..." HIVE_CDN_KEY="..." ./router --config router.yaml
router.yaml
supergraph:
  listen: 0.0.0.0:4000
plugins:
  hive.usage:
    {}
    #  Sample rate to determine sampling.
    #  0.0 = 0% chance of being sent
    #  1.0 = 100% chance of being sent.
    #  Default: 1.0
    # sample_rate: "0.5",
    #
    #  A list of operations (by name) to be ignored by Hive.
    # exclude: ["IntrospectionQuery", "MeQuery"],
    #
    #  Uses graphql-client-name by default
    # client_name_header: "x-client-name",
    #  Uses graphql-client-version by default
    # client_version_header: "x-client-version",
    #
    #  A maximum number of operations to hold in a buffer before sending to GraphQL Hive
    #  Default: 1000
    # buffer_size: 1000
    #
    #  Accepts invalid SSL certificates
    #  Default: false
    # accept_invalid_certs: true

Additional Resources