Run AI coding agents (OpenCode, Claude Code, Gemini CLI) in just $4 entirely from your phone.
Why Cloud over Local?
- Enough Power - 2 vCPU, 4GB RAM, 40GB SSD
- Always On - Server runs 24/7, keeps your dev environment ready
- No Storage Worries - Phone storage stays free
- Private & Secure - Tailscale VPN, no open ports
Works with OpenCode, Claude Code, Codex, and Gemini CLI.
This guide uses OpenCode.
| App | Link | Purpose |
|---|---|---|
| Termux | Play Store | Terminal for SSH |
| Tailscale | Play Store | Secure VPN tunnel |
| Acode | Play Store | Code editor |
| Hetzner | hetzner.cloud | Server (~$4/month) |
π‘ Get β¬20 free credits from Hetzner β referral from Dokploy docs, not mine - here to help you save!
- Open Chrome β Go to hetzner.cloud (β¬20 free credits!)
- Create account or login
- Click + Add Server
Configure your server:
| Setting | Value |
|---|---|
| Location | Ashburn (US) or Falkenstein (Germany) |
| Image | Ubuntu 24.04 |
| Type | Shared vCPU β CX22 |
| Networking | β Public IPv4 (required!) |
| SSH Keys | Skip for now |
- Click Create & Buy Now (~$4/month)
- Wait 1-2 minutes
- Check your email for:
- IP Address (like
123.45.67.89) - Root Password
- IP Address (like
β οΈ CRITICAL: SAVE YOUR PASSWORD!
There is NO "forgot password" option for servers.
Screenshot it or save in a password manager immediately.
Open Termux and install SSH:
pkg update && pkg install openssh -y
Connect to your server:
ssh root@YOUR_SERVER_IP
- Replace
YOUR_SERVER_IPwith IP from email (e.g.,ssh root@123.45.67.89) - Type
yeswhen asked about fingerprint - Paste password from email (it won't show as you type β that's normal)
β You're now on your server!
Paste this single command:
curl -sL https://raw.githubusercontent.com/rajbreno/4PocketCode/main/setup.sh | bash
What it installs:
- Docker, Git, Python, build tools
- Node.js (via NVM) + nodemon
- Tailscale VPN
- OpenCode AI
Wait ~5 minutes until you see "β Setup Complete!"
Still on server, run:
tailscale up
A URL appears like:
https://login.tailscale.com/a/abc123...
- Long press the URL β Copy
- Open Chrome β Paste URL
- Login with Google/GitHub/email
- Click Connect
Get your Tailscale IP:
tailscale ip -4
You'll see something like 100.64.0.1 β SAVE THIS! This is your Tailscale IP.
π‘ Why Tailscale?
Your Tailscale IP (100.x.x.x) creates a secure tunnel between your phone and server.
No one else can access it, even without a firewall.
- Open Tailscale app on your phone
- Login with the SAME account you just used
- Toggle Active to ON
- You should see your server listed
β οΈ MUST use same account! Different accounts = devices can't see each other.
Exit the server:
exit
Back in Termux (on phone), setup quick connect:
Create a shortcut so you only type ssh dev:
mkdir -p ~/.ssh && cat > ~/.ssh/config << EOF
Host dev
HostName YOUR_TAILSCALE_IP
User root
EOF
Replace YOUR_TAILSCALE_IP with your Tailscale IP (e.g., 100.64.0.1).
Connect:
ssh dev
If you prefer typing the full IP each time:
ssh root@YOUR_TAILSCALE_IP
Example: ssh root@100.64.0.1
β Setup Complete! You can now code from anywhere.
- Open Tailscale β Make sure it says "Active"
- Open Termux β Connect:
ssh dev
- Always use tmux (keeps session alive even if Termux closes):
tmux new -s work
Returning later? Use: tmux attach
- Start coding:
cd ~/projects
opencode
opencode-web
Then open Chrome β http://YOUR_TAILSCALE_IP:4096
Turn off Tailscale to save battery:
- Open Tailscale app β Toggle Active OFF
π‘ Your server keeps running 24/7. Tailscale only needs to be ON when you want to connect from your phone.
- Open Acode
- Tap Files (bottom bar) β + β FTP/SFTP
- Fill in:
| Field | Value |
|---|---|
| Name | Dev Server |
| Protocol | SFTP |
| Host | Your Tailscale IP (100.x.x.x) |
| Port | 22 |
| User | root |
| Password | Your server password |
| Path | /root/projects |
- Tap Save then Connect
β Now edit files on server directly!
Make new project:
cd ~/projects
mkdir my-app && cd my-app
npm init -y
Preview your work:
| Stack | Command | URL |
|---|---|---|
| Static HTML | npx serve |
http://TAILSCALE_IP:3000 |
| Vite / React | npm run dev -- --host |
http://TAILSCALE_IP:5173 |
| Next.js | npm run dev -- -H 0.0.0.0 |
http://TAILSCALE_IP:3000 |
| Express | nodemon server.js |
http://TAILSCALE_IP:3000 |
Replace
TAILSCALE_IPwith your Tailscale IP (e.g.,100.64.0.1)
One-time SSH key setup:
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 && cat ~/.ssh/id_ed25519.pub
Copy the output β Add to github.com/settings/keys
Push your project:
cd ~/projects/my-app
git init
git add .
git commit -m "Initial commit"
git remote add origin git@github.com:YOUR_USERNAME/my-app.git
git push -u origin main
| Problem | Fix |
|---|---|
ssh dev says "Connection refused" |
Open Tailscale app β Toggle Active ON |
| Password not working | Use the password from email, not your Hetzner account password |
| Can't paste password in terminal | It's pasting, just not showing. Press Enter after pasting |
nvm: command not found |
Run: source ~/.bashrc then try again |
| Session lost after closing Termux | Use tmux attach to reconnect |
| "Address already in use" | Run: pkill node |
| Server not in Tailscale list | On server: tailscale status to check |
| Service | Cost |
|---|---|
| Hetzner CX22 | ~$4/month |
| Tailscale | Free |
| Termux, Acode | Free |
| Total | ~$4/month |
Connect:
ssh dev
Start session:
tmux attach || tmux new -s work
Code:
cd ~/projects/my-app && opencode
Web UI:
opencode-web
# Open: http://TAILSCALE_IP:4096
Made with β€οΈ for mobile developers who want real power.
