Overview
This guide provides a complete reference for all environment variables needed to run Polaris. Variables are organized by service and include descriptions, examples, and whether they’re required or optional.Setup
Create a.env.local file in your project root:
Terminal
Required Variables
These variables are required for Polaris to function:Clerk (Authentication)
Your Clerk publishable key. Find this in the Clerk Dashboard under API Keys.Example:
pk_test_c2ltcGxlLWdhcmZpc2gtOTIuY2xlcmsuYWNjb3VudHMuZGV2JAWhere to get it:- Go to Clerk Dashboard
- Select your application
- Navigate to API Keys
- Copy the Publishable Key
Your Clerk secret key. Find this in the Clerk Dashboard under API Keys.Example:
sk_test_ABCdefGHIjklMNOpqrSTUvwxYZ123456789Where to get it:- Go to Clerk Dashboard
- Select your application
- Navigate to API Keys
- Copy the Secret Key
Convex (Database)
Your Convex deployment URL. Generated automatically when you run
npx convex dev.Example: https://happy-mammal-123.convex.cloudWhere to get it:- Run
npx convex devin your project - The URL will be displayed in the terminal
- Or find it in the Convex Dashboard under your project settings
Your Convex deployment identifier. Generated automatically when you run
npx convex dev.Example: prod:happy-mammal-123Where to get it:- Run
npx convex devin your project - The deployment name will be displayed in the terminal
- Or find it in your
convex.jsonfile
A random secret string used to secure internal API calls between Inngest and Convex. Generate a secure random string.Example: Important: Also set this in Convex:
a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6How to generate:AI Provider (Choose One)
Your Anthropic API key for Claude AI. This is the preferred AI provider for Polaris.Example:
sk-ant-api03-1234567890abcdefghijklmnopqrstuvwxyzWhere to get it:- Go to console.anthropic.com
- Navigate to API Keys
- Click Create Key
- Copy the key
Your Google AI Studio API key for Gemini AI. This is the free alternative to Claude.Example:
AIzaSyABCDEFGHIJKLMNOPQRSTUVWXYZ123456789Where to get it:- Go to aistudio.google.com
- Click Get API Key
- Create or select a project
- Copy the API key
Optional Variables
These variables enable additional features but are not required for core functionality:Firecrawl (Web Scraping)
Your Firecrawl API key for scraping documentation and websites to provide context to the AI.Example:
fc-1234567890abcdefghijklmnopqrstuvwxyzWhere to get it:- Go to firecrawl.dev
- Sign up for an account
- Navigate to API Keys
- Copy your API key
Sentry (Error Tracking)
Your Sentry Data Source Name (DSN) for error tracking and monitoring.Example:
https://[email protected]/9876543Where to get it:- Go to sentry.io
- Create a new project (or select existing)
- Navigate to Settings → Projects → Client Keys (DSN)
- Copy the DSN
Convex-Only Environment Variables
Some variables must be set directly in your Convex deployment using the CLI:Required in Convex
Terminal
Your Clerk JWT issuer domain. This is used by Convex to validate authentication tokens.Example:
https://happy-panda-12.clerk.accounts.devWhere to get it:- Go to Clerk Dashboard
- Select your application
- Navigate to API Keys
- Find the Issuer field under JWT Template
Complete Example
Here’s a complete.env.local file with all variables:
Validation
After setting up your environment variables, validate them:Check Next.js Environment
Start the development server and check for any errors:Missing required variables will show clear error messages.
Terminal
Check Convex Environment
List all Convex environment variables:Ensure
Terminal
CLERK_JWT_ISSUER_DOMAIN and POLARIS_CONVEX_INTERNAL_KEY are set.Environment-Specific Configuration
Development
Use.env.local for local development:
Terminal
Production
For production deployments:- Set environment variables in your hosting provider (Vercel, etc.)
- Deploy Convex to production:
Terminal
- Set production Convex variables:
Terminal
Troubleshooting
Variables Not Loading
- Ensure
.env.localis in the project root (same level aspackage.json) - Restart the development server after changing
.env.local - Check for typos in variable names (they’re case-sensitive)
“Missing API Key” Errors
- Verify the variable is set in
.env.local - Check that the variable name matches exactly (e.g.,
ANTHROPIC_API_KEYnotANTHROPIC_KEY) - Ensure there are no extra spaces or quotes around the value
Convex Authentication Issues
If Convex shows “Unauthorized” errors:- Verify
CLERK_JWT_ISSUER_DOMAINis set in Convex:Terminal - Ensure it matches your Clerk issuer domain exactly
- Restart the Convex dev server:
Terminal
Security Best Practices
-
Never commit secrets to version control
- Keep
.env.localin.gitignore - Use
.env.examplewith placeholder values for documentation
- Keep
-
Use different keys per environment
- Development keys for local work
- Production keys for deployed app
- Never use production keys in development
-
Rotate keys regularly
- Generate new API keys periodically
- Update keys immediately if compromised
-
Limit key permissions
- Use API keys with minimum required permissions
- Enable key restrictions where possible
-
Monitor key usage
- Check service dashboards for unexpected usage
- Set up alerts for unusual activity
Next Steps
- Authentication Setup - Configure Clerk authentication
- Database Setup - Set up Convex database