Integration with NestJS

Hive Gateway Driver for Nest (Nest JS) is a Node.js framework for building server-side applications.

Nest (Nest JS) is a progressive Node.js framework for building efficient, reliable and scalable server-side applications.

Hive Gateway provides its own Nest GraphQL Driver that supports building GraphQL Federation gateways.

For the setup of a new Nest project, please make sure to read the Nest GraphQL documentation.

Install

npm i @nestjs/graphql @graphql-hive/nestjs graphql

Create Application Module

import {
  HiveGatewayDriver,
  HiveGatewayDriverConfig,
} from "@graphql-hive/nestjs";
import { Module } from "@nestjs/common";
import { GraphQLModule } from "@nestjs/graphql";

@Module({
  imports: [
    GraphQLModule.forRoot<HiveGatewayDriverConfig>({
      driver: HiveGatewayDriver,
      // All configuration for Hive Gateway comes here;
      supergraph: "./supergraph.graphql",
      // Install subscription handlers to the server
      installSubscriptionHandlers: true,
      subscriptions: {
        // Enable WebSocket subscriptions
        "graphql-ws": true,
      },
    }),
  ],
})
export class AppModule {}

Learn more about subscriptions in Hive Gateway here.

Further development

Hive Gateway offers just a gateway driver; meaning, everything else works as showcased in Nest federation documentation.