setup-cloudflaredlisted
Install: claude install-skill RonenMars/threadbase-mobile
# setup-cloudflared
Sets up a Cloudflare tunnel to expose Metro bundler (port 8081) over HTTPS so
a physical device can connect without sharing the same Wi-Fi.
## How it works
`EXPO_PACKAGER_PROXY_URL` is set at Metro startup. Expo advertises that URL
to the app instead of the local LAN IP. The app fetches its JS bundle through
the tunnel — device and dev machine no longer need to share a network.
**Key constraint:** tunnel and Metro must run on the **same machine** (the
tunnel proxies `localhost:8081`).
## Project config files
- `.cloudflared/config.example.yml` — committed template (like `.env.example`)
- `.cloudflared/config.yml` — gitignored, real values for your machine
Copy the example, fill in tunnel ID and hostname, then follow the platform
steps below.
---
## macOS / Linux
### Quick tunnel (no account, temporary URL)
`npm run dev:tunnel` handles everything automatically:
1. Spins up a dummy HTTP listener on 8081 (so cloudflared doesn't exit).
2. Launches cloudflared, waits for the `*.trycloudflare.com` URL.
3. Kills the dummy listener.
4. Starts Metro with `EXPO_PACKAGER_PROXY_URL` set.
```bash
npm run dev:tunnel # JS-only
npm run dev:tunnel -- -c # clear Metro cache
DEVICE_UDID=<udid> npm run dev:tunnel:native # full native rebuild
```
### Named tunnel (stable hostname)
```bash
CLOUDFLARED_TUNNEL_NAME=<name> npm run dev:tunnel
```
One-time DNS setup:
```bash
cloudflared tunnel create <name>
# Use the UUID