Configuration
Fine-tune your AEO/GEO Analytics installation with these configuration options.
Environment Variables Reference
All configuration happens through environment variables in .env.local:
Required Variables
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...your-anon-key...
These are required for the application to run. Without them, database operations will fail.
LLM Provider API Keys
Add at least one provider to execute queries:
# Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-...
# OpenAI GPT-4
OPENAI_API_KEY=sk-...
# Google Gemini
GOOGLE_AI_API_KEY=...
# Perplexity
PERPLEXITY_API_KEY=pplx-...
- Claude: Best for citation-rich responses, excellent reasoning
- GPT-4: Industry standard, balanced responses
- Gemini: Good for diverse perspectives
- Perplexity: Optimized for search-like responses with citations
You can add all four and choose per query execution.
LLM Provider Setup
Anthropic Claude
- Go to console.anthropic.com
- Sign up or log in
- Navigate to API Keys
- Click Create Key
- Copy the key (starts with
sk-ant-) - Add to
.env.local:ANTHROPIC_API_KEY=sk-ant-...
Models Used: claude-sonnet-4-5-20250929
Cost: ~$0.003 per query (3 cents per 10 queries)
OpenAI GPT-4
- Go to platform.openai.com
- Sign up or log in
- Add payment method (required for API access)
- Navigate to API Keys
- Click Create new secret key
- Copy the key (starts with
sk-) - Add to
.env.local:OPENAI_API_KEY=sk-...
Models Used: gpt-4-turbo-preview
Cost: ~$0.01 per query (10 cents per 10 queries)
Google Gemini
- Go to aistudio.google.com
- Sign in with Google account
- Click Get API Key
- Create a new project or select existing
- Copy the API key
- Add to
.env.local:GOOGLE_AI_API_KEY=...
Models Used: gemini-1.5-pro
Cost: Free tier available (60 requests/minute)
Perplexity
- Go to docs.perplexity.ai
- Sign up for API access
- Navigate to API settings
- Generate API key (starts with
pplx-) - Add to
.env.local:PERPLEXITY_API_KEY=pplx-...
Models Used: llama-3.1-sonar-large-128k-online
Cost: ~$0.001 per query (1 cent per 10 queries)
Supabase Configuration
Row Level Security (RLS)
AEO/GEO Analytics uses public read access for analytics data. The migrations automatically set up RLS policies.
Verify RLS Policies:
- Open Supabase dashboard → Authentication → Policies
- Check that these policies exist:
Enable read access for all usersonllm_queriesEnable read access for all usersonllm_responsesEnable read access for all usersoncitations- Similar policies for query library tables
If missing, run migrations again:
npx supabase db push
Database Indexes
Migrations include optimized indexes for:
- Query lookups by provider and date
- Citation searches by domain
- Query set filtering by industry and tags
No manual index creation needed.
Connection Pooling
Supabase automatically handles connection pooling. Default settings work for most use cases.
Next.js Configuration
Build Configuration
The next.config.ts includes:
const config: NextConfig = {
// Server-side rendering for dynamic data
// Static optimization where possible
// Environment variables are automatically loaded from .env.local
};
No changes needed for default setup.
TypeScript Configuration
Strict mode enabled in tsconfig.json:
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true
}
}
This ensures type safety throughout the application.
Cost Management
Estimated Costs Per Provider
| Provider | Cost per Query | Cost per 100 Queries |
|---|---|---|
| Perplexity | $0.001 | $0.10 |
| Claude | $0.003 | $0.30 |
| GPT-4 | $0.010 | $1.00 |
| Gemini | Free* | Free* |
*Gemini: Free tier includes 60 requests/minute, 1500 requests/day
Cost Optimization Tips
- Use Gemini for testing: Free tier is generous
- Batch queries: Execute 20-50 at once for systematic analysis
- Choose providers strategically:
- High-value queries → Claude or GPT-4
- Testing/exploration → Gemini or Perplexity
- Monitor usage: Check provider dashboards monthly
Set Spending Limits
OpenAI:
- Dashboard → Billing → Usage Limits
- Set monthly cap (e.g., $10/month)
Anthropic:
- Dashboard → Billing → Budget Alerts
- Set notification thresholds
Security Best Practices
Environment Variables
✅ Do:
- Keep
.env.localin.gitignore(already configured) - Use different API keys for dev/production
- Rotate keys periodically
- Use environment-specific keys in Vercel
❌ Don't:
- Commit
.env.localto version control - Share API keys in Slack/Discord
- Use production keys in local development
- Hard-code keys in application code
Supabase Security
The application uses anon/public key (safe for client-side):
- Read-only access via RLS policies
- No write operations without authentication
- Keys can be safely exposed in frontend code
The service_role key (admin access) should never be used or exposed in the application. Only use anon/public key.
Development vs Production
Local Development
Use .env.local for local environment:
# .env.local (local development)
NEXT_PUBLIC_SUPABASE_URL=https://local-dev-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...local-key...
ANTHROPIC_API_KEY=sk-ant-...dev-key...
Production (Vercel)
Set environment variables in Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add each variable:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYANTHROPIC_API_KEY- etc.
- Choose environment: Production, Preview, or Development
- Click Save
Use different Supabase projects for production and development to avoid data mixing.
Testing Your Configuration
Verify Environment Variables
Create a test page to verify (dev only):
npm run dev
Navigate to /dashboard/execute and check API Key Status section:
- ✅ Configured = API key detected and valid format
- ⚠️ Not Configured = API key missing or invalid
Test Database Connection
Run a test query:
npm run dev
Go to Analytics page:
- If you see "Total Queries: 0" → Database connected ✅
- If you see error → Check Supabase credentials
Test LLM Providers
Execute test queries from the Execute page to verify each provider works.
Advanced Configuration
Custom Database Schema
If you need custom fields:
- Create a new migration file:
npx supabase migration new add_custom_field
- Edit migration in
supabase/migrations/ - Apply migration:
npx supabase db push
Custom LLM Models
To use different models, edit lib/api/ client files:
// lib/api/claude-client.ts
const MODEL = 'claude-sonnet-4-5-20250929'; // Change model here
Rebuild after changes:
npm run build
Troubleshooting Configuration
Environment Variable Not Found
Symptom: NEXT_PUBLIC_SUPABASE_URL is not defined
Solution:
- Verify
.env.localexists in project root - Restart dev server:
Ctrl+Cthennpm run dev - Check for typos in variable names
API Key Invalid
Symptom: Invalid API key error when executing
Solution:
- Verify key format (no spaces, newlines, quotes)
- Regenerate key from provider dashboard
- Update
.env.local - Restart server
Database Connection Failed
Symptom: Failed to connect to Supabase
Solution:
- Check Supabase project status (dashboard)
- Verify URL and anon key are correct
- Check RLS policies are enabled
- Run migrations:
npx supabase db push
Next Steps
Configuration complete! Move on to:
- Quick Start → - Execute your first queries
- User Guide → - Explore features
- Troubleshooting → - Solve common issues