App for tracking/logging participation in CHEER's Long Branch Gardener Program and uploading harvest data.
For project purpose, architecture overview, and history, see README.adoc. For known bugs and stabilization work, see docs/quick-fixes-bundle-prd.md and docs/quick-fixes-bundle-techspec.md.
| Layer | Technology | Version |
|---|---|---|
| Framework | Expo (SDK 55) | ^55.0.4 |
| React Native | react-native | 0.83.2 |
| React | react | 19.2.0 |
| TypeScript | typescript | ~5.9.2 |
| JS Engine | Hermes | default |
| Router | expo-router | ~55.0.3 |
| Backend | Firebase (Auth, Firestore, RTDB, Storage, Hosting) | ^11.2.0 |
| i18n | i18n-js | ^4.4.3 |
| Platform | Identifier |
|---|---|
| iOS Bundle ID | com.communitycheer.gardner-harvesting |
| Android Package | com.communitycheer.gardner_harvesting |
| iOS Min Deployment | 15.1 (Podfile) |
| Android Compile/Target SDK | 35 |
This guide assumes macOS. Install each tool if you don't already have it.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"After install, follow the printed instructions to add Homebrew to your PATH. Verify:
brew --versionOption A — Homebrew:
brew install nodeOption B — nvm (recommended if you work on multiple Node projects):
brew install nvm
# follow the shell config instructions nvm prints
nvm install 18
nvm use 18Verify:
node -v # should print v18.x or newer
npm -v # ships with NodeRecommended by React Native for efficient file watching:
brew install watchman- Install from the Mac App Store.
- Open Xcode once to accept the license agreement and install additional components.
- Install Command Line Tools:
xcode-select --install- Point
xcode-selectat the full Xcode app (required for iOS Simulator and native builds):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer- Verify:
xcode-select -p
# MUST print: /Applications/Xcode.app/Contents/Developer
#
# If it prints /Library/Developer/CommandLineTools instead, you have
# only the standalone CLI tools selected — iOS builds will fail.
# Re-run the sudo xcode-select -s command above after installing Xcode.app.- In Xcode → Settings → Locations, confirm the Command Line Tools dropdown is set to the installed Xcode version.
Required for iOS native dependencies. EAS cloud builds use the CocoaPods version bundled with the build image (no pin — see eas.json). Any recent version works locally.
Recommended — install via Homebrew (avoids Ruby version issues):
brew install cocoapods
pod --versionWhy not
gem install? macOS ships with Ruby 2.6, which is too old for recent CocoaPods dependencies (e.g.,ffirequires Ruby >= 3.0). Usingbrew install cocoapodssidesteps this entirely. If you prefer the gem route, first install a modern Ruby viabrew install rubyorrbenv.
- Download and install Android Studio.
- During setup (or via Settings → Languages & Frameworks → Android SDK), install:
- SDK Platform: Android 15 (API 35) — matches
compileSdkVersion/targetSdkVersionin app.json. - SDK Tools: Android SDK Build-Tools, Android Emulator, Android SDK Platform-Tools.
- SDK Platform: Android 15 (API 35) — matches
- Set environment variables in your shell profile (
~/.zshrc):
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools- Restart your terminal and verify:
adb --version
emulator -list-avdsAndroid Studio bundles a JDK, but if you need a standalone install (Expo recommends JDK 17):
brew install --cask zulu17Verify:
java -version # should print 17.xExpo Application Services CLI for cloud builds and submissions. Minimum version 10.0.2 (per eas.json):
npm install -g eas-cli
eas --version # should print >= 10.0.2
eas login # log in with your Expo accountNeeded for web deployment to Firebase Hosting:
npm install -g firebase-tools
firebase --version
firebase login # authenticates with your Google accountNo global install needed — invoked via npx:
npx expo --versiongit clone https://github.com/CommunityCHEER/gardner-harvesting.git
cd gardner-harvesting
npm installThe native Firebase config reads credentials from environment variables. A template is provided:
cp .env.example .envOpen .env and fill in the six values:
| Variable | Where to find it |
|---|---|
EXPO_PUBLIC_FIREBASE_API_KEY |
Firebase Console → Project Settings → General → Your apps → Web app → apiKey |
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN |
Same location → authDomain |
EXPO_PUBLIC_FIREBASE_PROJECT_ID |
Same location → projectId |
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET |
Same location → storageBucket |
EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID |
Same location → messagingSenderId |
EXPO_PUBLIC_FIREBASE_APP_ID |
Same location → appId |
How to navigate there:
- Go to Firebase Console.
- Select the cheer-app-prototype project.
- Click the gear icon → Project settings.
- Scroll to Your apps → select the Web app (or create one if none exists).
- The config object contains all six values.
The native config file firebaseConfig.ts reads these variables at runtime via process.env.EXPO_PUBLIC_*.
Note: The web build uses a separate file, firebaseConfig.web.ts, which currently has its own initialization. See Addendum for details.
npx expo run:iosThis single command:
- Installs CocoaPods dependencies (runs
pod installinios/). - Compiles the native Xcode project.
- Launches the iOS Simulator with the app.
To test a production-like build locally (closest to what EAS builds and submits):
npx expo run:ios --configuration ReleaseImportant:
npx expo start(the dev server) uses Expo's own AppDelegate and dev runtime — it does NOT exercise the project's native code the way a real build does. Always use--configuration Releaseor TestFlight to catch native-level issues before submitting.
Alternatively, use the npm script:
npm run iosTo pick a specific simulator (e.g., iPhone 16 Pro):
npx expo run:ios --device
# presents a list of available simulators and connected devices- Open
ios/GardenerHarvesting.xcodeproj(or the.xcworkspaceafter pod install) in Xcode. - In Signing & Capabilities, select your development team.
- Connect your device via USB or Wi-Fi.
- Run:
npx expo run:ios --device "Your Device Name"| Method | How |
|---|---|
| Expo DevTools menu | Press Cmd+D in the Simulator (or shake a physical device). Opens a menu with options like "Debug Remote JS", "Toggle Inspector", etc. |
| React DevTools | In a separate terminal: npx react-devtools. The app connects automatically. Inspect component tree, props, state. |
| Safari Web Inspector | Safari → Develop menu → select your Simulator → select the JSContext. Inspect console logs, set breakpoints, profile. (Enable the Develop menu in Safari → Settings → Advanced → "Show Develop menu in menu bar".) |
| Metro terminal | Console logs (console.log, warnings, errors) appear directly in the Metro bundler terminal where you ran the command. |
If npx expo run:ios fails with destination/runtime errors, use this sequence.
- Verify Xcode developer path:
xcode-select -p
# expected: /Applications/Xcode.app/Contents/Developer- Verify iOS runtimes and devices:
xcrun simctl list runtimes
xcrun simctl list devices- Clear any pinned Expo simulator UDID (note exact variable name):
echo "$EXPO_IOS_SIMULATOR_UDID"
unset EXPO_IOS_SIMULATOR_UDID- Clean artifacts safely from repo root:
cd /Volumes/ExtremeSSD/dev/gardner-harvesting
rm -rf ios/build
rm -rf ~/Library/Developer/Xcode/DerivedData/GardenerHarvesting-*(N)
cd ios && pod install --repo-update && cd ..zsh: no matches found for the DerivedData glob is harmless and just means there was nothing to remove.
- Re-run with explicit simulator selection:
npx expo run:ios --deviceIf you still get Unable to find a destination matching the provided destination specifier, inspect valid destinations directly:
xcodebuild -workspace ios/GardenerHarvesting.xcworkspace -scheme GardenerHarvesting -showdestinationsIf the error says a specific platform version is missing (example: iOS 26.5 is not installed), install that runtime in Xcode: Settings → Components (or Platforms), then retry.
If the build fails later in pod script phases such as [RNDeps] Replace React Native Dependencies or [Hermes] Replace Hermes with No such file or directory for node, inspect ios/.xcode.env.local. A stale absolute Homebrew Cellar path can break Xcode builds after brew upgrade node.
Prefer:
export NODE_BINARY=/opt/homebrew/bin/nodeAvoid versioned Cellar paths such as:
export NODE_BINARY=/opt/homebrew/Cellar/node/25.6.1/bin/node- Optional production-like local validation:
npx expo run:ios --configuration Release --deviceThis project uses Expo development builds for native Android device testing. For a physical phone, install a development build of the app itself, not Expo Go.
The native android/ directory is CNG output. Treat it as generated code: regenerate with npx expo prebuild --clean --platform android when needed, and do not hand-edit it.
Before running, verify an emulator is running or a device is connected:
adb devices
# should list at least one device/emulatorIf no devices are listed, launch an emulator first (see Setting up an Android emulator below).
npx expo run:androidThis single command:
- Generates the
android/native project (equivalent tonpx expo prebuild --platform android). - Compiles the Gradle project.
- Installs and launches a local development build on the connected emulator or device.
Alternatively:
npm run androidTo pick a specific target when multiple emulators/devices are connected:
npx expo run:android --device
# presents a list of available emulators and connected devices- Open Android Studio → Virtual Device Manager (or Tools → Device Manager).
- Click Create Device.
- Choose a device definition (e.g., Pixel 7).
- Select a system image with API 35 (download if needed).
- Finish and launch the AVD.
Verify the emulator is running:
adb devices
# should list the emulator- On the device: Settings → About phone → tap "Build number" 7 times to enable Developer Options.
- In Developer Options, enable USB Debugging.
- Connect via USB. Approve the debugging prompt on the device.
- Verify:
adb devices
# should list your device- Install the local development build:
npx expo run:android --device- In a separate terminal, start Metro:
npm start- Open the installed app on the phone. It will connect to the Metro server as a development build.
If USB install is not practical, use the cloud-built development client instead:
npm run devbuildThat creates an EAS development build artifact you can sideload onto the phone, then connect to the same Metro session.
Can I use Expo Go for this app on Android?
Not for the native-device workflow documented here. Expo Go installs Expo's runtime, not this app's own native shell.
What should I install on my phone instead?
Install a development build of this app with npx expo run:android --device for a local native build, or npm run devbuild for an EAS-built artifact.
When would I still use Expo Go?
Only for projects that stay within Expo Go's supported native runtime. This repo documents development builds as the default Android phone path.
| Method | How |
|---|---|
| Expo DevTools menu | Press Cmd+M in the emulator (or shake a physical device). |
| React DevTools | Separate terminal: npx react-devtools. |
| ADB logcat | adb logcat *:S ReactNative:V ReactNativeJS:V — filters for React Native logs only. |
| Flipper | Download Flipper. Useful for network inspection, layout debugging, and database viewing. |
| Metro terminal | Console logs appear in the Metro bundler terminal. |
App built successfully but doesn't appear on the emulator:
- Verify the emulator is still running:
adb devices. If it shows no devices, the emulator may have closed during the build. - Check that the APK was actually produced:
find android -name "*.apk" - If the APK exists, install it manually:
adb install android/app/build/outputs/apk/debug/app-debug.apk
- The app may not be on the home screen — swipe up to open the app drawer and look for "Gardener Harvesting".
Local dev build fails with INSTALL_FAILED_UPDATE_INCOMPATIBLE (signature mismatch):
The production/EAS build is signed with the EAS-managed keystore; local dev builds are signed with the local debug keystore. Android will not allow one to update over the other. You must uninstall the existing app from the device first:
adb uninstall com.communitycheer.gardner_harvestingThen run npx expo run:android --device again. Note: this removes the production app from the device — reinstall it from the Play Store internal track when needed.
Local dev build fails with INSTALL_FAILED_VERSION_DOWNGRADE:
The production EAS build auto-increments versionCode remotely. If the dev build's versionCode is lower than the production build installed on the device, Android will reject the install. Fix: bump versionCode in app.json (android.versionCode) and also directly in android/app/build.gradle (changes to app.json only propagate to android/ after a full prebuild). The EAS production profile manages its own counter independently, so bumping it here won't affect production builds.
Regenerate the native project from scratch:
npx expo prebuild --clean --platform android
npx expo run:androidGradle errors persist — clear the build cache:
cd android && ./gradlew clean && cd ..npm run webor equivalently:
npx expo start --webOpens the app in your default browser at http://localhost:8081. Hot module replacement is enabled — changes to source files reflect immediately.
The web platform uses firebaseConfig.web.ts for Firebase initialization, separate from the native firebaseConfig.ts. Be aware that changes to Firebase config may need to be reflected in both files.
To build and serve the production web export locally:
npm run start:webThis runs expo export --platform web (output to dist/) and then serves it via npx serve. The EXPO_PUBLIC_GIT_HASH env var is injected automatically to display the commit hash in the app.
| Method | How |
|---|---|
| Browser DevTools | Cmd+Option+I (or F12). Full access to console, network, sources, performance, etc. |
| React DevTools | Install the React DevTools browser extension for Chrome or Firefox. |
| Source maps | Enabled in development — you can set breakpoints in your TypeScript source directly in the browser's Sources panel. |
npm testThis starts Jest in watch mode — tests re-run automatically when files change. Press q to quit.
To run a specific test file:
npx jest --testPathPattern=HarvestFormTo run all tests once (no watch, useful for CI):
npx jestTests live alongside components in components/__tests__/:
HarvestForm.test.tsxImagePicker.test.tsxNoteModal.test.tsxPasswordInput.test.tsx
Configuration: jest.config.js, jest.setup.js (mocks for AsyncStorage, vector icons).
npm run lintUses Expo's built-in lint configuration.
npm run expo:doctorRuns npx expo-doctor to detect common Expo configuration issues, version mismatches, and dependency problems.
- Logged into EAS CLI (
eas login) with an Expo account that has access to this project. - An Apple Developer Program membership (required for App Store distribution).
Defined in eas.json:
| Profile | Purpose | Distribution |
|---|---|---|
development |
Development build for installing the app on physical devices during development. | Internal |
preview |
Internal testing build with OTA update channel "preview". |
Internal |
production |
App Store build. Auto-increments build number. Pins CocoaPods to 1.15.2. | Store |
# Production build (App Store)
npm run build:ios
# equivalent to: npx eas build --platform ios --profile production
# Development build
npx eas build --platform ios --profile development
# Preview build
npx eas build --platform ios --profile previewOn your first build, EAS will prompt you to set up credentials (certificates, provisioning profiles). It can manage these automatically — just provide your Apple Developer account credentials when asked.
The build runs in the cloud on EAS servers. Monitor progress at expo.dev or in the terminal.
npm run submit:ios
# equivalent to: npx eas submit --platform ios --latest --profile productionThis uploads the latest production build to App Store Connect. The company name is configured in eas.json as "COMMUNITY HEALTH AND EMPOWERMENT THROUGH EDUCATION AND RESEARCH, INC.".
ITSAppUsesNonExemptEncryption is set to false in app.json, so Apple won't prompt for export compliance documentation.
Push JavaScript-only changes without a new binary:
eas update --branch production --message "description of change"The runtime version (currently 1.2.4 in app.json) must match the binary's runtime version. Bump it whenever native dependencies change.
- Logged into EAS CLI (
eas login). - For submission: Google Play Console access and a Google Service Account JSON key configured in EAS for automated uploads.
# Production build (Google Play)
npm run build:android
# equivalent to: npx eas build --platform android --profile production
# Development client for side-loading
npm run devbuild
# equivalent to: npx eas build -e development -p androidOn first build, EAS manages the Android keystore automatically. It will generate and store the keystore securely.
npm run submit:android
# equivalent to: npx eas submit -p android --latest --profile productionPer eas.json, this submits to the internal track with draft release status. You must then promote the release in the Google Play Console.
After your first EAS build, you must sync the signing certificate fingerprints with Firebase:
- Go to expo.dev → your project → Credentials → Android → view the SHA-1 and SHA-256 fingerprints.
- Open the Firebase Console → Project Settings → Your apps → Android app (
com.communitycheer.gardner_harvesting). - Click Add fingerprint and paste both SHA-1 and SHA-256 values.
- Download the updated
google-services.jsonfrom Firebase and replace the file at the repo root. - Commit the updated file.
Without this step, Firebase features (especially Auth and Google sign-in) may not work correctly on Android.
Same as iOS:
eas update --branch production --message "description of change"npm run start:webThis exports the production web bundle to dist/ and serves it locally via npx serve (typically at http://localhost:3000). The EXPO_PUBLIC_GIT_HASH environment variable is automatically set to the current git short hash.
npm run deploy:webThis:
- Exports the web bundle to
dist/(withEXPO_PUBLIC_GIT_HASHinjected). - Deploys
dist/to Firebase Hosting viafirebase deploy --only hosting.
Firebase Hosting is configured in firebase.json:
- Serves from the
dist/directory. - All routes rewrite to
/index.html(SPA behavior).
Requirements:
- Firebase CLI installed and logged in (
firebase login). - Access to the
cheer-app-prototypeFirebase project.
The app is served at the default Firebase Hosting URL for the project. Configure custom domains in the Firebase Console → Hosting → Add custom domain.
The app uses a dedicated Cloud Run service to classify crop images via OpenAI's CLIP model.
Service URL: Deployed at https://smart-harvest-XXX.us-central1.run.app
Environment var in app:
EXPO_PUBLIC_SMART_HARVEST_URL=https://smart-harvest-XXX.us-central1.run.appConfigured in EAS environments (development, preview, production) via npx eas env:create.
From the workspace root:
cd cloud-functions/smart-harvest
# First deployment (creates Cloud Run service)
gcloud run deploy smart-harvest \
--source . \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--min-instances 0 \
--project cheer-app-prototype
# Subsequent updates: same command (re-deploys with new Docker image)Builds Docker image from Dockerfile, pushes to Google Artifact Registry, deploys to Cloud Run. Takes ~2-3 minutes first time, ~1 minute for updates.
cd cloud-functions/smart-harvest
docker build -t smart-harvest .
docker run -p 8080:8080 smart-harvestThen query via cURL:
# Health
curl http://localhost:8080/health
# Classify
curl -X POST http://localhost:8080/classify \
-F "image=@path/to/photo.jpg" \
-F "labels=tomato,pepper,basil"When testing the mobile app against a local Docker container, endpoint host differs by Android target:
- Android emulator: use
http://10.0.2.2:8080 - Physical Android device via ADB: use
http://127.0.0.1:8080with port reverse
Set in your app env:
EXPO_PUBLIC_SMART_HARVEST_URL=http://10.0.2.2:8080or for physical device:
EXPO_PUBLIC_SMART_HARVEST_URL=http://127.0.0.1:8080For physical device, run:
adb reverse tcp:8080 tcp:8080
adb reverse --listConfig location for local dev is .env.local (loaded by Expo). Set exactly one value there when switching targets:
# Android emulator
EXPO_PUBLIC_SMART_HARVEST_URL=http://10.0.2.2:8080
# Physical Android device via adb reverse
EXPO_PUBLIC_SMART_HARVEST_URL=http://127.0.0.1:8080Then restart Expo so env vars rebundle into the app.
If the app shows "unable to identify crop":
- Check app logs (in Expo console). See
cloud-functions/smart-harvest/README.mdfor detailed log format. - Verify service health:
curl https://smart-harvest-XXX.run.app/health - Check Cloud Run logs for errors:
gcloud logging read "resource.type='cloud_run_revision' AND resource.labels.service_name='smart-harvest'" \ --limit 20 --format json
See cloud-functions/smart-harvest/README.md for:
- API specification (GET
/health, POST/classify) - Deployment details (costs, cold starts, environment setup)
- Local development and testing
- Logging and debugging strategies
- Model performance notes and limitations
| Service | Identifier |
|---|---|
| EAS Project ID | b54ebaef-028f-45f9-9380-6918d6c41315 |
| Firebase Project ID | cheer-app-prototype |
| EAS Updates URL | https://u.expo.dev/b54ebaef-028f-45f9-9380-6918d6c41315 |
If you need to use your own EAS account instead of the original developer's:
- In app.json, delete the
extra.easnode:"extra": { "router": { "origin": false }, "eas": { "projectId": "..." } // ← delete this "eas" object }
- Run any EAS command (e.g.,
eas build --platform android --profile development). - EAS CLI will prompt you to log in and select/create a project, then re-insert the
projectId. - Commit the updated app.json.
See Building & Deploying — Android via EAS → SHA fingerprint sync.
The runtimeVersion field in app.json (currently 1.2.4) links OTA updates to compatible binaries:
- JS-only changes: push via
eas updatewithout changing the runtime version. - Native dependency changes (new native module, SDK upgrade, etc.): bump the runtime version before building a new binary, or OTA updates will fail to load on older binaries.
Update channels:
previewprofile builds receive updates from thepreviewchannel.productionprofile builds receive updates from theproductionbranch.
Items below represent opportunities to improve security, developer experience, and code quality. Each links back to the relevant section above.
| Issue | Details | Relevant Section |
|---|---|---|
| Hardcoded web Firebase config | firebaseConfig.web.ts contains hardcoded Firebase credentials instead of reading from environment variables like the native config does. Should be unified to use EXPO_PUBLIC_* env vars. |
Installation & Environment Setup |
| Committed native Firebase configs | google-services.json (Android) and GoogleService-Info.plist (iOS) are committed to the repo with API keys and SHA certificate hashes. This is standard for Firebase mobile apps, but there is no documented key rotation procedure. |
Deploy Android, Deploy iOS |
| No Firebase security rules in repo | Firestore, Realtime Database, and Storage security rules are not versioned in the repository. The actual protection level in production is unknown from the codebase alone. | EAS & Firebase Linkage |
| No API key restrictions documented | Firebase API keys should have application restrictions (HTTP referrers for web, package name + SHA for Android, bundle ID for iOS) configured in the Google Cloud Console. No documentation exists for current restrictions. | Installation & Environment Setup |
| Issue | Details | Relevant Section |
|---|---|---|
No .nvmrc file |
The project requires Node 18+ but has no .nvmrc or .node-version file to pin the version automatically for developers using nvm/fnm. |
Prerequisites |
| Stale native directory docs | Workspace guardrails require both ios/ and android/ to be treated as generated CNG output, but older sections of this README previously described a mixed strategy. Keep docs aligned with the current Expo/CNG workflow. |
Running Android |
ios/GardenerHarvesting/Info.plist declares MinimumOSVersion as 12.0, but ios/Podfile sets the deployment target to 15.1.expo prebuild --clean for Expo 55. |
Running iOS | |
| Contradictory Android permissions | app.json lists RECORD_AUDIO in both blockedPermissions and permissions under the android key. The intent is likely to block it — remove it from permissions. |
Deploy Android |
web missing from platforms |
app.json platforms array lists only ["ios", "android"] despite active web support and a deploy script. Add "web" for clarity. |
Running Web |
| Issue | Details | Relevant Section |
|---|---|---|
| No CI/CD pipeline | There are no GitHub Actions workflows. Tests, linting, and type-checking are not automated on PR or push. | Testing |
| Growing test coverage | Seven test files exist across components/__tests__/ and hooks/__tests__/. Core flows (auth, data submission) still lack full automated coverage. |
Testing |
start script uses --tunnel |
The default npm start runs expo start --tunnel, which routes through ngrok. This adds latency and requires a network connection. For local development, expo start (LAN/localhost) is sufficient. Consider renaming or adding a start:local script. |
Running iOS |
| No unified task runner | There is no Makefile, Justfile, or similar tool to document and run common multi-step workflows (e.g., "clean build iOS", "reset and reinstall"). |
Prerequisites |
These are known issues already documented in project specs. They are included here for visibility.
| Issue | Details | Reference |
|---|---|---|
| Web auth sessions lost on refresh | firebaseConfig.web.ts uses inMemoryPersistence, causing auth state to be lost on every page reload. Should use browserLocalPersistence. |
Running Web, quick-fixes-bundle-prd.md |
| Realtime DB overwrite (data loss) | Concurrent harvest submissions can overwrite each other because set() is used instead of push(). |
quick-fixes-bundle-prd.md |
| Non-idempotent participation writes | addDoc creates duplicates if a user logs participation multiple times on the same day. |
quick-fixes-bundle-prd.md |
| quick-fixes-bundle-techspec.md | ||
signUp but Spanish uses signup — causes missing translations for Spanish users.signUp. |
quick-fixes-bundle-techspec.md | |
| N+1 Firestore reads | Localized crop/unit names are fetched individually per item, causing excessive reads and latency. | Architecture guide |