How jatin-purbia/jarsafari works
Project type and purpose
• JARSafari is a React Native mobile application (iOS/Android) for campus navigation, tailored to IIT Jodhpur.
• It packages both the native Android wrapper (android/…) and the JavaScript/TypeScript UI and business logic in the “Frontend/app” tree.
• There is no in-repo backend service—routing and map data come from external OpenStreetMap-based services (OSMR).
File structure
• Top-level “Frontend/android” holds the native Android project (MainActivity.kt, build.gradle, resources).
• “Frontend/app” contains the React Native entrypoint and Routes (Next.js-style, though for a native app).
• /(auth), /(tabs), screens, components, data, services, store, utils, theme
• “services” subdivides into API clients, location wrappers (GPS), and local storage (favorites).
• “store” uses Redux (actions, reducers, selectors) for state management.
• Configuration/build files: babel.config.js, metro.config.js, tailwind.config.js, tsconfig.json, package.json.
• Assets (animations, fonts, images) and tests/docs directories support UI and developer workflows.
README for insights
• Key features: multi-stop planning, live GPS, favorites, trie autocomplete, dynamic time-aware map.
• Backend routing: uses OSMR + Dijkstra/A* implemented in the app or via an OSMR API.
• Performance goals: caching, adjacency-list graph, sub-50 ms routing, 40% speed gain.
a. Main components
• Mobile Device (Android/iOS)
– React Native JS layer
· UI Components (screens, nav tabs, auth flows)
· State Management (Redux store)
· Business Logic (routing engine, time-aware filtering, autocomplete trie)
· Services
· Location Service (GPS, geolocation API)
· Storage Service (AsyncStorage/SQLite for favorites & cached routes)
· API Client (OSMR requests for map/routing data)
– Native Bridge (React Native → Android/iOS modules)
– Native Android host (MainActivity, Application)
• External Services
– OpenStreetMap Routing (OSMR) API or custom routing server
– (Optional) Map Tiles Provider (e.g., OpenStreetMap or Mapbox)
– (Optional) Analytics/Error-tracking (e.g., Sentry)
b. Relationships & interactions
1. User taps UI → Redux action dispatched
2. Middleware invokes Services →
• Location API returns current GPS coordinates
• API Client fetches route segments from OSMR
• Routing engine (Dijkstra/A*) processes graph and returns optimized multi-stop path
• Storage Service caches routes/favorites
3. Store updates → UI re-renders map view and directions
c. Architectural patterns & principles
• Modular separation (UI / state / services / utils)
• Unidirectional data flow (Redux)
• Single Responsibility per folder (services vs. utils vs. store)
• Caching layer for performance
d. Key technologies & frameworks
• React Native (JS/TS, Metro bundler)
• Native Android (Kotlin) host
• Redux for state management
• TailwindCSS/nativewind for styling
• OpenStreetMap Routing (OSMR)
• Dijkstra/A* algorithm library or custom implementation
• AsyncStorage/SQLite for persistence