Skip to main content

Overview

Nhost SDK is the primary way of interacting with your Nhost app. It exposes a standard interface for each of the following services:

Installation

Install the dependency:

npm install @nhost/nhost-js graphql

Then import and initialize a single nhost instance in your code:

import { NhostClient } from '@nhost/nhost-js';

const nhost = new NhostClient({
backendUrl: '<nhost-backend-url>',
});

GraphQL support

While the Nhost SDK comes with a lightweight GraphQL client, you can connect to your Nhost backend with any GraphQL client of your choice. For complex applications, Apollo Client, React Query or URQL might be good options.


Security

The SDK manages refresh tokens automatically to respect the permission rules of your Nhost apps. Requests will be anonymous by default, and when you use the SDK to log a user in, the permissions for that user will be used for GraphQL, storage and cloud function calls.


TypeScript support

The SDK has TypeScript typings included. You don’t have to import types separately.