Supabase Edge Functions are written in TypeScript, run via Deno, and deployed with the Supabase CLI. Please download the latest version of the Supabase CLI, or upgrade it if you have it already installed.
- Editor: Visual Studio Code + Deno extension
-
Docker
is required to run Supabase in local -
Following the guide to install
-
Stop all docker previous running containers before starting new supabase:
./bin/docker_clean.sh
-
Create 2 env files:
.env.local
and.env
representing forlocal
andprod
in root folder, add these variables into:SP_URL=xxxx API_URL=xxxx DB_URL=xxxxx ANON_KEY=xxxxx SERVICE_ROLE_KEY=xxxxx GOOGLE_CLIENT_ID=xxxxx GOOGLE_CLIENT_SECRET=xxxxx FACEBOOK_CLIENT_ID=xxxxx FACEBOOK_CLIENT_SECRET=xxxxx PROJECT_ID=xxxx
-
Initialize Supabase CLI:
- Login:
supabase login
- Grant permission for up file:
chmod -R +x bin
- Find <org_id>:
supabase orgs list
- Up the env:
./bin/up.sh <project_name> <org_id> <db_password>
- Login:
-
Start Supabase instance in local:
./bin/start.up
, copy the output:- Replace ANON_KEY and SERVICE_ROLE_KEY values to corresponding fields in .env files
- For DB_URL field in
.env.local
, just replace the value from output to.env.local
-
Deploy the project:
./bin/deploy.sh
-
Remove xxxx_remote_commit.sql in folder migrations after deployed successfully
- Access site: https://app.supabase.com
- Open the preceding project
- Choose on the left menu
- Choose
- Scroll down to find the target provider, click the down arrow to expand
- Switch -> Enter
Client ID
andClient Secret
- Start supabase instance:
./bin/start.sh
- Creat new migration:
supabase migration new <migration-new>
- Add SQL queries: create tables, policies (RLS), triggers, functions -> Following the
migrations/xxxx-initial.sql
file - Deploy the project will automatically sync these SQLs to the cloud
- Create a function:
supabase functions new <function-name>
- Implement the logics inside folder
<function-name>/index.ts
, following profiles_public folder. - Serve a function:
supabase functions serve <function-name>
- Do testing the function by using curl or supabase-js invoke function
- Deploy to cloud:
supabase functions deploy <function-name>
- Update to
app-url-scheme
for mobile scheme redirect url if aiming to integrate this supabase app for the applications
- Deploy a new project following the preceding sections
- Intall Postgres
- Follow these steps to do migration
- Migrate Storage objects
- Known-issues: