- Published on
Coding from the iPad with Headscale and T3 Code
- Authors

- Name
- Avasdream
- @avasdream_
I wanted to code from the iPad without handing the repository to a cloud IDE. Not because cloud IDEs are bad. I just want the machine that has the keys, the containers, and the half-broken local setup that actually builds the project.
I used Headscale for the private mesh, T3 Code for the coding server, and the Tailscale app on the iPad and iPhone. No Tailscale account. No public port for T3.
What you need
You need a small VPS with a public IPv4, a domain or a subdomain of one, a Linux dev machine with the repository, and the Tailscale app on the iPad and iPhone. An afternoon helps.
I used a 2 vCPU Hetzner box in Helsinki running Ubuntu 24.04. Headscale is light; the box does not need to be big. The dev machine is the one you already have.
The control plane
Headscale is a Tailscale control server. It hands out IPs and approves nodes. It also keeps the mesh's keys. It does not relay traffic unless you enable the embedded DERP, and it does not give you Tailscale's admin console or Funnel/Serve. You run the thing yourself.
Install the v0.29.7 DEB from the release page, then edit /etc/headscale/config.yaml. The lines I changed:
server_url: https://headscale.example.com
listen_addr: ":443"
acme_email: "you@example.com"
tls_letsencrypt_hostname: "headscale.example.com"
tls_letsencrypt_challenge_type: HTTP-01
tls_letsencrypt_listen: ":80"
dns:
magic_dns: true
base_domain: vpn.example.com
derp:
server:
enabled: true
region_id: 999
region_code: headscale
region_name: hel1
stun_listen_addr: ":3478"
private_key_path: /var/lib/headscale/derp_server_private.key
automatically_add_embedded_derp_region: true
ipv4: 203.0.113.10
ipv6: 2001:db8::10
The ipv4 and ipv6 values are the public addresses of the VPS; replace the documentation ranges with yours. The key path just needs to be writable by the service.
Add one A record for headscale.example.com, pointed at the VPS and set to DNS-only. The MagicDNS suffix (vpn.example.com) is a name the mesh resolves internally; it does not need a public record. Keep the coordinator outside that suffix. If Headscale lives under vpn.example.com, the mesh will try to resolve the control plane through the mesh it has not joined yet.
Create the user and a pre-auth key:
headscale users create owner
headscale preauthkeys create --user owner --expiration 30m
Then systemctl enable --now headscale. Check that https://headscale.example.com/health returns {"status":"pass"} before you touch the phone.
Put the iPad on the mesh
Install the Tailscale app. On the first screen, do not sign in with Google or Apple. Open the login options, choose "Use custom coordination server", and enter https://headscale.example.com.
The app will look like it loads and then stops. That is normal. It has created a node and is waiting for you to approve it. The server log shows the auth ID. Approve it:
headscale auth register --user owner --auth-id hskey-authreq-...
Do the same on the iPhone. Rename the nodes while you are in there, so the T3 machine list is not a row of localhost. My IDs were 1 and 3; yours will differ:
headscale nodes rename ipad --identifier 1
headscale nodes rename iphone --identifier 3
Each device gets a 100.64.0.x address. tailscale ping between them should work. If it does not, the devices are not on the same mesh yet, and the rest of this will not work.
The coding server
T3 Code is an agent server. It runs on the machine with your code, and the app is a remote control. Install it on the dev machine:
curl -fsSL https://t3.codes/install.sh | sh
Start it in LAN mode so the tailnet can reach it:
t3 up --lan
The server binds 0.0.0.0:3773. A bind address is not the same as a public port. On my machine the port is not publicly reachable; the public services are Headscale (80 and 443) and SSH on 22. If you want to be strict, bind T3 to the tailnet address or firewall 3773 to the tailnet interface. Check it from another network before you trust it.
Create a pairing link:
t3 pair --ttl 1h
Open the printed URL in the T3 app on the iPad. The link is the only lock. Treat it like a password, and do not leave it in a shell history you share.
T3 can run as a user service:
t3 service install
systemctl --user enable --now t3code
If the service should keep running after you log out, enable lingering: loginctl enable-linger $USER.
The provider that is not in the list
This is where I lost an hour. T3's Providers page lists the providers that are already configured. It is not a catalog. Hitting "Refresh" only re-checks the providers in the list; it will not add OpenCode.
OpenCode is in the "Add provider" dialog. On the web or desktop UI, go to Settings → Providers → Add provider, pick OpenCode, and step through. The web UI is the same server on port 3773; open http://<tailnet-ip>:3773 and pair with the same link. The mobile app may not expose the provider setup at all, so use the web UI on the iPad or a laptop for this part.
The server needs OpenCode 2.0.18 or newer (1.14.19+ on the 1.x line). If you have not used OpenCode yet, run opencode auth login and pick a provider. Check the version:
opencode --version
If the service cannot see the binary, do not guess. Give the provider an absolute path and make sure the systemd unit's PATH includes the directory. In the provider settings, use something like /home/you/.opencode/bin/opencode, not just opencode.
Leave the Server URL blank. T3 will start the OpenCode server itself. If you already run one, put its URL and password in. Then refresh the provider status.
If the Add dialog says the instance ID is taken, use a different one. opencode-local works.
Using it
Open T3 on the iPad, pick the project, and start a thread. The agent runs on the dev box; the iPad sends text and shows the diff. The keyboard shortcuts are the part that still feels odd, but the loop is the same as sitting at the desk.
The web UI and the app are both clients of the same server. The web UI is where you configure providers; the app is where you actually work. Both are reachable only over the tailnet. To check the exposure, scan the public IP from another host. You should see 443 for Headscale and 22 for SSH if you still expose it. Port 3773 should not answer.
What I would do differently
I would write the provider step down before starting. The mesh and the server are mostly waiting for DNS and certificates. The provider is the part with the non-obvious UI. "Add provider" is not "Refresh".
I would also keep the Headscale hostname outside the MagicDNS suffix from the start. It is a one-line mistake that costs a confusing hour.
And I would keep the T3 port off the public internet. The mesh is the only thing that needs a route from outside. The code stays on the dev box.