Skip to content

Lovable Edge Functions: How to Deploy Them on Your Own Supabase Project

Last updated: By The Migrator Team

To deploy Lovable edge functions on your own Supabase project you do not need to rewrite anything: the functions are standard Supabase Edge Functions written for Deno, and they live in the supabase/functions folder of your repository.

What does not move is the configuration around them: secrets, and sometimes per-function settings. This guide lists the exact commands and a checklist so none of them gets forgotten. The migrator detects your functions and secret names and prints these commands for you.

What are Lovable edge functions?

Lovable edge functions, also called Lovable Cloud edge functions or Supabase edge functions, are small server-side programs written in TypeScript and run on the Deno runtime. Apps use them for work that must not happen in the browser: calling payment or AI APIs with a secret key, sending email, handling webhooks, or running logic with elevated database access.

In your project they are plain folders under supabase/functions, one folder per function, each with an index.ts file. Because they are standard Supabase Edge Functions, you can deploy them to any Supabase project. The official references are the Supabase Edge Functions docs and the secrets documentation, and Lovable's own explanation lives in the Lovable docs.

Step 1: Install the Supabase CLI and log in

  1. 1Install the CLI

    Install it with your package manager or run it through npx. See the CLI docs for your system.

  2. 2Log in and link

    Run the commands below from the root of your project (the folder that contains supabase).

    Terminal: log in and link
    supabase login
    supabase link --project-ref YOUR_PROJECT_REF
    Terminal showing how to deploy Lovable edge functions after linking the Supabase CLI
    Terminal showing how to deploy Lovable edge functions after linking the Supabase CLI

Step 2: Deploy Lovable edge functions one by one

List the folders in supabase/functions. Folders starting with an underscore, such as _shared, are helpers and are not deployed on their own.

Terminal: deploy
supabase functions deploy FUNCTION_NAME
# or deploy all of them
supabase functions deploy

Step 3: Find and set your secrets

Secret values are not exported from Lovable, so you set them again from their original sources: your Stripe dashboard, OpenAI account, email provider and so on. To find the names, search your function code for Deno.env.get(. Supabase provides SUPABASE_URL, SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY automatically, so you only add custom ones.

Terminal: set secrets
supabase secrets set STRIPE_SECRET_KEY=sk_live_xxx RESEND_API_KEY=re_xxx
supabase secrets list

Step 4: Keep the right JWT settings

Functions called by logged-in users verify a JWT by default. Webhooks from outside services, such as Stripe, cannot send one, so they need verify_jwt = false for that function in supabase/config.toml. Keep the same settings your Lovable project used.

supabase/config.toml
[functions.stripe-webhook]
verify_jwt = false

Step 5: Test every function

  • Call each function from the app and from the Supabase dashboard's function logs.
  • Point external webhooks (Stripe, GitHub, email providers) at the new function URL, which uses your new project ref.
  • Check the function logs for undefined secret errors.

Frequently asked questions

What are Lovable edge functions?

They are server-side TypeScript functions that run on Supabase Edge Functions (Deno). Apps use them for secrets, payments, AI calls, email and webhooks.

Where do I set edge function secrets?

With supabase secrets set NAME=value in the CLI, or in the Supabase dashboard under Edge Functions. Functions read them with Deno.env.get. Secret values are never exported from Lovable.

Do I need to change my function code?

Usually not. The code runs on the same Supabase Edge Functions runtime. Only the project ref and secrets change.

Why does my function say a secret is missing?

Secrets are not copied between projects. Set each one with supabase secrets set, then redeploy if needed.

Where do webhook URLs change?

The function URL contains your project ref, so update it in services such as Stripe or GitHub to the new project.

Can I deploy without the CLI?

The CLI is the most reliable route. The dashboard also allows editing functions, but deploying from your repository keeps code and config in sync.