# Proxy Pool Startup Scripts ## File List - **start_backend.bat** - Start backend service - **start_frontend.bat** - Start frontend service - **stop_all.bat** - Stop all services ## Quick Start ### Start Services Separately - Backend: Double-click `start_backend.bat` - Frontend: Double-click `start_frontend.bat` ### Stop Services Double-click `stop_all.bat` to stop all services ## Script Features ### Smart Process Management - Automatically detect and stop running processes - Prevent duplicate startup of multiple instances - Automatically clean up port conflicts ### Log Management - All output written to log files - Backend log: `backend.log` - Frontend log: `frontend.log` - Logs include timestamps for troubleshooting ### PID Management - Automatically record process ID to PID files - Facilitates subsequent service stopping - Automatically clean up PID files after process stops ### Port Cleanup - Automatically detect and clean up port conflicts - Backend port: 3000 - Frontend port: 8080 ## Access Addresses After successful startup: - Backend API: http://localhost:3000 - Frontend UI: http://localhost:8080 ## Manual Operations ### View Logs ```bash # View backend log type backend.log # View frontend log type frontend.log ``` ### Manual Stop Process ```bash # View PID file content type backend.pid type frontend.pid # Stop process using PID taskkill /F /PID ``` ### Check Port Usage ```bash # Check backend port netstat -ano | findstr :3000 # Check frontend port netstat -ano | findstr :8080 ``` ## Log Examples ### backend.log ``` [13:30:15.00] ======================================== [13:30:15.00] Starting backend service... INFO: Started server process [12345] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:3000 ``` ### frontend.log ``` [13:30:20.00] ======================================== [13:30:20.00] Starting frontend service... VITE v5.0.0 ready in 1234 ms ➜ Local: http://localhost:8080/ ➜ Network: use --host to expose ``` ## Notes 1. **First-time frontend startup**: If dependencies are not installed, the script will automatically run `npm install` 2. **Virtual environment**: Ensure backend uses Python virtual environment (venv) 3. **Firewall**: Ensure firewall allows ports 3000 and 8080 4. **Antivirus**: Some antivirus software may block scripts, need to add to whitelist ## Troubleshooting ### Backend Won't Start 1. Check if Python virtual environment is correctly installed 2. View `backend.log` log file 3. Confirm port 3000 is not in use 4. Check if dependency packages are complete: `venv\Scripts\pip list` ### Frontend Won't Start 1. Check if Node.js is installed: `node --version` 2. View `frontend.log` log file 3. Confirm port 8080 is not in use 4. Manually install dependencies: Enter frontend directory and run `npm install` ### Process Won't Stop 1. Manually find process: `tasklist | findstr python` 2. Force stop: `taskkill /F /IM python.exe` 3. Check port: `netstat -ano | findstr :3000` ## Advanced Usage ### Modify Ports - Backend: Modify port number in `api_server.py` - Frontend: Modify port number in `vite.config.js` - After modification, need to sync update port checking logic in scripts ### Custom Log Location - Modify `LOG_FILE` variable in scripts - Ensure directory exists and has write permissions ## Technical Support If you encounter issues, please check: 1. Log files (backend.log, frontend.log) 2. PID files (backend.pid, frontend.pid) 3. Port usage (netstat -ano) 4. Process list (tasklist)