Quick Setup
Client-Side Variables
These variables are prefixed withVITE_ and are bundled into your frontend application. They’re exposed to the browser, so never use secret keys here.
Required Variables
Your Supabase project URL. Find this in your Supabase project settings under Project Settings → API.Example:
https://owrqiailcuwlzxeekhms.supabase.coSupabase anonymous/public key (safe to expose in browser). Find this in Project Settings → API as the
anon public key.Example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Recommended Variables
Scrape.do API token — enables live X (Twitter) and Reddit data scraping.
- Get your token: scrape.do
- Used by:
TopicDetail.tsx(client-side) andfetch-twitteredge function - Without this: The app falls back to YouTube, Parallel.ai (if configured), or algorithmic generation
abc123def456scrapetoken789Optional Variables
OpenAI API key for GPT-4o mini AI insights (Tier 1 - highest quality).
- Get your key: OpenAI Platform
- Model used:
gpt-4o-mini - Used by: Client-side AI insights panel for strategic analysis and chat
- Fallback chain: OpenAI → Gemini → Groq → Local
sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxYouTube Data API v3 key for fetching video titles and comments.
- Get your key: Google Cloud Console → APIs & Services → Credentials
- Enable: YouTube Data API v3
- Used by: Client-side YouTube search and
fetch-youtubeedge function
AIzaSyDxxxxxxxxxxxxxxxxxxxxxxxxxxxGoogle Gemini API key for streaming AI summaries and sentiment analysis (Tier 2).
- Get your key: Google AI Studio
- Model used:
gemini-2.0-flash - Fallback: Local keyword-based analysis engine (always available)
AIzaSyCxxxxxxxxxxxxxxxxxxxxxxxxGroq API key for streaming summaries via Supabase edge function (Tier 3).
- Get your key: Groq Console
- Model used:
llama-3.3-70b-versatile - Used by: Supabase
generate-insightsedge function
gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxThe app uses a guaranteed local keyword-based analysis engine as a fallback when no LLM keys are provided. AI keys enhance accuracy but are not required for basic functionality.
Edge Function Secrets
These variables are server-side only and must be set via Supabase CLI. They are never exposed to the browser.Setting Secrets
Secret Variables Reference
Scrape.do API token used by the
fetch-twitter edge function for server-side scraping.Functions using this:fetch-twitter(primary data source)
Parallel.ai API key for fallback social search when Scrape.do is unavailable.Functions using this:
fetch-twitter(secondary fallback)
YouTube Data API v3 key for server-side video and comment fetching.Functions using this:
fetch-youtubefetch-twitter(tertiary fallback)
Google Gemini API key for server-side sentiment analysis and AI summary generation.Functions using this:
analyze-sentiment(primary analysis engine)generate-insightsanalyze-topic
Your Supabase project URL (same as
VITE_SUPABASE_URL but for edge functions).Example: https://owrqiailcuwlzxeekhms.supabase.coSupabase service role key with elevated permissions for database operations in edge functions.Find this in Supabase Project Settings → API as the
service_role secret key.Environment File Structure
Here’s the complete.env.example structure with annotations:
Validation
After configuring your environment variables, verify they’re loaded correctly:- Supabase connection status
- API key availability warnings
- Scrape.do token validation
Missing optional API keys will trigger fallback mechanisms. The app degrades gracefully:
- No Scrape.do token: Falls back to Parallel.ai → YouTube → Algorithmic generation
- No AI keys: Uses local keyword-based sentiment analysis
- No YouTube key: Skips video comment analysis
Troubleshooting
Variables not loading
- Ensure your
.envfile is in the project root (same directory aspackage.json) - Restart the dev server after changing
.env - Check for typos in variable names (they’re case-sensitive)
Supabase connection fails
- Verify your project URL doesn’t have trailing slashes
- Confirm you’re using the
anonkey, not theservice_rolekey for client variables - Check your Supabase project is active and not paused
Scrape.do returns errors
- Verify your token is active at scrape.do dashboard
- Check your credit balance
- Review rate limits and quota usage
Edge function secrets not working
- Ensure you’ve deployed your functions:
supabase functions deploy - Verify secrets are set:
supabase secrets list - Check function logs:
supabase functions logs fetch-twitter
Next Steps
Supabase Setup
Configure your Supabase project and database schema
Scrape.do Integration
Set up live social media scraping
API Keys
Get API keys for YouTube, Gemini, and Groq