Skip to content
Buy the boilerplate

Mobile App Overview

The mobile app lives in mobile/. It is a React Native app built with Expo and Expo Router, and it calls the same API as the web UIs. The mobile app is included in Pro and Enterprise.

The app covers the product side of your SaaS: what a tenant’s members use every day. It has no super-admin screens and does not reimplement organization administration. For billing and member management, Settings links out to the web UI.

ConcernLibrary
RuntimeExpo SDK 57, React Native 0.86, React 19.2
RoutingExpo Router (file-based routes in app/)
Data fetchingTanStack Query 5 over a small fetch client
Secure storageexpo-secure-store (Keychain / Keystore)
i18ni18next, react-i18next, expo-localization
Pushexpo-notifications (Expo Push)
Biometricsexpo-local-authentication
Analytics, crashesposthog-react-native, @sentry/react-native
AreaWhat it does
AuthEmail/password login, registration with email confirmation, Google sign-in, TOTP two-factor challenge, forgot password
HomeOrganization switcher and a dashboard for the active tenant (members, active members, pending invites, subscription, recent activity) from GET /dashboard
ProjectsSample tenant-scoped feature module: list, detail/edit, create, delete against /api/v1/projects
NotificationsIn-app feed with unread badge, pull to refresh, infinite scroll, mark as read
AccountProfile and avatar (camera or library), password, 2FA enrolment and disable, link a Google account, sessions, login history, account deletion
SettingsTheme, language, push toggle, biometric app lock, and links to the web UI for billing and members (shown only with billing:read / member:read)
Deep linksdotnetsaas://invite/<token> to accept an invitation; a push tap opens the notification feed

Registration and Google sign-in follow the API’s public /platform/settings switches, the same way the web UIs do.

mobile/
├── app/ # Expo Router routes
│ ├── onboarding.tsx # first-run intro, shown once per device
│ ├── invite/[token].tsx # accept an invitation (deep-linkable)
│ ├── (auth)/ # signed-out stack: login, register, two-factor, forgot-password
│ └── (app)/ # signed-in tabs: home, projects, notifications, account
└── src/
├── api/ # fetch client (auth, X-Organization-Id, refresh) and endpoints
├── auth/ # auth context, secure token store, app lock, Google auth
├── org/ # org context: active tenant, switching, permission checks
├── features/ # self-contained feature modules (projects/)
├── i18n/ # i18next setup and bundled locales
├── services/ # push, biometrics, analytics
├── theme/ # config.ts (brand seed), palette.ts, ThemeProvider
└── components/, hooks/, lib/

Each feature is a folder in src/features/<name>/ (types.ts, api.ts, hooks.ts, locales/{en,pt-BR,es}.json) plus its routes in app/(app)/<name>/. To add one:

  1. Create src/features/<name>/. Gate tenant-scoped queries on useOrg() (hydrated && selectedOrgId).
  2. Add the routes under app/(app)/<name>/.
  3. Register the tab in app/(app)/_layout.tsx with <Tabs.Screen name="<name>" ... />.
  4. Merge the locale files in src/i18n/index.ts, in the “Feature module translations” block.

To remove Projects, delete src/features/projects/ and app/(app)/projects/, the <Tabs.Screen> entry, and its locale imports. docs/MODULES.md covers the matching backend module.

Browsers keep the refresh token in an httpOnly cookie. A native app has no such cookie jar, so the mobile client asks the API to return the refresh token in the JSON body instead. src/api/client.ts sends X-Auth-Transport: body on every request (routes outside /auth/* ignore it):

const AUTH_TRANSPORT_HEADER = { 'X-Auth-Transport': 'body' } as const;

Both tokens and the selected organization id are stored with expo-secure-store (src/auth/token-store.ts) and kept in memory after tokenStore.load() at startup, so requests read them without waiting. On web (npm run web), the store falls back to localStorage.

  • Every non-anonymous request carries Authorization: Bearer <accessToken> and X-Organization-Id.
  • On a 401, the client calls POST /auth/refresh with { accessToken, refreshToken } in the body, saves the rotated pair, and retries the request once. Concurrent 401s share one refresh, so rotated tokens are not revoked by a racing call.
  • If the refresh fails, the unauthorized handler signs the user out.
  • At startup the app treats a stored refresh token as a session. The first 401 refreshes it.
  • Sign-out unregisters the push token, clears the secure store and the query cache, and resets analytics.

See JWT tokens for the server side.

OrgProvider (src/org/org-context.tsx) is fed from /me by the signed-in layout. It restores the saved organization or picks the first one. Switching organizations drops every cached query except me, so tenant data refetches under the new tenant. The context exposes hasPermission for permission checks. See Organizations.

After sign-in, if the push preference is on (it is by default), the app asks for permission, gets an Expo push token and registers it with POST /api/v1/notifications/devices. The Settings toggle registers or unregisters right away, and sign-out unregisters the token. The API sends in-app notifications to registered devices through Expo’s push service from a Hangfire job, so you need no APNs or FCM credentials. See Background jobs.

Push needs a development or store build on a real device. Expo Go, simulators and web skip registration. The Settings toggle is hidden on web and in Expo Go.

Settings → app lock turns on a Face ID / Touch ID / device-biometric gate (src/auth/app-lock.tsx). When enabled, the app locks every time it goes to the background and prompts again when it returns. The prompt allows the device passcode as a fallback. To turn the lock on, the device must have biometric hardware and an enrolled identity, and the user must pass one prompt.

Unlike the web UIs, the app bundles its translations in src/i18n/locales/{en,pt-BR,es}.json, with keys of its own. It picks the device locale on first launch, and the user can override it in Settings. To add a language, add <code>.json with the same keys as en.json and register it in resources and AVAILABLE_LANGUAGES in src/i18n/index.ts.

One file controls the look: src/theme/config.ts. Set the primary color, corner style and brand mark, and src/theme/palette.ts derives the full light and dark palettes:

export const themeConfig: ThemeConfig = {
brand: { name: 'DotnetSaas', markLetter: 'D' },
colors: { primary: '#2563eb' }, // primaryDark is optional; derived when omitted
radius: 'default', // 'sharp' | 'default' | 'rounded'
// overrides: { light: { background: '#faf7f2' }, dark: {} },
};

Screens read useColors(), radius and brand, so nothing else needs editing. Users choose light, dark or system in Settings. The app name in app.json, the icons and splash in assets/, and product-name strings in the locale files are separate rebrand steps (see Building and releasing).

Start the API (see Installation), then:

Terminal window
cd mobile
npm install
npm start

Press i for the iOS simulator, a for the Android emulator or w for the browser, or scan the QR code with Expo Go. If npm install stops on a peer-dependency conflict, run npm install --legacy-peer-deps.

The app reads its settings from EXPO_PUBLIC_* variables. Put them in mobile/.env:

Terminal window
EXPO_PUBLIC_API_URL=http://localhost:5113 # default
EXPO_PUBLIC_WEB_URL=http://localhost:4300 # web UI for the Settings links; defaults to http://localhost:5173
Where the app runsEXPO_PUBLIC_API_URL
iOS simulatorhttp://localhost:5113
Android emulatorhttp://10.0.2.2:5113
Physical device (Expo Go)http://<your-LAN-IP>:5113

Set EXPO_PUBLIC_WEB_URL to the web UI you run: 4200 Angular, 4300 React, 4400 Vue, 4500 Svelte, 5244 Blazor. The full list of variables, including Google, PostHog and Sentry, is in Building and releasing.

Google sign-in, push and the camera need a development build (npx expo run:ios or npx expo run:android) rather than Expo Go.

Terminal window
npm test

Jest with jest-expo and React Native Testing Library. The suite covers the API client’s 401 refresh single-flight, the org context, i18n key parity across locales, palette derivation, biometrics, preferences and a component render. Add tests as *.test.ts(x) next to the code.

© 2026 .NET SaaS