Skip to Content
HomeLink Hub

Mobile App Overview

How the HomeLink Hub mobile app is structured, how roles map to navigators, and how it talks to the API and stores data on the device.

The mobile app is a single Expo / React Native binary that serves tenants, agents, landlords and lawyers. Screens are file-based routes (expo-router) under app/. The signed-in user's role decides which tab navigator they land in. This section documents every screen flow, grouped by experience.

Repository layout

FolderWhat it holds
app/Screens. Each file is a route; folders in parentheses such as (auth) are route groups that add no URL segment.
app/_layout.tsxRoot layout: providers, session restore, auth-expiry redirect, push registration, and the root Stack.
services/API code per domain. Either axios thunks (services/auth/auth-thunk.ts) or RTK Query slices (for example services/property/property-thunk.ts).
store/store.ts (Redux store), axios.ts (axios instance and interceptors), config.ts (RTK Query base query and token refresh).
hooks/storage.ts (AsyncStorage wrapper), use-push-notifications.ts, use-chat.ts, socket update hooks, theme hooks.
lib/Helpers: push-notifications.ts, color-scheme.tsx (theming), share.ts, responsive.ts.
components/Shared UI: components/app/* (property cards, maps, date picker), components/tour/* (guided tour), components/ui/*.
constants/api.tsThe API host and the apiUrl() helper.
content/help-content.tsStatic Help Center categories, articles and FAQs.
utils/home-route.tsThe role to home-route mapping.

Role-based navigators

The root Stack in app/_layout.tsx registers these top-level routes:

RoutePurposeWho reaches it
(onboarding)Splash and Get StartedEveryone at launch
(auth)Sign up, sign in, email code, password resetSigned-out users
tenantTenant tab bar: Home, Chats, Wishlist, Inspections, ProfileTENANT, and any missing or unknown role
(tabs)Professional tab bar (agent, landlord, developer, and the lawyer variant)AGENT, LANDLORD, DEVELOPER, LAWYER
agent-onboardingMandatory agent setupAGENT straight after sign-in
search, filter, categories, category/[type], recommendedDiscovery screens outside the tab barMainly tenants
propertyProperty detail, inspection, payment and escrow stack, plus the listing editorAll roles (different screens)
supportHelp Center and Contact SupportAll roles
requests/[id], payment-requests/[id]Agent-side request detailProfessionals
modal, +not-foundTemplate modal and the 404 screenAnyone

The mapping lives in utils/home-route.ts:

  • homeRouteForRole(role) returns /(tabs) for LANDLORD, AGENT, LAWYER and DEVELOPER, and /tenant for TENANT or anything else. The comparison is case-insensitive.
  • postAuthRouteForRole(role) is used right after authentication. It returns /agent-onboarding for AGENT (unconditionally; that screen forwards agents who have finished setup) and otherwise the same result as homeRouteForRole.
  • app/(tabs)/_layout.tsx re-checks agent setup on every render and redirects an unfinished agent back to /agent-onboarding, so a deep link cannot skip it.

/tenant is a real path segment, not a route group. The code comment explains why: as a group it collided with (tabs) on nine routes, including / itself.

No guard on the tenant navigator

app/tenant/_layout.tsx does not check the role or whether anyone is signed in. Routing to /tenant is decided only at the splash, after sign-in, and on the not-found screen. API calls from tenant screens still fail with 401 when there is no session, which sends the user to sign in.

How the app talks to the API

All requests go to one host, under /api/v1. The host is a constant in constants/api.ts (the comment there notes the default is production, so treat any write from a development build as real). There are two HTTP clients:

ClientFileUsed by
axios instancestore/axios.tsAuth thunks, push-token registration, some agent onboarding thunks
RTK Query createBaseQuery(baseUrl)store/config.tsEvery createApi slice: propertyApi, wishlistApi, paymentApi, userApi, settingsApi, chatApi, bookingApi, escrowApi, inspectionsApi, and others

Both behave the same way around authentication:

  1. Before each request the access token is read from AsyncStorage and sent as Authorization: Bearer ....
  2. If a response is 401 and its message contains the word "token", the client calls POST /api/v1/auth/refresh-token with the stored refresh token. The refresh is deduplicated, so several requests failing together share one refresh call.
  3. On success the new access token is stored and the original request is retried once.
  4. On failure the stored session is removed and every listener registered with subscribeToAuthExpiry runs. The root layout's listener dispatches clearAuth and replaces the route with /(auth)/signin.

The axios client has a 60 second timeout. Thunks convert a timeout into "The server took too long to respond. It may still have worked -- check before trying again." and a request with no response into "Could not reach the server. Check your connection and try again." (utils/handle-error.ts).

Real-time updates use socket.io (services/chat/socket.service.ts). The socket connects to the API host root, not /api/v1, and authenticates with the access token. It carries chat messages plus the booking:updated and escrow:status_updated events that refresh payment screens.

Where data is kept

Redux store

store/store.ts combines four plain slices (auth, chat, listingUi, listingForm) with one cache per RTK Query API. The whole store, caches included, is reset when clearAuth, logout.fulfilled or logout.rejected is dispatched, so one account's data never leaks into the next sign-in.

auth holds user, loading, error and sessionRestored. sessionRestored flips to true once the stored session has been read at launch; anything that routes by sign-in state waits for it.

AsyncStorage

hooks/storage.ts wraps AsyncStorage with two prefixes. Values are JSON-encoded.

Stored keyWritten byContents
session:ACCESS_TOKENSign-in thunks, token refreshAccess token (JWT)
local:REFRESH_TOKENSign-in thunksRefresh token
local:USERSign-in thunks, profile editThe user object returned at sign-in
local:REMEMBER_MEEmail sign-inBoolean from the "Remember me" checkbox
local:PUSH_TOKENPush registrationThe Expo push token last registered for this device
local:TOURS_SEENGuided tourWhich tours this device has already shown
local:THEME_PREFERENCEAppearance screensystem, light or dark

Tokens are not in secure storage

Despite the session prefix, both prefixes are plain AsyncStorage and survive an app restart. Nothing uses the device keychain or keystore.

Sign-out and session expiry remove session:ACCESS_TOKEN, local:REFRESH_TOKEN and local:USER. Theme and tour keys are device preferences and are kept.

Theming

hooks/use-theme-preference.tsx reads local:THEME_PREFERENCE before rendering anything, so a user who chose Dark never sees a light first frame. Screens are wrapped in withThemeRemount and remount when the scheme changes; layouts read colours reactively.

Guides in this section

GuideCovers
App launch and onboardingSplash, Get Started, session restore, role redirect, deep links, push notifications, not-found
Sign up and sign inAccount creation, email code, email / Google / Apple sign-in, token storage, sign out
Password resetForgot password code flow
Tenant experienceBrowsing, property detail, inspections, payments, escrow, chats, profile, support

The agent, landlord and lawyer experiences have their own sections alongside this one.

On this page