12 releases (stable)

2.1.2 May 14, 2025
2.1.0 Mar 10, 2025
2.0.0 Feb 24, 2025
1.1.1 Jan 22, 2025
0.0.1 Nov 13, 2024

#244 in HTTP server

Download history 20/week @ 2025-01-29 21/week @ 2025-02-05 52/week @ 2025-02-12 128/week @ 2025-02-19 87/week @ 2025-02-26 126/week @ 2025-03-05 30/week @ 2025-03-12 7/week @ 2025-03-19 9/week @ 2025-03-26 40/week @ 2025-04-02 29/week @ 2025-04-09 6/week @ 2025-04-16 45/week @ 2025-04-23 23/week @ 2025-05-07 358/week @ 2025-05-14

426 downloads per month

MIT license

140KB
3K SLoC

Hive plugin for Apollo-Router

Hive is a fully open-source schema registry, analytics, metrics and gateway for GraphQL federation and other GraphQL APIs.


This project includes a Hive integration plugin for Apollo-Router.

At the moment, the following are implemented:

This project is constructed as a Rust project that implements Apollo-Router plugin interface.

This build of this project creates an artifact identical to Apollo-Router releases, with additional features provided by Hive.

Getting Started

Binary/Docker

We provide a custom build of Apollo-Router that acts as a drop-in replacement, and adds Hive integration to Apollo-Router.

Please follow this guide and documentation for integrating Hive with Apollo Router

As a Library

If you are building a custom Apollo-Router with your own native plugins, you can use the Hive plugin as a dependency from Crates.io:

[dependencies]
hive-apollo-router-plugin = "..."

And then in your codebase, make sure to import and register the Hive plugin:

use apollo_router::register_plugin;
// import the registry instance and the plugin registration function
use hive_apollo_router_plugin::registry::HiveRegistry;
// Import the usage plugin
use hive_apollo_router_plugin::usage::UsagePlugin;
// Import persisted documents plugin, if needed
use persisted_documents::PersistedDocumentsPlugin;


// In your main function, make sure to register the plugin before you create or initialize Apollo-Router
fn main() {
    // Register the Hive usage_reporting plugin
    register_plugin!("hive", "usage", UsagePlugin);
    // Register the persisted documents plugin, if needed
    register_plugin!("hive", "persisted_documents", PersistedDocumentsPlugin);

    // Initialize the Hive Registry instance and start the Apollo Router
    match HiveRegistry::new(None).and(apollo_router::main()) {
        Ok(_) => {}
        Err(e) => {
            eprintln!("{}", e);
            std::process::exit(1);
        }
    }
}

Development

  1. Install latest version of Rust
  2. To get started with development, it is recommended to ensure Rust-analyzer extension is enabled on your VSCode instance.
  3. Validate project status by running cargo check
  4. To start the server with the demo config file (./router.yaml), use cargo run -- --config router.yaml. Make sure to set environment variables required for your setup and development process (docs).
  5. You can also just run cargo run -- --config router.yaml --log debug --dev --supergraph some.supergraph.graphql for running it with a test supergraph file.

Dependencies

~93–125MB
~2.5M SLoC