✅ Backend is running and healthy on http://localhost:5001
✅ Vite proxy is configured in vite.config.ts
✅ All API calls use relative URLs (via proxy)
The Vite proxy configuration ONLY works after restarting the dev server.
Steps:
# Stop the current frontend (Ctrl+C in the terminal)
# Then restart:
cd frontend/complain-analyzer-ai
npm run devcd backend
python app.pyYou should see:
Starting Complaint Management Backend
Data directory: ...
Complaints file: ...
Models directory: ...
- Open browser:
http://localhost:3000 - Open DevTools (F12) → Console tab
- Look for these logs:
API Base URL: (using relative URLs via Vite proxy)Base URL: (relative - using Vite proxy)
- Try submitting a complaint
- Check the Network tab for
/api/complaintsrequest
When working correctly, you should see:
API Base URL: (using relative URLs via Vite proxy)
Environment variables: { VITE_API_URL: undefined, MODE: 'development', DEV: true }
[POST] /api/complaints
Base URL: (relative - using Vite proxy)
Checking backend health at /api/health...
Health check response status: 200
Backend is healthy: { status: 'healthy', ... }
If you see "Network Error":
- ✅ Check backend is running:
curl http://localhost:5001/api/health - ✅ Check frontend dev server is running on port 3000
- ✅ RESTART the frontend dev server (most common issue!)
- Check browser console for detailed error messages
- Check Network tab for request details
If proxy isn't working:
- Verify
vite.config.tshas the proxy configuration - Make sure you're accessing via
http://localhost:3000(not file://) - Check that no other service is using port 3000
- Frontend runs on
http://localhost:3000 - Backend runs on
http://localhost:5001 - Vite proxy intercepts requests to
/api/*and forwards them tohttp://localhost:5001 - Browser sees requests as same-origin (no CORS issues)
- ✅
vite.config.ts- Proxy configuration - ✅
src/services/api.ts- Uses relative URLs - ✅
src/config.ts- Centralized API config - ✅
src/components/ComplaintForm.tsx- Enhanced error logging - ✅
backend/app.py- CORS and response format
- RESTART frontend dev server
- Test complaint submission
- Check browser console for logs
- Verify complaint is saved in
backend/data/complaints.json