- ✅ Updated Vite dev server to listen on
0.0.0.0(all network interfaces) - ✅ Now accessible from mobile devices on the same WiFi network
- Access from mobile:
http://<YOUR_COMPUTER_IP>:5173
- ✅ API URL detection now properly handles:
- Localhost development (relative paths via Vite proxy)
- Mobile clients on same network (relative paths via Vite proxy)
- Vercel deployment (serverless functions at
/api/*)
- ✅ Environment variables properly configured for Vercel
- ✅ API key fallback included for development
- ✅ Vercel env config updated to load
MISTRAL_API_KEYfrom Vercel project settings - ✅ Server.js uses dotenv for local development
- ✅ Fixed invalid embed parameters (
startandendremoved as they're not valid in YouTube embeds) - ✅ Using proper YouTube parameters:
autoplay=1&mute=1&controls=1&modestbranding=1&fs=1 - ✅ Fallback curated videos display when AI doesn't return valid videos
npm run dev:allThis runs:
- Frontend on
http://localhost:5173(and accessible from mobile via your IP) - Backend on
http://localhost:5000
Terminal 1 - Frontend:
npm run devAccess from desktop: http://localhost:5173
Access from mobile: http://<YOUR_COMPUTER_IP>:5173 (e.g., http://192.168.1.100:5173)
Terminal 2 - Backend:
npm run serverFind Your Computer's IP:
- Windows: Open PowerShell and run
ipconfig(look for IPv4 Address) - Mac/Linux: Open Terminal and run
ifconfig(look for inet)
Access from Mobile:
- Same WiFi network as your computer
- Navigate to:
http://<YOUR_IP>:5173 - Example:
http://192.168.1.100:5173
Test if the API is working:
# From your computer
curl http://localhost:5000/api/health
# From mobile (replace IP)
curl http://192.168.1.100:5000/api/healthMISTRAL_API_KEY=V2RyZVaQfIZtScgZXizx8VtjUj34wDlB
VITE_API_BASE_URL=
NODE_ENV=developmentSet these in Vercel Project Settings → Environment Variables:
MISTRAL_API_KEY= Your actual Mistral API keyNODE_ENV=production
Mobile/Desktop Browser
↓
http://<IP>:5173 (Vite dev server, listens on 0.0.0.0)
↓
Vite Proxy intercepts /api/* requests
↓
http://localhost:5000 (Backend Express server)
↓
Processes request, calls Mistral AI
↓
Returns response to browser
Browser (Vercel domain)
↓
https://your-app.vercel.app
↓
Relative path /api/answer
↓
Vercel routes to /api/answer.js (serverless function)
↓
Loads MISTRAL_API_KEY from Vercel env variables
↓
Calls Mistral AI API
↓
Returns response to browser
- ✅ Verify both devices are on same WiFi
- ✅ Check Windows Firewall allows Node.js (you'll get a prompt)
- ✅ Verify your computer IP:
ipconfigin PowerShell - ✅ Try:
http://<YOUR_IP>:5173in mobile browser - ✅ Check Vite is running on
0.0.0.0:5173in terminal logs
- ✅ Check terminal for error messages
- ✅ Verify
.envfile hasMISTRAL_API_KEYset - ✅ Ensure backend is running:
npm run server - ✅ Test directly:
curl http://localhost:5000/api/health
- ✅ Confirm API key is valid in
.env - ✅ Check console for Mistral error messages
- ✅ Verify internet connection is working
- ✅ Mistral might be rate-limited; wait a bit and retry
- ✅ Verify video ID is being extracted correctly (check browser console)
- ✅ Ensure thumbnail loads (requests go to
img.youtube.com) - ✅ Some videos may have embedding disabled by creator
- ✅ Use fallback curated videos as backup
- vite.config.js - Changed dev server to listen on
0.0.0.0 - src/utils/api.js - Improved API URL detection logic
- api/answer.js - Better environment variable handling
- src/pages/Answer.jsx - Fixed YouTube embed parameters
- vercel.json - Updated with proper environment variable config
- .env.local - Added MISTRAL_API_KEY for local dev
-
Test locally with backend:
npm run dev:all
-
Test on mobile (same WiFi):
- Find your IP:
ipconfig - Go to
http://<YOUR_IP>:5173 - Ask a question and verify AI response works
- Find your IP:
-
Deploy to Vercel:
- Ensure environment variables are set in Vercel project settings
- Push to GitHub (Vercel auto-deploys)
- Test at your Vercel domain
-
Monitor logs:
- Local: Check terminal for error messages
- Vercel: Check
vercel logsin CLI or Vercel dashboard
Check the error message in:
- Browser Console (F12 → Console tab)
- Terminal where you ran
npm run dev:all - Vercel Logs (Dashboard → Deployments → Function Logs)