Tech Stack
Core Technologies
- React Native 0.81.5: Native mobile framework
- React 19.1.0: Latest React with concurrent features
- Expo SDK 54: Development framework and tooling
- TypeScript: Type-safe development
- Expo Router 6: File-based navigation system
Key Dependencies
Fromraffi-mobile/package.json:13-53:
Architecture Overview
App Configuration
Expo Config
Location:app.json
Key Features
- New Architecture: Enabled for better performance
- Dark Mode Only:
userInterfaceStyle: "dark" - Edge-to-Edge: Full-screen immersive UI on Android
- Deep Linking:
raffi://URL scheme - Typed Routes: Compile-time route validation
Navigation System
File-Based Routing
Expo Router uses file structure for navigation:Navigation Patterns
Tab Navigation (app/(tabs)/_layout.tsx):- Bottom tabs for main sections
- Icons from
@expo/vector-icons - Active/inactive states
- Player opens as full-screen modal
- Swipe down to dismiss
- Orientation changes to landscape
State Management
Zustand Stores
Location:lib/stores/
Raffi uses Zustand for global state:
AsyncStorage
- Persisted user preferences
- Offline caching
- Auth tokens
- Download queue
Video Playback
Expo Video
Location:app/player.tsx
Native video player with hardware acceleration:
Player Features
Orientation Handling:- Auto-rotate to landscape for video
- Lock orientation during playback
- Restore on exit
- System brightness adjustment
- Restore original brightness on exit
- Prevent screen sleep during playback
- Re-enable after pause/exit
- Swipe for seek
- Pinch to zoom
- Double-tap to play/pause
Data Synchronization
Convex Integration
Location:lib/convex.ts
- Local-first updates
- Background sync to Convex
- Optimistic UI updates
- Conflict resolution
Cross-Device Sync
- Watch progress
- Custom lists
- Library items
- Addon configurations
- User preferences
Native Modules
Torrent Streamer Module
Location:modules/torrent-streamer/
Custom native module for torrent streaming:
- Native torrent client integration
- On-device video streaming
- Download management
- Peer connection handling
Backend Integration
API Client
Location:lib/api.ts
Authentication
Ave ID SDK (@ave-id/sdk):
- OAuth authentication
- User profile management
- Session handling
- Database access
- Row-level security
- Real-time subscriptions
Decoder Server Connection
Mobile can connect to:- Local decoder (on-device torrents)
- Remote decoder (desktop app server)
- Cloud decoder (hosted transcoding)
UI Components
Component Structure
Styling
React Native StyleSheet:Performance Optimizations
React Compiler
Enabled in app.json:61:Image Optimization
Expo Image:- Native image caching
- Progressive loading
- Blur placeholders
- WebP support
Reanimated
react-native-reanimated:- 60 FPS animations
- Runs on UI thread
- Gesture-driven interactions
Code Splitting
Expo Router automatically splits routes:- Lazy loading per route
- Reduced initial bundle size
- Faster app startup
Development Workflow
Commands
Expo Go vs. Development Build
Expo Go (Quick Testing):- Scan QR code
- No native build required
- Limited to Expo SDK modules
- Custom native modules
- Torrent streamer support
- Full feature testing
Production Builds
EAS Build
App Store Distribution
iOS:- TestFlight beta testing
- App Store submission
- Bundle ID:
al.kaleid.mobile
- Google Play Console
- APK/AAB signing
- Package:
al.kaleid.raffimobile
Key Design Decisions
Why React Native + Expo?
- Cross-platform: Single codebase for iOS and Android
- Native performance: Native video playback and UI
- Developer experience: Fast refresh, great tooling
- Ecosystem: Access to native modules and APIs
Why Expo Router?
- File-based routing: Intuitive navigation structure
- Type safety: Compile-time route validation
- Deep linking: Built-in URL handling
- SEO ready: Meta tags for web export
Why Zustand Over Redux?
- Simplicity: Less boilerplate
- Performance: Minimal re-renders
- TypeScript: Excellent type inference
- Size: Smaller bundle footprint
Why Custom Torrent Module?
- Performance: Native torrent handling
- Reliability: Better than JavaScript implementations
- Features: Advanced peer management
- Offline: Works without remote server
Platform-Specific Considerations
iOS
Capabilities:- Background audio playback
- Picture-in-Picture
- AirPlay support
- CarPlay ready
Android
Features:- Edge-to-edge display
- Adaptive icons
- Material You theming support
- Internet access (auto-included)
- Storage access for downloads
- Foreground service for downloads