What are Supabase Edge Functions?
Last checked 31 Aug 2026
Short answer
Edge Functions are small serverless backend functions that run outside the browser — used for anything requiring a secret key, a third-party call, or logic that shouldn't be trusted to the client.
What they are
Edge Functions are serverless functions that form part of Lovable Cloud's built-in backend (the same underlying technology when you connect your own Supabase project). They run server-side, close to users, rather than in the visitor's browser.
Why your app needs them
Anything that must stay off the client — calling a paid API with a secret key, sending an email, processing a payment, running logic a user shouldn't be able to tamper with — belongs in an edge function. The front-end calls the function; the function does the sensitive work and returns a result.
What Lovable does for you
Ask Lovable to add a feature that needs this kind of logic, and it generates the edge function, wires up the secret it needs, and connects your front-end to call it. You can view invocation logs, success rates and errors for each function from the Cloud tab.
Add an edge function that calls the OpenWeather API with our stored API key and returns today's forecast for a given city
Typical uses
- Calling third-party APIs that require a private key (Stripe, Resend, custom REST APIs).
- Processing webhooks from external services.
- Running validation or business logic that must not be bypassable from the browser.
- Sending transactional email.
What usually goes wrong
- Trying to call a paid third-party API directly from the front-end, exposing the key — this is exactly what edge functions exist to prevent.
- Expecting an edge function to run instantly on every keystroke; they're for discrete actions, not continuous client-side state.
- Not checking the function's logs when something fails silently — the Cloud tab's function logs are usually the fastest way to see the real error.
See also /questions/when-should-i-use-an-edge-function and /questions/how-do-i-safely-store-api-keys.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I back up my Lovable database?Lovable Cloud stores backups you can restore from directly in the Database screen; for extra safety, also ask Lovable to export your data periodically.
- AnswerHow do I connect Supabase to Lovable?In your Lovable project, open the Supabase integration and authorise Lovable to connect to an existing Supabase project (or create a new one), then Lovable can read and write to it the same way it does with Lovable Cloud.
- AnswerHow do I safely store API keys?Store keys as secrets in your backend (Lovable Cloud/Supabase) and call the third-party API from a server/edge function — never put keys in front-end code.
- AnswerHow do I view my database data?Open the Cloud tab (or ask Lovable) to browse tables, edit rows and run SQL directly inside your project — no separate Supabase login needed.