# Local Testing - Bagsy on iPhone 16 Quick guide to test Bagsy locally on your Mac and iPhone 16. ## Setup (One-time) ### Prerequisites - Mac with Xcode (or `xcode-select --install`) - iPhone 16 (or iOS Simulator) - `bun` package manager - `eas-cli`: `npm install -g eas-cli` - Expo account (free, sign up at expo.dev) ## Testing Workflow ### Step 1: Start Backend (Terminal 1) ```bash cd apps/api bun run dev ``` Server runs on `http://localhost:3001` ### Step 2: Build for Device (Terminal 2) **Option A: Cloud Build (RECOMMENDED - Fastest)** ```bash cd apps/mobile bun run build:dev:ios ``` - Builds in the cloud (no local setup needed) - Download `.ipa` from https://expo.dev/builds - Sideload with Transporter or Apple Configurator 2 - See `docs/iOS_SIDELOADING_GUIDE.md` for detailed instructions **Option B: Local Prebuild (Xcode)** ```bash cd apps/mobile bun run prebuild pod install --repo-update # If needed open ios/Bagsy.xcworkspace ``` Then in Xcode: 1. Select **Bagsy** target → **Signing & Capabilities** 2. Set **Team** to your Apple ID 3. Connect iPhone, select in scheme 4. Click **Play** (Cmd+R) See `apps/mobile/PREBUILD_STATUS.md` for current build status. ### Step 3: Install on iPhone **Cloud Build (.ipa file):** - Use Transporter or Apple Configurator 2 - See `docs/iOS_SIDELOADING_GUIDE.md` for detailed instructions **Local Prebuild (via Xcode):** - Xcode handles installation automatically ### Step 4: Trust App (if prompted) On iPhone: 1. Settings → General → VPN & Device Management 2. Tap your Apple ID 3. **Trust** the app ## What You Can Test ✅ Icon (Bagsy with shopping bag) ✅ Auth (sign-up, sign-in, passkey) ✅ Lists (create, edit, delete) ✅ Items (add, check off, remove) ✅ Real-time sync ✅ Camera/barcode scanning ✅ Device performance ## Troubleshooting | Issue | Fix | | ------------------------ | -------------------------------------------------- | | Backend won't start | Check port 3001: `lsof -i :3001` | | Can't connect to backend | Verify WiFi, check `EXPO_PUBLIC_API_URL` in `.env` | | Prebuild fails | Use cloud build (`bun run build:dev:ios`) | | App won't install | Make sure you trust it in iPhone Settings | | Blank screen | Check Xcode console for errors | ## Key Files - Backend: `apps/api/` - Mobile: `apps/mobile/` - Backend env: `apps/api/.env.local` - Mobile env: `apps/mobile/.env` - Sideloading guide: `docs/iOS_SIDELOADING_GUIDE.md` - EAS config: `eas.json` ## Next Steps 1. Test locally to verify everything works 2. When ready: Deploy to App Store via `bun run build:ios` 3. For beta testing: Use TestFlight (see `docs/iOS_SIDELOADING_GUIDE.md`)