diff --git a/packages/web/docs/src/content/gateway/deployment/node-frameworks/nestjs.mdx b/packages/web/docs/src/content/gateway/deployment/node-frameworks/nestjs.mdx new file mode 100644 index 000000000..c8409702d --- /dev/null +++ b/packages/web/docs/src/content/gateway/deployment/node-frameworks/nestjs.mdx @@ -0,0 +1,60 @@ +--- +description: + Hive Gateway Driver for Nest (Nest JS) is a Node.js framework for building server-side + applications. +--- + +import { Callout } from '@theguild/components' + +# Integration with NestJS + +[Nest (Nest JS)](https://nestjs.com) 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](https://the-guild.dev/graphql/hive/federation) gateways. + + + For the setup of a new Nest project, please make sure to read the [Nest GraphQL + documentation](https://docs.nestjs.com/graphql/quick-start). + + +## Install + +```sh npm2yarn +npm i @nestjs/graphql @graphql-hive/nestjs graphql +``` + +## Create Application Module + +```typescript +import { HiveGatewayDriver, HiveGatewayDriverConfig } from '@graphql-hive/nestjs' +import { Module } from '@nestjs/common' +import { GraphQLModule } from '@nestjs/graphql' + +@Module({ + imports: [ + GraphQLModule.forRoot({ + 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](/docs/gateway/subscriptions). + + +## Further development + +Hive Gateway offers just a gateway driver; meaning, everything else works as +[showcased in Nest federation documentation](https://docs.nestjs.com/graphql/federation).