Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.
speakboxPublic archive

About

NestJS module to add support for Hasura GraphQL API

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

NestJS Hasura

Installation

npm install @speakbox/nestjs-hasura

Usage

Import the module and the service in your NestJS application:

import { Module } from '@nestjs/common';
import { HasuraModule, HasuraService } from '@speakbox/nestjs-hasura';

@Module({
  imports: [HasuraModule],
  providers: [HasuraService],
})
export class AppModule {}

Using the service

import { Inject, Injectable } from "@nestjs/common";
import { HasuraService } from '@speakbox/nestjs-hasura';

@Injectable()
export class ExampleService {
  constructor(
    @Inject(HasuraService) private readonly hasura: HasuraService,
  ) {}
  
  exampleRequest() {
    return this.hasura.request(
      gql`query SomeQuery($id: bigint!) {
        some_resource_by_pk(id: $id) {
          id
          name
        }
      }`,
      { id: 1}
    );
  }
}

For more information on how to use the service, please refer to the NestJS Documentation.

Environment variables

This package relies on environment variables to configure Hasura:

# Hasura API endpoint
HASURA_GRAPHQL_ENDPOINT=https://hasura.example.com/v1/graphql

# Hasura API Admin Secret
HASURA_GRAPHQL_ADMIN_SECRET=my-secret

Change Log

See Changelog for more information.

Contributing

Contributions welcome! See Contributing.

Author

Valentin Prugnaud @valentinprgnd

License

Licensed under the MIT License - see the LICENSE file for details.

About

NestJS module to add support for Hasura GraphQL API

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages