Configure environment variables in Netlify so your AI service works in production.
5-10 minutes
- Access to Netlify dashboard
- Your
.env.localfile with actual values
Open your .env.local file and copy all the values. You'll need them in the next steps.
Windows PowerShell:
Get-Content .env.localGit Bash:
cat .env.localKeep this window open so you can copy values easily.
- Go to: https://app.netlify.com/
- Log in if needed
- Click on your site: codeex-ai
- Click Site settings (in the top navigation)
- In the left sidebar, click Environment variables (under "Build & deploy")
- You'll see a page titled "Environment variables"
For each variable below, click Add a variable or Add a single variable:
Key: GROQ_API_KEY
Value: [Copy from your .env.local - starts with gsk_]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_API_KEY
Value: [Copy from your .env.local - starts with AIza]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
Value: [Copy from your .env.local - ends with .firebaseapp.com]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_PROJECT_ID
Value: [Copy from your .env.local]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
Value: [Copy from your .env.local - ends with .firebasestorage.app]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
Value: [Copy from your .env.local - numbers only]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_APP_ID
Value: [Copy from your .env.local - format: 1:xxx:web:xxx]
Scopes: All scopes
Key: NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
Value: [Copy from your .env.local - starts with G-]
Scopes: All scopes
Key: NEXT_PUBLIC_APP_URL
Value: https://codeex-ai.netlify.app
Scopes: All scopes
Key: CEREBRAS_API_KEY
Value: [Copy from your .env.local - starts with csk_]
Scopes: All scopes
Key: GOOGLE_API_KEY
Value: [Copy from your .env.local - starts with AIza]
Scopes: All scopes
Key: HUGGINGFACE_API_KEY
Value: [Copy from your .env.local - starts with hf_]
Scopes: All scopes
Key: ENABLE_SAFETY_GUARD
Value: true
Scopes: All scopes
Key: ENABLE_MEMORY_SYSTEM
Value: false
Scopes: All scopes
After adding all variables, you should see them listed on the Environment variables page. Count them:
- Minimum required: 9 variables (GROQ_API_KEY + 7 Firebase + APP_URL)
- Recommended: 12 variables (+ 3 fallback providers)
- Full setup: 14 variables (+ 2 feature flags)
Option A: Using Netlify UI
- Click Deploys tab (top navigation)
- Click Trigger deploy button (top right)
- Select Deploy site
- Wait 2-3 minutes for deployment to complete
Option B: Push to GitHub
git commit --allow-empty -m "Trigger rebuild with env vars"
git push origin main- Wait for deployment to finish (watch the progress in Netlify)
- Once deployed, visit: https://codeex-ai.netlify.app
- Try these tests:
- ✅ Homepage loads
- ✅ Sign in / Sign up works
- ✅ Send a message to AI
- ✅ AI responds (not "service unavailable")
- ✅ TTS works (click speaker icon)
- ✅ Account page accessible
You'll know it's working when:
- ✅ AI responds to your messages (no "service unavailable" error)
- ✅ Authentication works (can sign in/up)
- ✅ TTS plays audio with Orpheus voices
- ✅ No console errors about missing environment variables
- Check browser console (F12) for errors
- Verify GROQ_API_KEY is correct (no typos)
- Check Groq API key is valid: https://console.groq.com/keys
- Check function logs in Netlify: Deploys → Latest deploy → Function logs
- Verify all 7 NEXT_PUBLIC_FIREBASE_* variables are correct
- Check Firebase Console: https://console.firebase.google.com/
- Ensure Netlify domain is in Firebase authorized domains:
- Firebase Console → Authentication → Settings → Authorized domains
- Add:
codeex-ai.netlify.app
- Make sure you triggered a NEW deployment after adding variables
- Old deployments don't have the new variables
- Clear browser cache and hard refresh (Ctrl+Shift+R)
- Check Netlify build logs: Deploys → Latest deploy → Deploy log
- Check function logs: Deploys → Latest deploy → Function logs
- Verify environment variables are saved: Site settings → Environment variables
- Detailed Guide:
NETLIFY_ENV_SETUP.md - Deployment Status:
DEPLOYMENT_STATUS.md - Environment Template:
.env.local.example - Netlify Docs: https://docs.netlify.com/environment-variables/overview/
Once everything works:
- ✅ Test all features thoroughly
- ✅ Share with friends for feedback
- ✅ Monitor Groq API usage: https://console.groq.com/
- ✅ Check Firebase usage: https://console.firebase.google.com/
Need Help? Check the troubleshooting section above or review the detailed guide in NETLIFY_ENV_SETUP.md.