- ✅ Backend is running on port 8000
- ✅ Frontend is running on port 3000
- ✅ Environment variables are set correctly
- ✅ CORS is configured properly
curl http://localhost:8000/api/healthShould return:
{
"status": "ok",
"message": "Backend API is running",
"database": { "connected": true }
}Open browser console (F12) and look for:
🔧 Frontend API Configuration: { VITE_API_URL: "...", API_BASE_URL: "..." }
Should show: API_BASE_URL: "http://localhost:8000"
When you try to login, check browser console for:
🔵 Calling API: http://localhost:8000/api/auth/login
🔵 Response status: 200 (or error code)
Solution:
- Make sure backend is running:
cd backend && npm run dev - Check backend is on port 8000 (check terminal output)
- Verify
.envfile in root has:VITE_API_URL="http://localhost:8000"
Solution:
- Backend CORS is configured to allow
http://localhost:3000 - If you see CORS errors, restart the backend server
Solution:
- Check backend is running on the correct port
- Verify API endpoint URLs match (should be
/api/auth/login, etc.)
Solution:
- Check if backend server is actually running
- Try accessing
http://localhost:8000/api/healthdirectly in browser - Check firewall/antivirus isn't blocking connections
Frontend (root .env):
VITE_API_URL="http://localhost:8000"Backend (backend/.env):
DATABASE_URL="postgresql://roopansh@localhost:5432/chatbot?schema=public"
OPENAI_API_KEY="your-key"
JWT_SECRET="your-secret"
PORT=8000
FRONTEND_URL="http://localhost:3000"# Test login endpoint
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"demo@example.com","password":"demo123"}'- Open DevTools (F12)
- Go to Network tab
- Try to login
- Look for requests to
localhost:8000 - Check:
- Request URL (should be
http://localhost:8000/api/auth/login) - Request Method (should be
POST) - Response Status (200 = success, 401 = wrong credentials, etc.)
- Response body (check for error messages)
- Request URL (should be
# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
npm run dev- Hard refresh:
Cmd+Shift+R(Mac) orCtrl+Shift+R(Windows) - Or clear browser cache completely
# Check what's running on port 8000
lsof -i:8000
# Check what's running on port 3000
lsof -i:3000- Check browser console for specific error messages
- Check backend terminal for error logs
- Verify both servers are running
- Try accessing backend directly:
http://localhost:8000/api/health