How inaturalist/seekreactnative works
Project Type & Purpose
• This is a cross‑platform mobile application built with React Native (“Seek App”), delivering camera‑based plant and animal identification on iOS and Android.
• Key features include an AR camera pipeline (TFLite/MLModel), offline storage (Realm), integration with the iNaturalist API, user authentication, localization, and a rich UI.
File‑Structure Analysis
• Top‑level “android” and “ios” directories: native build configurations, assets, and platform‑specific code/bridging.
• “components/”, “styles/”, “assets/”: React Native UI layer organized by feature (Camera, Home, Match, Observations, etc.).
• “utility/” and “models/”: business logic, helpers, API wrappers, and local data models (Realm schema).
• Config & build: Babel & Metro (“babel.config.js”, “metro.config.js”), Gradle wrapper, Xcode workspace, Fastlane pipelines.
• Tests: Jest unit/integration (“tests/”), Detox E2E (“e2e/”).
• Translation/localization: Crowdin integration, “translations/”, “i18n.ts”, and localized resource directories in iOS.
a. Platforms & Build
• Android (Gradle → APK)
• iOS (Xcode/Pods → IPA)
• Metro Bundler compiles React Native JS bundle.
• Fastlane orchestrates CI/CD.
b. React Native Runtime
• JavaScript thread: UI components, state (React), navigation (React Navigation RootStack/SideDrawer).
• Native bridge: modules for camera, storage, network, device APIs.
c. AR Camera Pipeline
• VisionCamera plugin + custom FrameProcessor → TFLite (Android) / CoreML (iOS) models loaded from assets.
• taxonomy.json/csv & common names loaded from local files.
d. Persistence Layer
• Realm DB on device for caching observations, badges, user settings, uploads.
• Model definitions in “models/…Realm.ts”.
e. API Layer
• iNaturalist API calls via “utility/apiCalls.ts” and “utility/serverHelpers.ts”.
• Authentication flows (JWT secret in config.js).
f. Localization
• Crowdin‑exported JSON in “translations/”.
• i18n.ts initialization & date/language helpers for UI strings.
• Native resource bundles in iOS .lproj and Android values.
g. Testing & CI
• Jest (unit/integration) → tests under “tests/unit” & “tests/integration”.
• Detox E2E → “e2e/”.
• GitHub Actions workflow triggers builds/tests.
h. External Services
• iNaturalist server (observations, species data).
• Crowdin (translations).
• Model‑files repo for AR assets.
Diagramming Relationships & Data‑Flows
• Metro Bundler feeding the JS bundle into both.
• UI Components layer calling into Utility/API layer.
• AR Camera module calling into TFLite/CoreML.
• API layer calling external iNat server.
• Persistence layer caching/network responses.
• Build pipelines: Gradle/Xcode & Fastlane → app stores.
Architectural Patterns & Principles
• Modular feature‑based directory structure (separation of concerns).
• Provider pattern (React Context for user, species, challenges).
• Hooks abstraction for data fetching/state (e.g., useFocusTap, useFetchUserSettings).
• MVVM‑like separation: components UI ←→ hooks/view‑models ←→ utility/services ←→ storage/network.
Diagramming Conventions
• JS Runtime (blue rectangles)
• Native Modules (green)
• External Services (orange)