Skip to main content
πŸ‘€ Interested in the latest enterprise backend features of refine? πŸ‘‰ Join now and get early access!
Version: 4.xx.xx

Nhost

refine Nhost GraphQL Data Provider comes out-of-the-box. Thanks to refine, you can connect to your Nhost database and create special queries and use your data easily. This example shows in detail how you can use the data in your Nhost database with refine project.

ID Data Type​

By default, the data provider assume that your ID type is uuid, you can change this behavior by using the idType option. You can pass Int or uuid as the value of idType option or use function to determine the idType based on the resource name.

Passing 'Int' or 'uuid' to idType​

This will allow you to determine the idType for all resources.

const myDataProvider = dataProvider(client, {
idType: "Int",
});

Passing function to idType​

This will allow you to determine the idType based on the resource name.

const idTypeMap: Record<string, "Int" | "uuid"> = {
users: "Int",
posts: "uuid",
};

const myDataProvider = dataProvider(client, {
idType: (resource) => idTypeMap[resource] ?? "uuid",
});
Demo Credentials

Username: info@refine.dev Password: demodemo

Run on your local
npm create refine-app@latest -- --example data-provider-nhost