Cloud

Supabase

What is Supabase?

Supabase is an open-source backend-as-a-service (BaaS) platform. It gives you a ready-to-use backend for building applications without having to manually set up and maintain servers or databases. You can think of it as an open-source alternative to Firebase, but built on top of PostgreSQL.


Installations

macOS

$ brew install supabase/tap/supabase
$ brew upgrade supabase

Windows

$ scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
$ scoop install supabase

Configuration

For detailed configuration reference documentation, visit here

project_id = "pesy*************"

[realtime]
enabled = false

[inbucket]
enabled = false

[storage]
enabled = true
file_size_limit = "50MiB"

[storage.buckets.images]
public = false
file_size_limit = "50MiB"
allowed_mime_types = ["image/png", "image/jpeg", "image/jpg", "image/webp"]

[auth]
enabled = true
enable_anonymous_sign_ins = true
jwt_secret = "more_than_32_characters_here"

[functions.chat]
enabled = true
verify_jwt = true

Supabase CLI

$ supabase login
$ supabase link --project-ref <project_id_from_supabase_cloud>
$ supabase projects list

$ supabase secrets set XXXXXXX=10000 # setup .env
#or setup by bulk
$ supabase secrets set --env-file .env

$ supabase secrets list
$ supabase db push
$ supabase functions deploy

Database Migration

# Create a new migration file
$ supabase migration new your_change_description

# Edit the new migration file with your changes
# Then deploy it
$ supabase db push

# Reset the linked cloud database (DELETES ALL DATA!)
$ supabase db reset --linked

Edge Function

$ supabase functions new your_function_name
$ supabase functions deploy your_function_name --project-ref your_supabase_project_id
Previous
Fusion 360 Assembly