Skip to main content

Supabase

Supabase is an open source Firebase alternative. Start your project with a Postgres database, Authentication, instant APIs, Edge Functions, Realtime subscriptions, and Storage.

Credential configuration

To configure this credential you only need the unique project URL (supabaseUrl) and the API key (supabaseUrl). Both can be found navigating to Settings > API in your supabase account.

Here you have an example of a filled credential configuration form in YepCode:

Supabase snippets available in editor

note

The title is the triggering text for YepCode to autocomplete the script

Integration

New integration from credential
const supabase = yepcode.integration.supabase('credential-slug')
New integration from plain authentication data
const { createClient } = require('@supabase/supabase-js')

const supabase = createClient('your-project-url', 'your-api-token')
tip

Find the complete supabase reference here: https://supabase.com/docs/reference/javascript/introduction

Fetch data

Fetch data
const { data, error } = await supabase
.from('countries')
.select('name, country_id')
.eq('name', 'The Shire')

Insert data

Insert data
const { error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Denmark' })

Update data

Update data
const { error } = await supabase
.from('countries')
.update({ name: 'Australia' })
.eq('id', 1)

Upsert data

Upsert data
const { error } = await supabase
.from('countries')
.upsert({ id: 1, name: 'Albania' })
.eq('id', 1)

Delete data

Delete data
const { error } = await supabase
.from('countries')
.delete()
.eq('id', 1)

Call a Postgres function

Call a Postgres function
const { data, error } = await supabase.rpc('hello_world')

List all files in a bucket

List all files in a bucket
const { data, error } = await supabase
.storage
.from('my-files')
.list('public', {
limit: 100,
offset: 0,
sortBy: { column: 'name', order: 'asc' },
})

Upload a file

Upload a file
const textFileContent = 'the-content'

const { data, error } = await supabase
.storage
.from('my-files')
.upload('public/textFile.txt', textFileContent, {
cacheControl: '3600',
upsert: false
})

Download a file

Download a file
const { data, error } = await supabase.storage
.from("my-files")
.download("public/textFile.txt");