Skip to content

rajbreno/4PocketCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

$4 PocketCode

$4PocketCode

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.


What You Need

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!


πŸš€ Complete Setup Guide

Phase 1: Create Hetzner Server

  1. Open Chrome β†’ Go to hetzner.cloud (€20 free credits!)
  2. Create account or login
  3. 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
  1. Click Create & Buy Now (~$4/month)
  2. Wait 1-2 minutes
  3. Check your email for:
    • IP Address (like 123.45.67.89)
    • Root Password

⚠️ CRITICAL: SAVE YOUR PASSWORD!
There is NO "forgot password" option for servers.
Screenshot it or save in a password manager immediately.


Phase 2: Connect from Termux

Open Termux and install SSH:

pkg update && pkg install openssh -y

Connect to your server:

ssh root@YOUR_SERVER_IP
  • Replace YOUR_SERVER_IP with IP from email (e.g., ssh root@123.45.67.89)
  • Type yes when asked about fingerprint
  • Paste password from email (it won't show as you type β€” that's normal)

βœ… You're now on your server!


Phase 3: Run Setup Script

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!"


Phase 4: Connect Tailscale VPN

Still on server, run:

tailscale up

A URL appears like:

https://login.tailscale.com/a/abc123...
  1. Long press the URL β†’ Copy
  2. Open Chrome β†’ Paste URL
  3. Login with Google/GitHub/email
  4. 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.


Phase 5: Setup Tailscale on Phone

  1. Open Tailscale app on your phone
  2. Login with the SAME account you just used
  3. Toggle Active to ON
  4. You should see your server listed

⚠️ MUST use same account! Different accounts = devices can't see each other.


Phase 6: Connect from Termux

Exit the server:

exit

Back in Termux (on phone), setup quick connect:

Option A: Quick Connect (Recommended)

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

Option B: Manual (Use IP Directly)

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.


πŸ“± Daily Workflow

Starting Your Session

  1. Open Tailscale β†’ Make sure it says "Active"
  2. Open Termux β†’ Connect:
ssh dev
  1. Always use tmux (keeps session alive even if Termux closes):
tmux new -s work

Returning later? Use: tmux attach

  1. Start coding:
cd ~/projects
opencode

Using Web Interface

opencode-web

Then open Chrome β†’ http://YOUR_TAILSCALE_IP:4096

When You're Done

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.


πŸ“ Edit Code with Acode

  1. Open Acode
  2. Tap Files (bottom bar) β†’ + β†’ FTP/SFTP
  3. 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
  1. Tap Save then Connect

βœ… Now edit files on server directly!


πŸ› οΈ Creating Projects

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_IP with your Tailscale IP (e.g., 100.64.0.1)


πŸ’Ύ Saving to GitHub

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

πŸ”§ Troubleshooting

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

πŸ’° Cost Breakdown

Service Cost
Hetzner CX22 ~$4/month
Tailscale Free
Termux, Acode Free
Total ~$4/month

πŸ“‹ Quick Reference

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.

About

Run AI coding agents (OpenCode, Claude Code, Gemini CLI) on Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages