Docs/Gateway: NestJS integration (#6545)

Co-authored-by: Denis Badurina <badurinadenis@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Arda TANRIKULU 2025-03-05 18:14:37 +03:00 committed by GitHub
parent adc5437050
commit cbc79a47ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.
<Callout>
For the setup of a new Nest project, please make sure to read the [Nest GraphQL
documentation](https://docs.nestjs.com/graphql/quick-start).
</Callout>
## 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<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 {}
```
<Callout>
Learn more about subscriptions in Hive Gateway [here](/docs/gateway/subscriptions).
</Callout>
## 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).