Backend Environment Variables
Create a.env file in the highway-backend directory:
Required Variables
Your OpenAI API key for accessing the Realtime API.Get your key from: OpenAI API Keys
Port number for the Express server.Default: 3000Example:
PORT=3000Your Twilio Account SID for making phone calls.Find this in: Twilio Console
Your Twilio Auth Token for authenticating API requests.Find this in: Twilio Console
Your Twilio phone number in E.164 format (e.g., +1234567890).Must be a verified Twilio number that can make outbound calls.
Backend .env Example
.env
Frontend Environment Variables
Create a.env.local file in the highway-frontend directory:
Required Variables
Your Supabase project URL.Find this in: Supabase Dashboard → Project Settings → APIFormat:
https://your-project.supabase.coYour Supabase anonymous (public) key.Find this in: Supabase Dashboard → Project Settings → APIThis key is safe to use in the browser.
Frontend .env.local Example
.env.local
Next.js requires environment variables used in the browser to be prefixed with
NEXT_PUBLIC_.Configuration File Reference
The backendconfig.js loads and exports environment variables:
config.js
Additional Configuration Options
These are hardcoded inconfig.js but can be customized:
VOICE: OpenAI voice model
- Options:
alloy,echo,fable,onyx,nova,shimmer - Default:
shimmer
- Customize the behavior of the voice assistant
- Default: Cheerful phone assistant for Olive Financial
- Controls which OpenAI Realtime API events are logged
- See Backend Setup for full list
Security Best Practices
.gitignore Setup
Ensure your.gitignore includes:
.gitignore
Key Security Guidelines
Keep secrets secret
- Never expose API keys in client-side code
- Don’t log sensitive environment variables
- Use different keys for development and production
Use appropriate key types
- Backend: Use secret keys (never exposed to browser)
- Frontend: Only use public/anonymous keys with proper Row Level Security (RLS)
Rotate keys regularly
- Change API keys periodically
- Immediately rotate if keys are compromised
- Keep backup keys ready for seamless rotation
Environment-Specific Configuration
Development
Production
Supabase Setup
Highway uses Supabase for storing call logs:Create Supabase project
- Go to Supabase Dashboard
- Click “New Project”
- Choose organization and name your project
- Save your database password securely
Get API credentials
- Go to Project Settings → API
- Copy the Project URL
- Copy the
anonpublickey - Add both to your
.env.localfile
The example Supabase credentials in the source code are for demonstration only. Always use your own Supabase project.
Verification
Verify your environment variables are loaded correctly:Backend Verification
Frontend Verification
Runtime Verification
Add temporary logging to check variables are loaded:Troubleshooting
Variables not loading?- Check file name is exactly
.env(backend) or.env.local(frontend) - Ensure file is in the correct directory
- Restart your dev server after changing
.envfiles - Verify no typos in variable names
- Verify URL and key are correct
- Check Supabase project is not paused
- Ensure RLS policies allow your operations
- Test connection in Supabase SQL editor
- Verify Account SID and Auth Token are correct
- Ensure phone number is in E.164 format
- Check Twilio number is capable of making voice calls
- Verify you have sufficient Twilio credits
Next Steps
Backend Setup
Complete backend server setup
Deployment
Deploy to production with environment variables