π Remote Deployment β HTTP Mode β
Run Piggy on a VPS and connect from anywhere. No more keeping your laptop running 24/7.
Overview β
Piggy headless binary can run in HTTP mode β a secure API server on port 2005. Connect from any machine using your generated API key.
| Mode | Transport | Use Case |
|---|---|---|
| Socket (default) | Unix socket / Windows pipe | Local development, same machine |
| HTTP | TCP port 2005 + API key | Remote VPS, cloud deployment, team access |
β οΈ Headful binary does NOT support HTTP mode. Only
nothing-browser-headlesscan run as an HTTP server.
First-Time Setup β
Step 1: Run the Binary β
./nothing-browser-headlessStep 2: Choose HTTP Mode β
Mode? (socket/http): httpStep 3: Enter a Session Name β
Session name: my-production-serverThe session name can be anything β spaces are allowed.
Step 4: Copy Your Key β
Session : my-production-server
Key : peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d
Saved to: /home/user/my-scraper/my-production-server.piggy
β οΈ Keep your key safe β it will not be shown again.
To reset: delete my-production-server.piggy and restart.Your key is shown ONCE. Copy it immediately and save it somewhere safe (.env file, password manager, etc.)
Step 5: Verify It's Running β
[Piggy] HTTP API ready on port 2005Key File β
The key is also saved to {session-name}.piggy next to your binary:
{
"name": "my-production-server",
"key": "peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d",
"created": "2026-04-26T10:00:00"
}You can read it anytime:
cat my-production-server.piggyConnecting from TypeScript β
Local Connection β
import piggy from "nothing-browser";
await piggy.connect({
host: "http://localhost:2005",
key: "peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d"
});
// Now use piggy normally
await piggy.register("amazon", "https://amazon.com");
await piggy.amazon.navigate();Remote VPS Connection β
await piggy.connect({
host: "http://your-vps-ip:2005",
key: "peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d"
});Using Environment Variable β
// .env
PIGGY_HOST=http://your-vps-ip:2005
PIGGY_KEY=peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d
// your code
await piggy.connect({
host: process.env.PIGGY_HOST,
key: process.env.PIGGY_KEY
});Testing Your Connection β
The simplest test β send "hello" to confirm the server is alive:
curl -X POST http://your-vps:2005 \
-H "X-Piggy-Key: peaseernestbd7436aecf7041a39532a03308b8ee3350495f3cdb534b8294f9d" \
-d "hello"Correct key response:
Hello! I am active. Start scraping.Wrong or missing key:
{"ok": false, "error": "Unauthorized β invalid or missing X-Piggy-Key"}Deploying on a VPS β
Step 1: Upload the Binary β
scp nothing-browser-headless user@your-vps:/home/user/piggy/Step 2: SSH In and Run First-Time Setup β
ssh user@your-vps
cd /home/user/piggy
chmod +x nothing-browser-headless
./nothing-browser-headlessFollow the prompts β choose HTTP mode, enter a session name, copy your key.
Step 3: Run in Background β
nohup ./nothing-browser-headless > piggy.log 2>&1 &Step 4: Check It's Running β
tail -f piggy.log
# Should see: [Piggy] HTTP API ready on port 2005Step 5: Open Firewall Port β
# Ubuntu / Debian
sudo ufw allow 2005
# CentOS / RHEL
sudo firewall-cmd --permanent --add-port=2005/tcp
sudo firewall-cmd --reloadStep 6: Connect from Your Code β
Use the VPS IP address and the key you saved.
Managing the Remote Process β
Stop the Server β
pkill nothing-browser-headlessRestart β
pkill nothing-browser-headless
nohup ./nothing-browser-headless > piggy.log 2>&1 &Check if Running β
pgrep -f nothing-browser-headless
# Returns PID if runningView Logs β
tail -f piggy.logAuto-Start with systemd (Optional) β
Create /etc/systemd/system/piggy.service:
[Unit]
Description=Piggy Headless Browser
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/home/your-user/piggy
ExecStart=/home/your-user/piggy/nothing-browser-headless
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable piggy
sudo systemctl start piggy
sudo systemctl status piggyResetting Your Key β
If you lose your key or want to generate a new one:
# 1. Stop the binary
pkill nothing-browser-headless
# 2. Delete the key file
rm my-production-server.piggy
# 3. Restart β you'll be prompted again
./nothing-browser-headlessYour old key will no longer work. Update your code with the new key.
File Structure After First Run β
/home/user/piggy/
βββ nothing-browser-headless
βββ my-production-server.piggy β KEY FILE (keep safe!)
βββ identity.json β browser fingerprint (auto-generated)
βββ cookies.json β persistent cookies (auto-created)
βββ profile.json β browser settings (auto-created)
βββ ws.json β WebSocket frames (opt-in)
βββ pings.json β ping log (opt-in)Security Best Practices β
| Practice | Why |
|---|---|
| Use environment variables | Never hardcode keys in source code |
| Rotate keys periodically | Delete .piggy file and regenerate |
| Use firewall | Restrict port 2005 to trusted IPs only |
| Run as non-root user | Never run as root |
| Use HTTPS proxy | Put nginx with SSL in front for production |
| Monitor logs | Watch for unauthorized access attempts |
Restrict to Specific IPs (UFW) β
# Allow only your office IP
sudo ufw allow from 123.456.789.0 to any port 2005
# Deny everyone else
sudo ufw deny 2005Limitations β
| Limitation | Explanation |
|---|---|
| Headless only | HTTP mode only works with nothing-browser-headless |
| No HTTPS | Use nginx as a reverse proxy for SSL termination |
| No built-in auth beyond key | Key is the only authentication |
| Single session per binary | One key, one session per running binary |
Troubleshooting β
"Connection refused" β
Cause: Server not running or wrong port
Fix:
# Check if running
pgrep -f nothing-browser-headless
# Check port
netstat -tlnp | grep 2005"Unauthorized β invalid X-Piggy-Key" β
Cause: Wrong key or key file deleted
Fix:
# Check your key file
cat *.piggy
# Or regenerate
rm *.piggy
./nothing-browser-headless"Address already in use" β
Cause: Another process on port 2005
Fix:
# Find and kill
lsof -i :2005
kill -9 <PID>Binary starts but no HTTP β
Cause: You chose socket mode by accident
Fix: Delete the key file and restart, choose "http" this time.
API Reference β
Connection Methods β
| Method | Description |
|---|---|
piggy.connect({ host, key }) | Connect to remote Piggy HTTP server |
piggy.close() | Disconnect from server |
Connection Options β
interface ConnectOptions {
host: string; // http://localhost:2005 or http://your-vps:2005
key: string; // Your 64-character key (starts with "peaseernest")
}Next Steps β
- Proxy Support β Route traffic through proxies, rotate IPs
- Session Persistence β Save WebSocket frames and pings
- Identity & Profile β Understand fingerprint files
- Cookies Hot Reload β Edit cookies while browser runs
Nothing Ecosystem Β· Ernest Tech House Β· Kenya Β· 2026