Skip to main content

How to Integrate Supabase with Windmill

ยท 2 min read
Adam Kovacs

Learn how to connect to your Supabase project from Windmill Scripts, Flows and Apps.

This tutorial assumes that you already have a Windmill account and a Supabase project. If you don't, visit the Windmill documentation or the Supabase documentation to find out more.

Integrattion between Supabase and Windmill

Get the API keysโ€‹

In order to make authenticated requests to the database, you'll need your API key and the URL of your endpoint from Supabase. To get these, select your project, navigate to the Project Settings page and select API from the menu. You'll find the URL and 2 keys here.

API settings

As the description says, the access level of the public key will be controlled by the policies you add and the secret key will bypass all of them. You can safely use the secret key in Windmill because it'll never be sent to users directly.

Create a resourceโ€‹

To safely use secret values throughout Windmill, you can save them in reources. We are regularly updating the list of approved resources but if you want an integration to be supported by Windmill directly, please submit a new resource type on Windmill Hub.

Navigate to the Resources page Resources page

Click "Add a resource/API" Resource selector

Search for Supabase and select the resource type Resource selector

Enter the API key and the URL from Supabase and click "Save" Resource selector

Use the resourceโ€‹

You can reference the type of a Supabase resource in a script the following way:

// To get the latest supported resource types,
// check for the latest version of the Windmill Deno
// package at https://deno.land/x/windmill/mod.ts
import { Resource } from "https://deno.land/x/[email protected]/mod.ts";

export async function main(auth: Resource<"supabase">) {
// Function contents
}
tip

You can find more examples and premade scripts at Supabase integrations on Windmill Hub

Windmill Logo
Windmill is an open-source and self-hostable serverless runtime and platform combining the power of code with the velocity of low-code. We turn your scripts into internal apps and composable steps of flows that automate repetitive workflows.

You can self-host Windmill using a docker compose up, our go with the cloud app.