Amp-Thread-ID: https://ampcode.com/threads/T-a6cf4bd2-36d0-4ef8-ada6-a8e2850fcacf Co-authored-by: Amp <amp@ampcode.com>
2.1 KiB
2.1 KiB
🚀 Start FleetCode Web Server
Quick Start
# 1. Enter Nix development environment
nix develop
# 2. Install dependencies (first time only)
npm install
# 3. Start the web server
npm run server
Access the Application
From This Machine
http://localhost:3000
From Network (LAN)
Your server will be accessible at:
http://192.168.1.240:3000
From Internet
See WEB_SERVER_SETUP.md for remote access options.
Server Commands
# Default port (3000)
npm run server
# Custom port
PORT=8080 npm run server
# Build only (without starting)
npm run build
What's Running?
- HTTP Server: Express on port 3000 (or custom PORT)
- WebSocket: Socket.IO for real-time terminal communication
- Static Files: Serves index.html and compiled assets
- Terminal Backend: node-pty for terminal session management
Stopping the Server
Press Ctrl+C in the terminal where the server is running.
Troubleshooting
"Port already in use"
# Use different port
PORT=8080 npm run server
# Or find and kill process using port 3000
lsof -ti:3000 | xargs kill -9
"Cannot find module" errors
# Reinstall dependencies
npm install
# Rebuild native modules for Node.js
npm rebuild node-pty --update-binary
Can't access from network
# Check firewall (NixOS)
sudo iptables -L | grep 3000
# Temporarily open port
sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
Next Steps
- ✅ Server is running locally
- 📱 Access from your phone/tablet on same network:
http://192.168.1.240:3000 - 🌍 Set up remote access (see WEB_SERVER_SETUP.md)
- 🔐 Add authentication before exposing to internet
- 🔒 Configure HTTPS with reverse proxy
Files Created
server.ts- Web server implementationWEB_SERVER_SETUP.md- Detailed setup guideflake.nix- Updated with web server commands
Architecture
Browser (Any Device)
↓ HTTP/WebSocket
Express Server (port 3000)
↓ Socket.IO
Terminal Sessions (node-pty)
↓
Git Worktrees + Claude/Codex
Enjoy FleetCode! 🎉