The "TypeError: Failed to fetch" error was occurring because the backend server was not running. This has been resolved with improved error handling in the frontend.
cd servernpm installnpm startThe server should start on http://localhost:5000 and display:
SecureDrop.AI API Running ✅
Make sure you have a .env file in the server directory with:
# Database
MONGODB_URI=your_mongodb_connection_string
# JWT Secret
JWT_SECRET=your_jwt_secret_key
# Email Service (for OTP)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
# Cloudinary (for file uploads)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# AI Services (optional)
OPENAI_API_KEY=your_openai_key
GEMINI_API_KEY=your_gemini_key
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:3000The frontend now includes robust error handling that:
- ✅ Detects when the backend is offline
- ✅ Shows clear error messages to users
- ✅ Allows manual organization code entry when search is unavailable
- ✅ Provides connection retry functionality
- ✅ Displays helpful troubleshooting information
- Frontend: Running with improved error handling
- Backend: Needs to be started manually (see instructions above)
- Database: Requires MongoDB connection
- Features: All functionality works when backend is running
Once the backend is running, you can test the API:
curl http://localhost:5000/Should return: SecureDrop.AI API Running ✅