Watch: Run server code safely with a Supabase Edge Function | Vovy

Watch Vovy do it on a Mac: "Move my OpenAI call into a Supabase Edge Function so the key isn't in the browser". Create and deploy a Supabase Edge Function, store your secret keys with supabase secrets, and call it from your app.

"Move my OpenAI call into a Supabase Edge Function so the key isn't in the browser"

Create and deploy a Supabase Edge Function, store your secret keys with supabase secrets, and call it from your app.

What happens in the video

  1. Find code that needs a server: Vovy scans your app for secret keys used in browser code, like an OpenAI or Stripe secret key, and lists what should move.
  2. Create the function: An Edge Function is a small piece of code Supabase runs on its servers. Vovy runs supabase functions new and writes the logic there.
  3. Store your secrets: Vovy runs supabase secrets set for each key, so they live encrypted in Supabase and never in your code or GitHub.
  4. Deploy the function: Vovy asks, then runs supabase functions deploy and watches the output until Supabase confirms it's live.
  5. Call it from your app: Vovy swaps your old code for supabase.functions.invoke, tests it, and opens the function's Logs tab to show the request worked.
Read the step-by-step guide