A modern Vite-based AR Fitness Tracker application with PeerJS support for side camera connections and WebSocket proxy support for connecting to local servers from Vercel deployments.
- ✅ Vite-based modern build system
- ✅ PeerJS integration for side camera WebRTC connections
- ✅ WebSocket proxy/tunnel support for local server connections
- ✅ Real-time pose detection and feedback
- ✅ Performance metrics tracking
- ✅ Responsive mobile and desktop UI
npm installnpm run generate-sslHTTP (standard):
npm run devThe app will be available at http://localhost:3000
HTTPS (recommended for camera access):
npm run dev:httpsThe app will be available at https://localhost:3000
Note: HTTPS is recommended for camera access and WebRTC connections. See HTTPS-SETUP.md for details.
npm run buildnpm install -g vercel
vercelThe app needs to connect to your local Python server (visualizer_server.py). There are two ways to configure this:
- Start your local server:
python AR/relay-server/visualizer_server.py - The app will auto-detect the server on
localhost:8080 - Or manually configure the WebSocket URL in Relay Settings
When deployed on Vercel, you need a WebSocket proxy/tunnel to connect to your local server:
-
Using ngrok:
ngrok http 8080 # Use the WebSocket URL: wss://your-tunnel.ngrok.io -
Using Cloudflare Tunnel:
cloudflared tunnel --url localhost:8080
-
Configure in App:
- Open Relay Settings
- Enter the proxy/tunnel URL in "Proxy/Tunnel URL" field
- Save configuration
- Open the app on your main AR device
- Click "Connect Side Camera"
- A Room ID will be generated and copied to clipboard
- Open the side camera device and connect using the Room ID
- The side camera stream will appear in the side view panel
vite-ar-app/
├── src/
│ ├── js/
│ │ ├── relay-config.js # Relay configuration management
│ │ ├── relay-connection.js # WebSocket connection with proxy support
│ │ └── side-camera-manager.js # PeerJS side camera manager
│ ├── main.js # Main entry point
│ └── styles.css # Application styles
├── index.html # Main HTML file
├── package.json # Dependencies
├── vite.config.js # Vite configuration
└── vercel.json # Vercel deployment config
The app supports connecting to local servers from Vercel deployments using:
- Proxy URL configuration
- Auto-detection for local development
- Fallback mechanisms
- Automatic peer ID generation
- Room-based connections
- Video and data channel support
- Automatic reconnection handling
-
Can't connect to relay server:
- Check if local server is running
- Verify WebSocket URL in Relay Settings
- For Vercel: Configure proxy/tunnel URL
-
Side camera not connecting:
- Ensure both devices are on the same network
- Check PeerJS server connectivity
- Verify Room ID is correct
-
Proxy connection fails:
- Ensure tunnel/proxy service is running
- Check WebSocket URL format (wss:// for secure)
- Verify firewall settings
- The app uses ES modules
- PeerJS is used instead of Firebase for signaling
- WebSocket connections support both direct and proxy modes
- All configuration is stored in localStorage
MIT