# lag500ms/rhs-fe-mobile architecture

> Architecture diagram of the GitHub repository lag500ms/rhs-fe-mobile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lag500ms/rhs-fe-mobile
- Repository: https://github.com/lag500ms/rhs-fe-mobile

## Overview

#### Purpose and Entry Points
This is an Expo/React Native Android mobile client for a housing-service workflow: discover housing projects, save projects, submit/manage housing applications, complete eKYC, make payments, receive notifications, report issues, and manage an account. JavaScript starts at `index.ts`, mounts `App.tsx`, and is packaged into an Android native shell through `android/app/src/main/java/com/anonymous/femobile/MainActivity.kt`.

#### Application Composition and Navigation
`App.tsx` is the root composition boundary. Feature navigators isolate major flows: authentication in `src/features/auth/AuthNavigator.tsx`, post-login tabs in `src/features/main/MainTabNavigator.tsx`, and nested application routing in `src/features/application/navigation/ApplicationNavigator.tsx`. Other feature-owned navigators, such as `src/features/home/navigation/HomeNavigator.tsx` and `src/features/payment/navigation/PaymentNavigator.tsx`, keep screen transitions local to their domains.

#### Identity, Session, and Onboarding
Authentication screens cover registration, login, password recovery/reset, and OTP verification through `src/features/auth/screens/LoginScreen.tsx` and related screens. API calls are encapsulated by `src/features/auth/api/authApi.ts`; shared authenticated-request behavior belongs at `src/lib/apiClient.ts`, while persisted credentials are bounded by `src/lib/tokenStorage.ts`. eKYC is a separate identity-verification stage, with its own API and navigator at `src/features/ekyc/api/eKycApi.ts` and `src/features/ekyc/EKycNavigator.tsx`. Biometric capabilities are abstracted in `src/lib/biometricService.ts`.

#### Housing Discovery and Saved Projects
The home domain fetches housing inventory via `src/features/home/api/housingApi.ts`, presents listings/details in `src/features/home/screens/HomeScreen.tsx` and `src/features/home/screens/HousingProjectDetailScreen.tsx`, and supports full-screen mapping in `src/features/home/screens/MapFullScreen.tsx`. Address-to-location work is isolated behind `src/features/home/services/geocodeService.ts`, representing an external geocoding boundary. Saved/wishlist state is server-backed through `src/features/saved/api/wishlistApi.ts` and rendered by `src/features/saved/screens/SavedScreen.tsx`.

#### Housing Application Lifecycle
Applications are a multi-screen workflow: create/basic details, edit, document upload, review/submit, list/history, and contract viewing. Its central server boundaries are `src/features/application/api/housingApplicationApi.ts` and `src/features/application/api/housingDocumentApi.ts`; domain contracts reside in `src/features/application/types/application.ts`. The likely control flow is project selection → application creation/data collection → document upload → review/submission → status tracking/contract access, coordinated by `src/features/application/navigation/ApplicationNavigator.tsx`.

#### Payment and External Web Flow
Payment starts from the application domain (`src/features/application/components/ApplicationPaymentSection.tsx`) and crosses into the payment navigator. `src/features/payment/api/paymentApi.ts` obtains or updates payment state; `src/features/payment/screens/PaymentWebViewScreen.tsx` hosts an external payment page, then processing and success screens resolve the return flow. This WebView is a material trust and lifecycle boundary between native app state and a payment provider.

#### User Engagement and Support
Notifications are fetched through `src/features/notification/api/notificationApi.ts`, displayed in `src/features/notification/screens/NotificationListScreen.tsx`, and summarized by `src/features/notification/hooks/useNotificationBadge.ts`. Issue reporting is isolated in `src/features/issue-reports/api/issueReportApi.ts` and `src/features/issue-reports/screens/IssueReportScreen.tsx`. Account profile, password, and account-deletion operations are contained in `src/features/user/UserNavigator.tsx` and `src/features/user/api/userApi.ts`.

#### Runtime and Platform Boundaries
The runtime is TypeScript React Native under Expo, configured by `app.json` and `babel.config.js`; native Android build/runtime integration is Gradle-based under `android/app/build.gradle` and `android/app/src/main/AndroidManifest.xml`. Shared visual primitives and theming live at `src/components/ScreenHeader.tsx` and `src/lib/theme.ts`. Backend services are consumed through feature API modules rather than a visible backend in this repository.

Main entry points: [`src/features/main/MainTabNavigator.tsx`](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/main/MainTabNavigator.tsx) (Main tabs), [`src/features/home/navigation/HomeNavigator.tsx`](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/navigation/HomeNavigator.tsx) (Housing discovery), [`src/features/application/navigation/ApplicationNavigator.tsx`](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/navigation/ApplicationNavigator.tsx) (Application flow), [`src/lib/apiClient.ts`](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/apiClient.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime &amp; shell"]
  node_entry["JS entry<br/>Expo entry<br/>[index.ts]"]
  node_app["App root<br/>React composition<br/>[App.tsx]"]
  node_android{{"Android shell<br/>native host<br/>[MainActivity.kt]"}}
  node_api_client["API client<br/>authenticated HTTP<br/>[apiClient.ts]"]
  node_token_storage[("Token storage<br/>credential persistence<br/>[tokenStorage.ts]")]
end

subgraph group_navigation["App navigation"]
  node_auth_nav["Auth flow<br/>feature navigator<br/>[AuthNavigator.tsx]"]
  node_main_tabs["Main tabs<br/>post-login navigator"]
  node_application_nav["Application flow<br/>nested navigator"]
end

subgraph group_identity["Identity"]
  node_auth_api["Auth API<br/>feature API<br/>[authApi.ts]"]
  node_ekyc["eKYC flow<br/>identity navigator<br/>[EKycNavigator.tsx]"]
  node_ekyc_api["eKYC API<br/>feature API<br/>[eKycApi.ts]"]
  node_biometrics["Biometrics<br/>device identity service"]
end

subgraph group_housing["Housing workflow"]
  node_home["Housing discovery<br/>home navigator<br/>[HomeNavigator.tsx]"]
  node_housing_api["Housing API<br/>inventory API<br/>[housingApi.ts]"]
  node_geocoding{{"Geocoding service<br/>external location boundary<br/>[geocodeService.ts]"}}
  node_saved["Saved projects<br/>wishlist API<br/>[wishlistApi.ts]"]
  node_application_api["Application API<br/>lifecycle API"]
  node_document_api["Document API<br/>upload API"]
  node_payment["Payment flow<br/>payment navigator"]
  node_payment_api["Payment API<br/>payment-state API<br/>[paymentApi.ts]"]
  node_payment_webview{{"Payment WebView<br/>external provider boundary"}}
end

subgraph group_engagement["Engagement &amp; account"]
  node_notifications["Notifications<br/>notification API<br/>[notificationApi.ts]"]
  node_issues["Issue reporting<br/>support API<br/>[issueReportApi.ts]"]
  node_account["Account flow<br/>user navigator<br/>[UserNavigator.tsx]"]
  node_user_api["User API<br/>account API<br/>[userApi.ts]"]
end

node_android -->|"hosts bundle"| node_entry
node_entry -->|"mounts"| node_app
node_app -->|"unauthenticated"| node_auth_nav
node_app -->|"authenticated"| node_main_tabs
node_auth_nav -->|"sign-in and recovery"| node_auth_api
node_auth_api -->|"requests"| node_api_client
node_auth_api -->|"persists credentials"| node_token_storage
node_auth_nav -.->|"device sign-in"| node_biometrics
node_main_tabs -->|"discovery"| node_home
node_main_tabs -->|"applications"| node_application_nav
node_main_tabs -->|"verification"| node_ekyc
node_main_tabs -->|"account"| node_account
node_home -->|"inventory"| node_housing_api
node_home -->|"map locations"| node_geocoding
node_home -->|"save projects"| node_saved
node_home -->|"select project"| node_application_nav
node_application_nav -->|"create and track"| node_application_api
node_application_nav -->|"upload documents"| node_document_api
node_application_nav -->|"start payment"| node_payment
node_payment -->|"payment state"| node_payment_api
node_payment -->|"provider page"| node_payment_webview
node_ekyc -->|"verify identity"| node_ekyc_api
node_notifications -->|"requests"| node_api_client
node_issues -->|"requests"| node_api_client
node_account -->|"manage profile"| node_user_api
node_user_api -->|"requests"| node_api_client

click node_entry "https://github.com/lag500ms/rhs-fe-mobile/blob/main/index.ts"
click node_app "https://github.com/lag500ms/rhs-fe-mobile/blob/main/App.tsx"
click node_android "https://github.com/lag500ms/rhs-fe-mobile/blob/main/android/app/src/main/java/com/anonymous/femobile/MainActivity.kt"
click node_api_client "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/apiClient.ts"
click node_token_storage "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/tokenStorage.ts"
click node_auth_nav "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/auth/AuthNavigator.tsx"
click node_main_tabs "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/main/MainTabNavigator.tsx"
click node_application_nav "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/navigation/ApplicationNavigator.tsx"
click node_auth_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/auth/api/authApi.ts"
click node_ekyc "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/ekyc/EKycNavigator.tsx"
click node_ekyc_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/ekyc/api/eKycApi.ts"
click node_biometrics "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/biometricService.ts"
click node_home "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/navigation/HomeNavigator.tsx"
click node_housing_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/api/housingApi.ts"
click node_geocoding "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/services/geocodeService.ts"
click node_saved "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/saved/api/wishlistApi.ts"
click node_application_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/api/housingApplicationApi.ts"
click node_document_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/api/housingDocumentApi.ts"
click node_payment "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/navigation/PaymentNavigator.tsx"
click node_payment_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/api/paymentApi.ts"
click node_payment_webview "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/screens/PaymentWebViewScreen.tsx"
click node_notifications "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/notification/api/notificationApi.ts"
click node_issues "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/issue-reports/api/issueReportApi.ts"
click node_account "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/user/UserNavigator.tsx"
click node_user_api "https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/user/api/userApi.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_app,node_android,node_api_client,node_token_storage toneBlue
class node_auth_nav,node_main_tabs,node_application_nav toneAmber
class node_auth_api,node_ekyc,node_ekyc_api,node_biometrics toneMint
class node_home,node_housing_api,node_geocoding,node_saved,node_application_api,node_document_api,node_payment,node_payment_api,node_payment_webview toneRose
class node_notifications,node_issues,node_account,node_user_api toneIndigo
```

## Components

### Runtime & shell

- [JS entry](https://github.com/lag500ms/rhs-fe-mobile/blob/main/index.ts): Expo entry · `index.ts`
- [App root](https://github.com/lag500ms/rhs-fe-mobile/blob/main/App.tsx): React composition · `App.tsx`
- [Android shell](https://github.com/lag500ms/rhs-fe-mobile/blob/main/android/app/src/main/java/com/anonymous/femobile/MainActivity.kt): native host · `android/app/src/main/java/com/anonymous/femobile/MainActivity.kt`
- [API client](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/apiClient.ts): authenticated HTTP · Shared authenticated request boundary. · `src/lib/apiClient.ts`
- [Token storage](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/tokenStorage.ts): credential persistence · `src/lib/tokenStorage.ts`

### App navigation

- [Auth flow](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/auth/AuthNavigator.tsx): feature navigator · `src/features/auth/AuthNavigator.tsx`
- [Main tabs](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/main/MainTabNavigator.tsx): post-login navigator · `src/features/main/MainTabNavigator.tsx`
- [Application flow](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/navigation/ApplicationNavigator.tsx): nested navigator · Coordinates creation, documents, review, submission, and status. · `src/features/application/navigation/ApplicationNavigator.tsx`

### Identity

- [Auth API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/auth/api/authApi.ts): feature API · `src/features/auth/api/authApi.ts`
- [eKYC flow](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/ekyc/EKycNavigator.tsx): identity navigator · `src/features/ekyc/EKycNavigator.tsx`
- [eKYC API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/ekyc/api/eKycApi.ts): feature API · `src/features/ekyc/api/eKycApi.ts`
- [Biometrics](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/lib/biometricService.ts): device identity service · `src/lib/biometricService.ts`

### Housing workflow

- [Housing discovery](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/navigation/HomeNavigator.tsx): home navigator · Listings, project details, and map views. · `src/features/home/navigation/HomeNavigator.tsx`
- [Housing API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/api/housingApi.ts): inventory API · `src/features/home/api/housingApi.ts`
- [Geocoding service](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/home/services/geocodeService.ts): external location boundary · `src/features/home/services/geocodeService.ts`
- [Saved projects](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/saved/api/wishlistApi.ts): wishlist API · `src/features/saved/api/wishlistApi.ts`
- [Application API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/api/housingApplicationApi.ts): lifecycle API · `src/features/application/api/housingApplicationApi.ts`
- [Document API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/application/api/housingDocumentApi.ts): upload API · `src/features/application/api/housingDocumentApi.ts`
- [Payment flow](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/navigation/PaymentNavigator.tsx): payment navigator · `src/features/payment/navigation/PaymentNavigator.tsx`
- [Payment API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/api/paymentApi.ts): payment-state API · `src/features/payment/api/paymentApi.ts`
- [Payment WebView](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/payment/screens/PaymentWebViewScreen.tsx): external provider boundary · Hosts and resolves the external payment return flow. · `src/features/payment/screens/PaymentWebViewScreen.tsx`

### Engagement & account

- [Notifications](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/notification/api/notificationApi.ts): notification API · `src/features/notification/api/notificationApi.ts`
- [Issue reporting](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/issue-reports/api/issueReportApi.ts): support API · `src/features/issue-reports/api/issueReportApi.ts`
- [Account flow](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/user/UserNavigator.tsx): user navigator · Profile, password, and account deletion. · `src/features/user/UserNavigator.tsx`
- [User API](https://github.com/lag500ms/rhs-fe-mobile/blob/main/src/features/user/api/userApi.ts): account API · `src/features/user/api/userApi.ts`

## Connections

- Android shell → JS entry: hosts bundle
- JS entry → App root: mounts
- App root → Auth flow: unauthenticated
- App root → Main tabs: authenticated
- Auth flow → Auth API: sign-in and recovery
- Auth API → API client: requests
- Auth API → Token storage: persists credentials
- Auth flow → Biometrics: device sign-in
- Main tabs → Housing discovery: discovery
- Main tabs → Application flow: applications
- Main tabs → eKYC flow: verification
- Main tabs → Account flow: account
- Housing discovery → Housing API: inventory
- Housing discovery → Geocoding service: map locations
- Housing discovery → Saved projects: save projects
- Housing discovery → Application flow: select project
- Application flow → Application API: create and track
- Application flow → Document API: upload documents
- Application flow → Payment flow: start payment
- Payment flow → Payment API: payment state
- Payment flow → Payment WebView: provider page
- eKYC flow → eKYC API: verify identity
- Notifications → API client: requests
- Issue reporting → API client: requests
- Account flow → User API: manage profile
- User API → API client: requests
