How shashwatorg-2025/mobileapplication works
Project Type and Purpose
• This is a full-stack mobile application (React Native + Expo) focused on reporting and tracking emergency alerts in a community.
• The mobile client handles user authentication, report submission, map visualization, and profile management.
• An external REST API (not in this repo) provides authentication, alert storage, and retrieval.
File Structure Analysis
• Top-level files:
• App.js / index.js – App entry points (Expo bootstrap + root navigator)
• package.json, .eslintrc.js, .prettierrc.js – Project configuration
• src/ directory:
• screens/ – Seven screen-level components (Login, SignUp, Dashboard, Map, MapWeb, MyReports, Alerts, ManageProfile, ReportAlert)
• components/ – Reusable UI pieces (LoadingSpinner, ErrorMessage, map-specific overlays and markers)
• navigation/ – AppNavigator.js defines the navigation graph (stack and tab flows)
• services/ – API wrappers (authService.js, alertService.js, mapService.js)
• utils/ – Helper functions (mapUtils.js)
Key Insights from README
• Uses Expo CLI, React Navigation, AsyncStorage for token storage
• Environment variables (.env) for API_BASE_URL and GOOGLE_MAPS_API_KEY
• All network calls are centralized in services/ using async/await
• UI follows functional components with React Hooks
Main Components
a. Mobile Client
• Presentation Layer: Screen components and reusable UI components
• Navigation Layer: React Navigation controlling screen transitions
• Service Layer: authService, alertService, mapService calling REST endpoints
• Local Storage: AsyncStorage for persisting tokens and possibly cached data
b. External Services
• Backend REST API
– /auth (login, signup)
– /alerts (create, list, update)
• Google Maps (map tiles, geolocation, markers)
c. Data Stores (on the server side, inferred)
• User Database
• Alerts Database
Relationships and Interactions
• User interacts with Screens → Screens invoke Service layer → Service layer issues HTTP requests to Backend API → API reads/writes to Databases → API responses are returned to the client
• MapScreen loads map tiles from Google Maps API and overlays alert markers fetched via mapService
• authService stores JWT or auth token in AsyncStorage; screens check token on startup, navigate accordingly
Architectural Patterns and Principles
• Layered architecture (Presentation → Navigation → Services → External APIs)
• Separation of concerns: UI logic in screens/components, API logic in services
• Single source of truth for network configuration via environment variables
• Modular directory structure for scalability and testability
Detailed Capture of Architectural Elements
• Map overlays (AlertMarker, GridOverlay) as sub-components of MapScreen
• Call out the two platforms (iOS/Android) under the Expo umbrella