Required Variables
These environment variables are required for Agility to function:Frontend (Next.js)
Set these variables in your deployment platform (Vercel, Netlify, etc.) or in.env.local for local development.
NEXT_PUBLIC_SUPABASE_URL
Type: PublicRequired: Yes The URL of your Supabase project.
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the “Project URL”
NEXT_PUBLIC_SUPABASE_ANON_KEY
Type: PublicRequired: Yes The anonymous (public) API key for your Supabase project.
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the “anon public” key
NEXT_PUBLIC_ENCRYPTION_KEY
Type: Public (but should be secret)Required: Yes Encryption key used to protect sensitive data like API keys and OAuth tokens stored in the database.
Backend (Supabase Edge Functions)
Set these variables in your Supabase project using the dashboard or CLI.SUPABASE_URL
Type: SecretRequired: Yes (auto-configured) Automatically provided by Supabase edge function runtime. Same value as
NEXT_PUBLIC_SUPABASE_URL.
SUPABASE_ANON_KEY
Type: SecretRequired: Yes (auto-configured) Automatically provided by Supabase edge function runtime. Same value as
NEXT_PUBLIC_SUPABASE_ANON_KEY.
ENCRYPTION_KEY
Type: SecretRequired: Yes Server-side encryption key for protecting sensitive data. Must match
NEXT_PUBLIC_ENCRYPTION_KEY.
- Go to Edge Functions → Manage secrets
- Add
ENCRYPTION_KEYwith your secure key
GOOGLE_CLIENT_ID
Type: SecretRequired: Yes (for Gmail integration) Google OAuth2 client ID for Gmail authentication.
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Gmail API
- Navigate to APIs & Services → Credentials
- Create OAuth 2.0 Client ID
- Set application type to “Web application”
- Copy the Client ID
GOOGLE_CLIENT_SECRET
Type: SecretRequired: Yes (for Gmail integration) Google OAuth2 client secret for Gmail authentication.
- Available when creating OAuth 2.0 Client ID in Google Cloud Console
- Can be viewed later in the credentials settings
GMAIL_OAUTH_REDIRECT_URI
Type: SecretRequired: Yes (for Gmail integration) The callback URL where Google redirects users after OAuth authorization.
- In Google Cloud Console → Credentials
- Edit your OAuth 2.0 Client ID
- Add the redirect URI to “Authorized redirect URIs”
- Set the same URI in your Supabase secrets
Setting Environment Variables
Local Development
Create a.env.local file in the project root:
.env.local
Vercel Deployment
Via Vercel Dashboard
Open project settings
Navigate to your project in Vercel dashboard → Settings → Environment Variables
Add variables
Add each environment variable:
- Name: Variable name (e.g.,
NEXT_PUBLIC_SUPABASE_URL) - Value: Variable value
- Environment: Select Production, Preview, and/or Development
Via Vercel CLI
Supabase Edge Functions
Via Supabase Dashboard
Via Supabase CLI
Optional Variables
These variables are optional but recommended for specific features:API Keys for Agent Testing
You can optionally set API keys as environment variables for testing purposes, though users typically provide their own keys:- OpenAI API Key - For Text Generator agent
- GitHub Personal Access Token - For GitHub Reader agent
- Discord Webhook URL - For Discord Messenger agent
Validation
Verify your environment variables are configured correctly:Frontend Validation
Create a test page or add to an existing page:Backend Validation
Check Supabase edge function logs after deployment:Security Best Practices
Environment Variable Checklist
✅ All required variables are set✅ Encryption keys match between frontend and backend
✅ Google OAuth credentials are correctly configured
✅ Redirect URIs match between Google Cloud Console and environment variables
✅ Production uses different keys than development
✅ Secrets are not committed to version control
✅ Team members have access only to necessary environments
Troubleshooting
”Authorization header is required” Error
Cause: Supabase credentials not configured correctly. Solution: VerifyNEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY are set correctly.
”Failed to decrypt API key” Error
Cause: Encryption key mismatch between frontend and backend. Solution: EnsureNEXT_PUBLIC_ENCRYPTION_KEY (frontend) matches ENCRYPTION_KEY (backend).
Gmail OAuth Fails
Cause: Google OAuth credentials or redirect URI misconfigured. Solution:- Verify
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET, andGMAIL_OAUTH_REDIRECT_URIare set - Check that redirect URI exactly matches Google Cloud Console configuration
- Ensure Gmail API is enabled in Google Cloud Console
Edge Function Can’t Access Secrets
Cause: Secrets not deployed or function needs redeployment. Solution:Next Steps
- Deployment Overview - General deployment guide
- Supabase Setup - Configure Supabase backend