Mobile App (React Native/Expo)
Relevant source files
The following files were used as context for generating this wiki page:
The Polar Mobile App is a cross-platform application built using React Native and the Expo framework, designed to provide the Polar experience on iOS and Android devices. It serves as a mobile extension of the Polar payment infrastructure, allowing users to manage their software monetization and developer-centric billing activities on the go.
The application leverages Expo Application Services (EAS) for cloud builds and deployments, and utilizes Expo Router for file-based navigation. It is integrated into the Polar monorepo, sharing logic with other packages such as the internal API client and currency utilities.
Sources: clients/README.md:12, clients/apps/app/README.md:3, AGENTS.md:25
Architecture and Technical Stack
The mobile app follows a modern React Native architecture, heavily utilizing the Expo ecosystem for native module management and development workflows.
Core Technologies
- Framework: React Native with Expo (SDK ~54.0.29).
- Routing:
expo-routerfor file-based navigation. - State Management & Data Fetching:
@tanstack/react-queryfor server state and asynchronous data. - Styling:
nativewind(Tailwind CSS for React Native) and@shopify/restylefor theme-based components. - Authentication:
expo-auth-sessionfor OAuth-based flows. - Analytics & Monitoring:
@sentry/react-nativefor error tracking and crash reporting.
Sources: clients/apps/app/package.json:52-110, clients/apps/app/README.md:3
Integration Flow
The following diagram illustrates how the mobile app interacts with the Polar backend and Expo services.
The diagram shows the communication paths between the mobile client, the backend API, and deployment infrastructure.
Navigation and Routing
The app uses Expo Router, which maps the file system in the app/ directory to application routes. The entry point is defined as expo-router/entry.
Authentication and Guarding
The root index file (app/index.tsx) implements session-based redirection. If a session exists, the user is redirected to the /home route. Otherwise, a login screen with an "authenticate" trigger is displayed.
export default function App() {
const { session } = useSession()
const { authRequest, authenticate } = useOAuth()
if (session) {
return <Redirect href="/home" />
}
// ... render login screen
}
Sources: clients/apps/app/app/index.tsx:16-22, clients/apps/app/package.json:3
Build and Deployment (EAS)
The project utilizes Expo Application Services (EAS) to manage native builds and releases.
Build Profiles
Build configurations are managed via eas.json with specific profiles for different environments.
| Profile | Purpose | Channel |
|---|---|---|
development | Dev client with debug tools | development |
simulator | iOS simulator build (extends dev) | simulator |
preview | Internal testing (prod-like) | preview |
production | App Store / Play Store release | production |
Sources: clients/apps/app/README.md:13-20
Over-the-Air (OTA) Updates
The app supports OTA updates using expo-updates. This allows pushing JavaScript and asset changes without a full app store review. Polar uses a custom pnpm ota command which includes a preflight guard to ensure native runtime compatibility before publishing.
The sequence illustrates the background download and application process for OTA updates.
Sources: clients/apps/app/README.md:46-67, clients/apps/app/package.json:11
Development Workflow
Scripts and Commands
The package.json defines several critical scripts for local development and build management.
| Command | Action |
|---|---|
pnpm start | Starts the Expo/Metro development server |
pnpm ios | Runs the app on an iOS simulator |
pnpm android | Runs the app on an Android emulator |
pnpm ota | Executes the OTA update preflight and publish |
pnpm typecheck | Runs the TypeScript compiler without emitting files |
pnpm build:production | Triggers a production build via EAS |
Sources: clients/apps/app/package.json:6-21
Maintenance and Updates
Native builds are required when adding or upgrading native modules, changing app.config.js (permissions, bundle identifiers), or bumping the Expo SDK version. Pure JavaScript/TypeScript changes (logic, hooks, components) are typically handled via OTA updates.
Sources: clients/apps/app/README.md:86-98
Technical Summary
The Polar mobile application is a high-performance React Native app that prioritizes developer experience through Expo's modern toolchain. It utilizes shared packages from the Polar monorepo (such as @polar-sh/client) to maintain consistency with the web platform while providing a native mobile interface. By using EAS for builds and OTA updates, the team can rapidly iterate on features while maintaining strict native compatibility checks.
Sources: clients/apps/app/package.json:63, clients/apps/app/README.md:104-118