Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MatthewSabia1/AdRecon/llms.txt

Use this file to discover all available pages before exploring further.

AdRecon uses environment variables for configuration across client and server contexts. This page documents all available variables from .env.example:1-18.

Quick Setup

Create your .env file from the example:
cp .env.example .env

Client-Side Variables

These variables are prefixed with VITE_ and are embedded into the frontend bundle at build time.
VITE_SUPABASE_URL
string
required
Supabase project URL. Used by the frontend to connect to your Supabase instance.
VITE_SUPABASE_URL="https://exagrdlzjpwxxpvxnvii.supabase.co"
Find this in your Supabase Dashboard → Project Settings → API.
VITE_SUPABASE_ANON_KEY
string
required
Supabase publishable (anonymous) key. This is safe to expose in the frontend.
VITE_SUPABASE_ANON_KEY="sb_publishable_a5FRi9IjnVX-_q2BBG2BXg_KKst4CXB"
Find this in your Supabase Dashboard → Project Settings → API.
Override the default auth redirect URL for Magic Link and Google OAuth.
VITE_MAGIC_LINK_REDIRECT_URL="https://your-domain.com/app"
Defaults to <origin>/app if not specified. Useful for custom domain setups.

Server-Side Variables

These variables are used by Vercel serverless functions in the /api/* routes.

Supabase Configuration

SUPABASE_URL
string
required
Supabase project URL for server-side API routes. Recommended for /api/admin/* endpoints.
SUPABASE_URL="https://exagrdlzjpwxxpvxnvii.supabase.co"
Typically the same as VITE_SUPABASE_URL, but kept separate for server context.
SUPABASE_SERVICE_ROLE_KEY
string
required
Supabase service role key with admin privileges. Required for /api/admin/users and other admin routes.
SUPABASE_SERVICE_ROLE_KEY="sb_secret_..."
This key bypasses Row Level Security (RLS). Never expose it in client-side code or commit it to version control.
Find this in Supabase Dashboard → Project Settings → API → service_role key.

Fanbasis Integration

FANBASIS_API_KEY
string
required
API key for Fanbasis integration. Required for /api/admin/fanbasis webhook and product management.
FANBASIS_API_KEY="your-fanbasis-api-key"
Contact your Fanbasis account manager to obtain this key.
Server-side override for Fanbasis purchase magic link redirect URL.
FANBASIS_MAGIC_LINK_REDIRECT_URL="https://your-domain.com/app"
Defaults to <origin>/app if not specified.

Admin & Auth Configuration

ADMIN_RESET_REDIRECT_URL
string
Redirect URL for password reset emails triggered by admin actions.
ADMIN_RESET_REDIRECT_URL="https://your-domain.com/app"
Defaults to the application origin if not specified.

Apify Integration

APIFY_TOKEN
string
required
Apify API token. Required for Landing Ripper capture runs via /api/landing-ripper/*.
APIFY_TOKEN="apify_api_..."
Generate this token in your Apify account settings.
APIFY_LANDING_RIPPER_ACTOR_ID
string
required
The Apify Actor ID used for Landing Ripper scraping operations.
APIFY_LANDING_RIPPER_ACTOR_ID="your-actor-id"
Find this in your Apify Actor’s settings page.
APIFY_LANDING_RIPPER_WEBHOOK_SECRET
string
Secret used to validate webhook requests to /api/landing-ripper/webhook.
APIFY_LANDING_RIPPER_WEBHOOK_SECRET="your-webhook-secret"
Optional but recommended for production to prevent unauthorized webhook calls.

Application Configuration

APP_BASE_URL
string
Absolute public URL of your application. Used when building webhook URLs and download links.
APP_BASE_URL="https://your-domain.com"
If not specified, the application will attempt to infer the URL from request headers.

Environment-Specific Configuration

Local Development

For local development, you typically need:
.env
# Required
VITE_SUPABASE_URL="https://your-project.supabase.co"
VITE_SUPABASE_ANON_KEY="your-anon-key"
SUPABASE_URL="https://your-project.supabase.co"
SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"

# Optional but recommended
APP_BASE_URL="http://localhost:3000"

Vercel Deployment

In Vercel, add environment variables in:
  • Project Settings → Environment Variables
  • Configure separately for Production, Preview, and Development environments
For production deployments, configure all variables listed above:
  1. Navigate to your Vercel project dashboard
  2. Go to Settings → Environment Variables
  3. Add each variable with the appropriate scope:
    • Production: Used for main branch deploys
    • Preview: Used for staging branch and other preview deploys
    • Development: Used for local Vercel dev command

Staging vs Production

Use different Supabase projects or database branches for staging and production: Staging (Preview environment):
VITE_SUPABASE_URL="https://staging-project.supabase.co"
SUPABASE_URL="https://staging-project.supabase.co"
Production:
VITE_SUPABASE_URL="https://production-project.supabase.co"
SUPABASE_URL="https://production-project.supabase.co"

Security Best Practices

Never commit .env files to version control. The .env.example file should only contain placeholder values, never real credentials.
  1. Rotate Keys Regularly: Periodically regenerate API keys and service role keys
  2. Use Different Keys Per Environment: Never reuse production keys in staging/development
  3. Restrict Service Role Usage: Only use SUPABASE_SERVICE_ROLE_KEY in server-side code
  4. Validate Webhooks: Always set APIFY_LANDING_RIPPER_WEBHOOK_SECRET in production
  5. Monitor Access: Review Supabase and Apify access logs regularly

Troubleshooting

Variables Not Loading

  • Ensure variable names are spelled correctly (case-sensitive)
  • For client variables, remember the VITE_ prefix is required
  • Restart the dev server after changing .env file
  • In Vercel, redeploy after adding/updating environment variables

CORS Issues

If you encounter CORS errors:
  • Verify redirect URLs are configured in Supabase Auth settings
  • Ensure VITE_MAGIC_LINK_REDIRECT_URL matches your allowed redirect URLs
  • Check that your domain is whitelisted in Supabase → Authentication → URL Configuration