Skip to content

Latest commit

 

History

History
136 lines (103 loc) · 2.93 KB

File metadata and controls

136 lines (103 loc) · 2.93 KB

Environment Variables Setup

Quick Setup

1. Backend Environment Variables

Create .env in the project root:

cd /Users/agu/Desktop/emberhacks/emberhacks
cp .env.template .env
nano .env

Add your API keys:

GOOGLE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXX
ELEVENLABS_API_KEY=sk_XXXXXXXXXXXXXXXXXXXXXXXX

2. Frontend Environment Variables

Create .env in the frontend folder:

cd /Users/agu/Desktop/emberhacks/emberhacks/frontend
cp .env.template .env
nano .env

Add your Porcupine key:

VITE_PORCUPINE_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Where to Get API Keys

  1. Google Gemini API Key

  2. ElevenLabs API Key

  3. Porcupine Access Key

File Structure

emberhacks/
├── .env                    ← Backend API keys (ROOT)
├── .env.template          ← Template for backend
├── frontend/
│   ├── .env               ← Frontend API keys
│   └── .env.template      ← Template for frontend
└── backend/
    └── (no .env here!)

Important Notes

  • ✅ All backend files now load from project root .env
  • ✅ Frontend loads from frontend/.env
  • .env files are in .gitignore (never committed)
  • ✅ Use .env.template files as reference

Start the Application

After setting up environment variables:

Terminal 1 - Backend:

cd /Users/agu/Desktop/emberhacks/emberhacks
source venv/bin/activate
python backend/main.py

Terminal 2 - Frontend:

cd /Users/agu/Desktop/emberhacks/emberhacks/frontend
npm run dev

Troubleshooting

"Missing ELEVENLABS_API_KEY"

Make sure:

  1. .env file exists in project root (not in backend folder)
  2. File contains: ELEVENLABS_API_KEY=your_actual_key
  3. No quotes around the key
  4. No spaces before/after the =

"No module named 'google.generativeai'"

Run:

cd /Users/agu/Desktop/emberhacks/emberhacks
source venv/bin/activate
pip install google-generativeai flask python-dotenv requests playwright

Backend can't find .env

All backend files now automatically load from project root. If you still have issues:

# Check if .env exists in root
ls -la /Users/agu/Desktop/emberhacks/emberhacks/.env

# Check contents
cat /Users/agu/Desktop/emberhacks/emberhacks/.env

Files Updated

These files now load .env from project root:

  • backend/main.py
  • backend/agent_runner.py
  • backend/test_elevenlabs.py

All use:

from pathlib import Path
project_root = Path(__file__).parent.parent
env_path = project_root / '.env'
load_dotenv(dotenv_path=env_path)