From 81468063ffd1fec58e8e360d12ab48f2f711d6c2 Mon Sep 17 00:00:00 2001 From: cynarAI <155274210+cynarAI@users.noreply.github.com> Date: Fri, 9 Oct 2026 10:10:22 +0200 Subject: [PATCH] Add LAN dev helper for iPhone against local Mac API (#181) Co-authored-by: Cursor Agent Co-authored-by: cynarAI Co-authored-by: Claude --- docs/LOCAL-SETUP.md | 13 +++++++++ scripts/dev-mobile-lan.sh | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100755 scripts/dev-mobile-lan.sh diff --git a/docs/LOCAL-SETUP.md b/docs/LOCAL-SETUP.md index 33682e4..b2a6fe0 100644 --- a/docs/LOCAL-SETUP.md +++ b/docs/LOCAL-SETUP.md @@ -79,6 +79,19 @@ Desktop: pnpm --filter @rakazo/desktop dev ``` +### iPhone on the same Wi‑Fi (Mac LAN) + +The mobile app can talk to a self-hosted API over **HTTP** on your local network. The API must listen on all interfaces, not only loopback. + +```bash +# sets API_HOST=0.0.0.0 in .env, prints the URL, starts pnpm dev +bash scripts/dev-mobile-lan.sh +``` + +On the iPhone: open evOo → **Custom server** on sign-in → `http://:3100` (the script prints the IP). Allow **Local Network** when iOS asks. + +Optional dev client: `pnpm --filter @rakazo/mobile start` and scan the QR code with Expo Go (you still set the custom server URL in the app). + ## 5. Local models / Ollama seed ```bash diff --git a/scripts/dev-mobile-lan.sh b/scripts/dev-mobile-lan.sh new file mode 100755 index 0000000..d005c7d --- /dev/null +++ b/scripts/dev-mobile-lan.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Start dev stack with the API reachable from an iPhone on the same LAN. +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT" + +if [[ ! -f .env ]]; then + echo "Missing .env — run: cp .env.example .env and fill secrets." >&2 + exit 1 +fi + +set_env_var() { + local key="$1" + local value="$2" + if grep -q "^${key}=" .env; then + perl -pi -e "s/^\\Q${key}=\\E.*/${key}=${value}/" .env + else + printf '\n%s=%s\n' "$key" "$value" >> .env + fi +} + +lan_ipv4() { + local os ip iface + os="$(uname -s)" + if [[ "$os" == Darwin ]]; then + for iface in en0 en1 bridge100; do + ip="$(ipconfig getifaddr "$iface" 2>/dev/null || true)" + if [[ -n "$ip" ]]; then + echo "$ip" + return 0 + fi + done + return 1 + fi + if command -v ip >/dev/null 2>&1; then + ip route get 1.1.1.1 2>/dev/null | awk '{for (i=1;i<=NF;i++) if ($i=="src") { print $(i+1); exit }}' + return 0 + fi + hostname -I 2>/dev/null | awk '{print $1}' +} + +set_env_var API_HOST "0.0.0.0" + +IP="$(lan_ipv4 || true)" +PORT="${API_PORT:-3100}" + +echo "" +echo "evOo LAN (iPhone / iPad)" +echo " 1. Same Wi‑Fi as this machine; allow incoming TCP ${PORT} in the firewall." +echo " 2. In the evOo app: Sign in → Custom server" +if [[ -n "$IP" ]]; then + echo " 3. Server URL: http://${IP}:${PORT}" +else + echo " 3. Server URL: http://:${PORT}" + echo " (Could not detect LAN IP — check System Settings → Network.)" +fi +echo "" +echo "Starting pnpm dev …" +exec pnpm dev