Mobile app (Expo)
Developing the React Native app in apps/mobile with shared tRPC and auth.
The mobile app (apps/mobile, package @zts/mobile) is an Expo project that shares the same backend as the web app through @zts/trpc and @zts/auth.
Prerequisites
- Monorepo set up (Quick Start, Monorepo)
- Web API running (
pnpm devon port 3000 by default) - Expo tooling (Expo Go or a development build)
Run locally
From the repository root:
Platform-specific:
Or from apps/mobile:
API URL
The tRPC client is configured in apps/mobile/src/utils/api.tsx. It calls {baseUrl}/api/trpc with the Better Auth session cookie on each request (x-trpc-source: expo-react).
Base URL resolution (apps/mobile/src/utils/base-url.ts):
EXPO_PUBLIC_API_URLorEXPO_PUBLIC_APP_URLif set- Otherwise Expo dev host + port from
EXPO_PUBLIC_WEB_PORT/EXPO_PUBLIC_PORT/PORT(default port 4000 in code — set env explicitly to 3000 when pointing at the web dev server)
Recommended local .env (root or Expo env):
Use your machine’s LAN IP instead of 127.0.0.1 when testing on a physical device.
Shared packages
| Package | Usage in mobile |
|---|---|
@zts/trpc | Router types, AppRouter, tRPC client |
@zts/auth | Better Auth Expo client (@better-auth/expo) |
@zts/shared | Payment plans, shared types |
Billing and profile flows reuse the same routers as web; see apps/mobile/src/features/.
Auth
Mobile uses the Better Auth Expo plugin configured in packages/auth (server) and the Expo client in apps/mobile/src/utils/auth.ts. Deep links and secure storage follow Expo’s standard Better Auth integration patterns.
OAuth/social providers behave like web; ensure NEXT_PUBLIC_APP_URL / trusted origins match how you reach the API from the device.
Build
Production builds typically use EAS; wire EXPO_PUBLIC_APP_URL to your deployed web origin.
UI note
Responsive web components in Kitze UI adapt for small screens (bottom sheets, native selects). The native app in apps/mobile is a separate Expo UI — see Mobile demo for responsive web behavior, not the Expo codebase.
Related
- Public API — use tRPC from the app; REST/SDK for external automation only
- Browser extension — another first-party client on tRPC
- Better Auth