This documentation is for a legacy version of Remix Supabase. For the latest version, please visit the Remix Supabase Turbo documentation

The Makerkit SDK

The Makerkit SDK is a simple API for your Makerkit projects. It allows you to easily interact with the Makerkit core entities

The Makerkit SDK is a simple API for your Makerkit projects. It allows you to easily interact with the Makerkit core entities, such as: Users, Organizations, Subscriptions and Memberships.

As you build your application, you will need to interact with the core entities. The SDK provides a simple way to do that.

Usage

Initializing the SDK is simple. You will need to provide any of the Supabase Server clients - depending on where you are using the SDK (route, server component or server action).

Loaders/Actions

In the example below, we initialize the SDK in a Server Action

import { ActionFunctionArgs } from '@remix-run/node'; import getSdk from '~/lib/sdk'; import getSupabaseServerClient from '~/core/supabase/server-client'; export async function action(args: ActionFunctionArgs) { const client = getSupabaseServerClient(args.request); const sdk = getSdk(client); // ... }

Client Side

You may also initialize the SDK on the client side - but bear in mind some API are not going to work in non-server environments. This is useful if you need to interact with the core entities on the client side.

import useSupabase from '~/core/supabase/use-supabase'; export function useSdk() { const client = useSupabase(); return getSdk(client); }

Subscribe to our Newsletter
Get the latest updates about React, Remix, Next.js, Firebase, Supabase and Tailwind CSS