← ClaudeAtlas

setup-cloudflaredlisted

Set up a Cloudflare tunnel to expose Metro (port 8081) over HTTPS for remote React Native / Expo dev. Covers macOS/Linux (quick + named tunnels via npm scripts) and Windows (system service with SYSTEM profile config). Use when the user wants to connect a phone to Metro over a tunnel, configure a stable hostname, add Metro to an existing cloudflared service, or troubleshoot tunnel routing issues.
RonenMars/threadbase-mobile · ★ 4 · DevOps & Infrastructure · score 70
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