console/packages/libraries/router
TheGuildBot 13646a34f5
Upcoming Release Changes (#6373)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-22 13:00:03 +01:00
..
src Collect custom scalars from arguments and input object fields (#6383) 2025-01-21 10:28:59 +01:00
.dockerignore Update Apollo Router and fix Docker Image (#972) 2023-01-18 21:00:23 +01:00
Cargo.toml Upcoming Release Changes (#6373) 2025-01-22 13:00:03 +01:00
CHANGELOG.md Upcoming Release Changes (#6373) 2025-01-22 13:00:03 +01:00
package.json Upcoming Release Changes (#6373) 2025-01-22 13:00:03 +01:00
README.md feat(apollo-router-plugin): persisted operations (app deployments) plugin with Hive, update usage to API-Version v2 (#5732) 2024-12-16 15:40:26 +02:00
router.yaml feat(apollo-router-plugin): persisted operations (app deployments) plugin with Hive, update usage to API-Version v2 (#5732) 2024-12-16 15:40:26 +02:00
sync-cargo-file.sh improve Crate publish flow (#5930) 2024-11-14 12:52:05 +02:00

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

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:

// import the registry instance and the plugin registration function
use hive_apollo_router_plugin::registry::HiveRegistry;
use hive_apollo_router_plugin::usage::register;

// 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();

    // 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.