A comprehensive web application for UI analysis, feature recommendations, and automatic webpage screenshot capture. Built with modern technologies including FastAPI, React, TypeScript, and AI-powered analysis.
- Features
- Prerequisites Checklist
- Configuration
- Installation
- Usage
- Troubleshooting Common Issues
- Testing Your Setup
- Project Structure Explained
- What Each Service Does
- URL Handling
- Common Mistakes to Avoid
- Getting Help
- Success!
- AI-Powered Analysis: Advanced feature review and analysis using OpenRouter AI models
- Scientific Research-Based Recommendations: Integration with FutureHouse API for research-backed UI improvements
- Interactive UI Components: Modern React components with real-time feedback
- Feature Extraction: Automatic detection and analysis of website UI sections
- Bounding Box Detection: Computer vision-powered element localization
- FutureHouse API: Scientific research-based recommendations
- Academic Paper References: Citations and research backing for all suggestions
- Evidence-Based Design: All recommendations backed by research data
Before starting, ensure you have:
- β Node.js (v16 or higher) - Download here
- β Python 3.11 (recommended) or Python 3.8+ - Download here
- β Git - Download here
- β Chrome browser installed (for screenshots)
# Check Node.js
node --version
# Check Python
python --version
# Check Git
git --versionCreate a .env file in the backend directory:
# AI Services
OPENROUTER_API_KEY=your_openrouter_api_key_here
FUTURE_HOUSE_API_KEY=your_futurehouse_api_key_here- Visit OpenRouter
- Create an account and get your API key
- Add to
.envfile
- Visit FutureHouse
- Sign up for research access
- Get your API key and add to
.env
git clone <your-repo-url>
cd pilot-replit-ux-craft# Install Node.js dependencies
npm install
# Verify installation
npm run buildcd backend# On macOS/Linux:
python -m venv venv
source venv/bin/activate
# On Windows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txt# This step is REQUIRED and often forgotten!
playwright install chromium# Test if everything is installed correctly
python -c "import playwright; print('β
Playwright installed')"
python -c "import fastapi; print('β
FastAPI installed')"cd backend
source venv/bin/activate # or venv\Scripts\activate on Windows
python run_screenshot_server.pyExpected output:
Starting Screenshot API Server...
Server will be available at: http://localhost:8001
API Documentation: http://localhost:8001/docs
cd backend
source venv/bin/activate # or venv\Scripts\activate on Windows
python main.pyExpected output:
INFO: Started server process
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000
cd pilot-replit-ux-craft # Go back to root directory
npm run devExpected output:
VITE v5.x.x ready in xxx ms
β Local: http://localhost:8080/
β Network: use --host to expose
# Check screenshot server
curl http://localhost:8001/health
# Check main API server
curl http://localhost:8000/health
# Check frontend (should show the website)
open http://localhost:8080cd backend
python test_screenshot.py- Open the Application: Navigate to http://localhost:8080
- Enter URL: Input a website URL in full format, starting with
https://
(e.g.,https://example.com).
β οΈ URLs withouthttps://will not be accepted. - Click Analyze: The system will automatically:
- Take a full-page screenshot
- Extract UI features and elements
- Review Results: View the screenshot alongside feature analysis
- Get Recommendations: Access scientific research-based improvement suggestions
- View Extracted Features: See all detected UI sections
- Interactive Screenshot: Hover over features to see bounding boxes
- Get Recommendations: Request research-backed improvements
- Chat with Features: Use AI-powered chatbots for specific advice
- Generate Code: Get implementation-ready code snippets
- React 18: Modern React with hooks and functional components
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- Vite: Fast build tool and dev server
- FastAPI: Modern, fast web framework for building APIs
- Python 3.11+: Latest Python with async support
- Playwright: Reliable browser automation
- Uvicorn: ASGI server for FastAPI
- OpenRouter: Access to multiple AI models (GPT-4, Claude, Mistral)
- FutureHouse: Scientific research database for UI/UX
- Computer Vision: AI-powered bounding box detection
- User Input: URL entered in frontend
- Screenshot Capture: Playwright takes full-page screenshot
- Feature Extraction: AI analyzes website structure
- Research Integration: FutureHouse provides scientific backing
- Recommendations: AI generates actionable improvements
- Results Display: Interactive UI shows analysis and suggestions
Cause: Missing Playwright browser installation OR URL not starting with https://
Solutions:
# Install Playwright browsers
cd backend
playwright install chromium
# Or check your URL format
# Valid format: "https://example.com"
### Issue 2: "Module not found" errors
**Cause:** Virtual environment not activated
**Solution:**
```bash
cd backend
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # WindowsCause: Another process is using the port Solution:
# Find and kill the process
lsof -ti:8001 | xargs kill -9 # macOS/Linux
# or
netstat -ano | findstr :8001 # WindowsCause: Chrome browser not installed or Playwright can't find it Solution:
# Reinstall Playwright browsers
playwright install --force chromiumCause: File permission issues Solution:
# Fix permissions
chmod +x start_screenshot_server.sh
mkdir -p screenshots
chmod 755 screenshotsCreate a file called test_setup.py in the backend directory:
#!/usr/bin/env python3
import requests
import time
def test_setup():
print("π§ͺ Testing your Auto UI setup...")
# Test screenshot server
try:
response = requests.get("http://localhost:8001/health", timeout=5)
if response.status_code == 200:
print("β
Screenshot server is running")
else:
print("β Screenshot server not responding correctly")
return False
except:
print("β Screenshot server not running")
return False
# Test screenshot functionality
try:
response = requests.post("http://localhost:8001/screenshot",
json={"url": "https://www.google.com"}, timeout=10)
if response.status_code == 200:
print("β
Screenshot functionality working")
else:
print(f"β Screenshot test failed: {response.status_code}")
return False
except Exception as e:
print(f"β Screenshot test error: {e}")
return False
print("π All tests passed! Your setup is working correctly.")
return True
if __name__ == "__main__":
test_setup()Run it:
cd backend
python test_setup.pypilot-replit-ux-craft/
βββ backend/ # Backend servers
β βββ main.py # Main API server (port 8000)
β βββ screenshot_server.py # Screenshot API server (port 8001)
β βββ requirements.txt # Python dependencies
β βββ venv/ # Python virtual environment
β βββ screenshots/ # Generated screenshots
β βββ run_screenshot_server.py # Screenshot server runner
βββ src/ # Frontend React application
β βββ components/ # React components
β βββ pages/ # Page components
βββ package.json # Node.js dependencies
βββ README.md # Original README
- Frontend (Port 8080): React web application
- Main API (Port 8000): Handles feature analysis and recommendations
- Screenshot Server (Port 8001): Takes screenshots of websites
All URLs must be entered in full format:
- β
https://example.com - β
www.example.com - β
example.com
This strict requirement ensures reliable analysis and avoids errors.
- β Forgetting to activate virtual environment
- β Not installing Playwright browsers
- β Starting services in wrong order
- β Using wrong Python version
- β Not checking if ports are available
If you're still having issues:
- Run the test script:
python test_setup.py - Check server logs: Look for error messages in the terminal
- Verify all prerequisites: Make sure Node.js, Python, and Chrome are installed
- Check network: Ensure no firewall is blocking localhost connections
Once everything is working, you should be able to:
- Visit http://localhost:8080
- Enter any website URL
- Click "Analyze" and see both analysis and screenshots
Remember: The most common cause of 422 errors is missing Playwright browser installation. Always run playwright install chromium after installing requirements!
Happy Analyzing! π