Mobile Architecture
Overview
Section titled “Overview”Expo/React Native mobile app (@life-manager/mobile) sharing the same Supabase backend and PowerSync offline-first architecture as the web app.
Tech Stack
Section titled “Tech Stack”- Framework: Expo SDK 55 + Expo Router v6
- Database: PowerSync (
@powersync/react-native+@powersync/op-sqlite) + Supabase - State: TanStack DB for server state (same pattern as web)
- Navigation: Expo Router (file-based) + React Navigation
App Structure
Section titled “App Structure”src/ app/ # Expo Router (file-based routing) _layout.tsx # Root layout index.tsx # Home screen login.tsx # Login screen db/ collections/ # Data layer (same pattern as web) profile/ # Profile collection powersync/ Connector.ts # PowerSync <-> Supabase bridge (mobile-specific) db.ts # PowerSync database instance (uses op-sqlite) supabase.ts # Supabase client providers/ AuthProvider.tsx # Auth context polyfills/ crypto.ts # Crypto polyfill for React NativeShared Packages
Section titled “Shared Packages”@life-manager/db— PowerSync schema, Supabase types, domain types (shared with web)@life-manager/shared— Not yet fully integrated (planned)
Auth Flow
Section titled “Auth Flow”- User opens app →
AuthProviderchecks Supabase session - No session → redirect to
login.tsx - Session exists → initialize PowerSync connection, show home screen
- Logout → disconnect PowerSync, clear local data