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.
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.
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
Click "Add a resource/API"
Search for Supabase
and select the resource type
Enter the API key and the URL from Supabase and click "Save"
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
}
You can find more examples and premade scripts at Supabase integrations on Windmill Hub
You can self-host Windmill using a
docker compose up
, our go with the cloud app.