Welcome to the FarmRisk mobile client repository. This is an universal React Native / Expo application designed to provide village-level micro-climate data, weather forecasting, crop calendar stages, soil moisture metrics, and real-time AI agricultural advisories for farmers.
We use Expo SDK 54 with Expo Router file-based navigation, backed by Supabase Auth and persistent storage.
βββ app/ # Expo Router Navigation & Screens
β βββ (tabs)/ # Bottom Tab Bar Layout
β β βββ _layout.tsx # Bottom Tabs Shell configuration
β β βββ index.tsx # Dashboard Screen (Free vs Paid Gated views)
β β βββ profile.tsx # Profile Details + Login & Register Form
β βββ _layout.tsx # Global Root Layout (injects Providers)
β βββ modal.tsx # Info modal screen
βββ constants/
β βββ theme.ts # Global colors (Light & Dark theme palettes)
β βββ content.ts # Localized string arrays for language translation
β βββ languages/ # Language files (en, hi, mr, ta, gu)
βββ hooks/ # Context hooks
β βββ useAuth.ts # Retrieves authentication state
β βββ usePro.ts # Checks if session exists (Pro status wrapper)
β βββ useLanguage.ts # Localization translator hook
βββ lib/ # Framework Initializers & API Helpers
β βββ supabase.ts # Supabase client with AsyncStorage session persistence
β βββ api.ts # Unified fetches mapping to the Next.js API endpoints
β βββ auth/
β βββ phone.ts # Phone normalizer (10-digit Indian numbers)
βββ providers/ # Global State Contexts
βββ AuthProvider.tsx # Handles reactive Supabase session subscriptions
βββ LanguageProvider.tsx # Handles AsyncStorage-backed language selection
βββ LocationProvider.tsx # Manages active coordinate state (defaults to Dholka)
Ensure you have Node.js, Bun, and the Expo CLI (or EAS CLI) installed.
Create a .env file in the root directory (this is already set up for you):
EXPO_PUBLIC_SUPABASE_URL=
EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
EXPO_PUBLIC_API_URL=
[!NOTE] During development,
EXPO_PUBLIC_API_URLshould point to your active Next.js backend server. The mobile app automatically handles routing requests fromlocalhostto10.0.2.2when running inside an Android Emulator.
Run the package installer:
bun install
bun start
a to load the app in an Android Emulator.i to load the app in an iOS Simulator.w to open the web portal version in your browser.To distribute the app directly to users or upload it to GitHub, you need an APK file. There are three ways to build this:
We have configured a CI/CD pipeline inside .github/workflows/build-and-release.yml.
EXPO_TOKEN secret to your GitHub Repository Settings (generated from your Expo Dashboard).v (e.g., v1.0.0):
git tag v1.0.0
git push origin v1.0.0
app-release.apk to it!You can compile the Android package directly on your local computer using the installed Android SDK.
eas login
eas build --platform android --profile preview --local
.apk file will be generated in your project root directory.If you donβt have the Android SDK or Java configured locally, you can delegate the compilation to Expoβs remote servers:
eas login
eas build --platform android --profile preview
.apk file.If you built the APK locally using Option B or Option C, you can attach it to a GitHub Release manually:
v1.0.0), enter a title, and write release notes..apk file into the box labeled βAttach binaries by dropping them hereβ.