Overview
SENTi-radar uses two types of environment variables:Frontend (VITE_*)
Public variables embedded in the Vite build, accessible in the browser
Backend (Supabase Secrets)
Server-side secrets for edge functions, never exposed to the client
Required API Keys
Supabase
Required for: Database, authentication, edge functionsCreate a Supabase project
Sign up at supabase.com and create a new project
Scrape.do
Required for: Live X (Twitter) and Reddit data scrapingSign up for Scrape.do
Create an account at scrape.do
Scrape.do is the primary data source for X/Twitter and Reddit. Without it, the app falls back to YouTube or algorithmic generation.
YouTube Data API v3
Required for: YouTube video comments (optional)Go to Google Cloud Console
Visit console.cloud.google.com
Enable YouTube Data API v3
Navigate to APIs & Services → Library → Search for “YouTube Data API v3” → Enable
Gemini API
Required for: AI-powered sentiment analysis and summaries (optional)Get Gemini API key
Visit ai.google.dev and sign up
Without Gemini, the app falls back to keyword-based sentiment analysis, which is less accurate but fully functional.
Groq (Optional)
Required for: Alternative LLM for summaries (optional)Sign up for Groq
Visit console.groq.com
Frontend Environment Variables
Local Development
Create a.env file in the project root:
.env
Production
Set environment variables in your hosting platform:Vercel
Vercel
- Go to Project Settings → Environment Variables
- Add each variable:
- Name:
VITE_SUPABASE_URL - Value:
https://your-project.supabase.co - Environment: Production
- Name:
- Redeploy to apply changes
Netlify
Netlify
- Go to Site Settings → Build & Deploy → Environment
- Click “Add variable”
- Add each
VITE_*variable - Trigger a new deploy
Cloudflare Pages
Cloudflare Pages
- Go to Settings → Environment Variables
- Add Production variables
- Redeploy the project
Lovable
Lovable
- Go to Project Settings → Environment Variables
- Add each variable with its value
- Deploy or redeploy to apply
Backend Secrets (Supabase)
Setting Secrets
Edge functions access secrets viaDeno.env.get(). Set them using the Supabase CLI:
Listing Secrets
View configured secrets (values are hidden):Unsetting Secrets
Remove a secret:Required Secrets by Function
analyze-sentiment
analyze-sentiment
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
GEMINI_API_KEY(falls back to keyword-based analysis)
fetch-twitter
fetch-twitter
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
SCRAPE_DO_TOKEN(primary data source)PARALLEL_API_KEY(fallback)YOUTUBE_API_KEY(fallback)
fetch-reddit
fetch-reddit
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
SCRAPE_DO_TOKEN(for Reddit JSON API)
fetch-youtube
fetch-youtube
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
YOUTUBE_API_KEY
analyze-topic
analyze-topic
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
generate-insights
generate-insights
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
GEMINI_API_KEY
scheduled-monitor
scheduled-monitor
Required:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
Environment Variable Reference
Frontend Variables
| Variable | Required | Description | Example |
|---|---|---|---|
VITE_SUPABASE_URL | ✅ Yes | Supabase project URL | https://abc123.supabase.co |
VITE_SUPABASE_PUBLISHABLE_KEY | ✅ Yes | Supabase anon/public key | eyJhbGciOiJIUzI1NiIs... |
VITE_SCRAPE_TOKEN | ⭐ Recommended | Scrape.do API token for X/Reddit | scrape_do_abc123... |
VITE_YOUTUBE_API_KEY | ❌ Optional | YouTube Data API v3 key | AIzaSyC... |
VITE_GEMINI_API_KEY | ❌ Optional | Gemini AI API key | AIzaSyD... |
VITE_GROQ_API_KEY | ❌ Optional | Groq API key | gsk_... |
Backend Secrets
| Secret | Required | Description | Example |
|---|---|---|---|
SUPABASE_URL | ✅ Yes | Supabase project URL | https://abc123.supabase.co |
SUPABASE_SERVICE_ROLE_KEY | ✅ Yes | Supabase service role key (never expose publicly) | eyJhbGciOiJIUzI1NiIs... |
SCRAPE_DO_TOKEN | ⭐ Recommended | Scrape.do API token | scrape_do_abc123... |
YOUTUBE_API_KEY | ❌ Optional | YouTube Data API v3 key | AIzaSyC... |
GEMINI_API_KEY | ❌ Optional | Gemini AI API key | AIzaSyD... |
PARALLEL_API_KEY | ❌ Optional | Parallel.ai API key (fallback) | pk_... |
Validation & Testing
Test Frontend Environment
Open browser console:Test Edge Function Secrets
Deploy a test function:test-secrets.ts
Security Best Practices
Troubleshooting
Environment variables are undefined
Environment variables are undefined
Symptoms:
import.meta.env.VITE_SUPABASE_URL returns undefinedCauses:- Variable not prefixed with
VITE_ .envfile not in project root- Build cache not cleared
Supabase secrets not accessible in edge functions
Supabase secrets not accessible in edge functions
Symptoms:
Deno.env.get("SCRAPE_DO_TOKEN") returns undefined or empty stringCauses:- Secrets not set via
supabase secrets set - Wrong project linked
API key quota exceeded
API key quota exceeded
Symptoms: 429 errors from Scrape.do, YouTube, or GeminiSolutions:
- Check usage in provider dashboard
- Upgrade to higher tier
- Implement caching to reduce API calls
- Use fallback mechanisms (app already includes these)
Invalid API key errors
Invalid API key errors
Symptoms: 401/403 errors from external APIsSolutions:
- Verify API key is correct (no extra spaces)
- Check API key hasn’t expired
- Ensure API is enabled (e.g., YouTube Data API v3 in Google Cloud)
- Test API key directly with curl:
Next Steps
Deploy Frontend
Build and deploy the React application
Deploy Edge Functions
Deploy backend edge functions to Supabase