How it works
Because Lovable apps run in the browser, API calls to ScrapeGraphAI must be made from a backend function to avoid exposing your API key and to prevent CORS errors. Lovable supports Supabase Edge Functions for this purpose.Setup
1. Get your API key
Log in to the ScrapeGraphAI dashboard and copy your API key from the Settings page.2. Create a Supabase Edge Function
In your Lovable project, open the Supabase integration and create a new Edge Function namedscrape:
3. Store your API key as a secret
In Supabase, addSGAI_API_KEY as an environment secret with your API key value.
4. Call the function from your app
Example prompt
Tell Lovable:Add a button that fetches the latest headlines from news.ycombinator.com using ScrapeGraphAI and displays them in a list.Lovable will generate the UI component. Wire it up to your Edge Function using the snippet above.
Never hardcode your API key in frontend code. Always use a backend function or environment variable.