|
| 1 | +# 1ai Mobile App |
| 2 | + |
| 3 | +React Native mobile app for the 1ai multi-model AI chat platform. |
| 4 | + |
| 5 | +## Tech Stack |
| 6 | + |
| 7 | +- **Framework**: React Native with Expo SDK 54 |
| 8 | +- **Navigation**: Expo Router (file-based) |
| 9 | +- **Runtime**: Bun |
| 10 | +- **Language**: TypeScript |
| 11 | +- **Styling**: StyleSheet (no external CSS framework) |
| 12 | +- **State**: React hooks + Context API |
| 13 | +- **Authentication**: JWT with Expo SecureStore |
| 14 | +- **UI Components**: Custom components + Ionicons |
| 15 | + |
| 16 | +## Project Structure |
| 17 | + |
| 18 | +``` |
| 19 | +mobile/ |
| 20 | +├── app/ # Expo Router pages |
| 21 | +│ ├── (auth)/ # Authentication flow |
| 22 | +│ │ ├── signin.tsx # Email input |
| 23 | +│ │ └── otp.tsx # OTP verification |
| 24 | +│ ├── (main)/ # Main app screens |
| 25 | +│ │ ├── chat.tsx # Chat interface |
| 26 | +│ │ ├── apps/ # AI applications |
| 27 | +│ │ ├── pricing.tsx # Subscription plans |
| 28 | +│ │ ├── settings.tsx # User settings |
| 29 | +│ │ └── webview.tsx # External links |
| 30 | +│ ├── home.tsx # Landing page |
| 31 | +│ ├── index.tsx # Auth check & routing |
| 32 | +│ └── _layout.tsx # Root layout |
| 33 | +├── src/ |
| 34 | +│ ├── components/ # Reusable components |
| 35 | +│ │ ├── ui/ # Basic UI components |
| 36 | +│ │ └── chat/ # Chat-specific components |
| 37 | +│ ├── screens/ # Screen implementations |
| 38 | +│ ├── services/ # API client |
| 39 | +│ ├── contexts/ # React contexts |
| 40 | +│ ├── constants/ # Theme & spacing |
| 41 | +│ ├── utils/ # Utilities & data |
| 42 | +│ └── types/ # TypeScript types |
| 43 | +└── assets/ # Images & icons |
| 44 | +``` |
| 45 | + |
| 46 | +## Development Commands |
| 47 | + |
| 48 | +### Setup |
| 49 | +```bash |
| 50 | +bun install # Install dependencies |
| 51 | +``` |
| 52 | + |
| 53 | +### Development |
| 54 | +```bash |
| 55 | +bun run start # Start Expo dev server |
| 56 | +bun run ios # Launch on iOS device/simulator |
| 57 | +bun run android # Launch on Android device/emulator |
| 58 | +bun run web # Launch web version |
| 59 | +``` |
| 60 | + |
| 61 | +### Expo Commands |
| 62 | +```bash |
| 63 | +bunx expo install --fix # Fix SDK compatibility |
| 64 | +bunx expo run:ios # Build and run on iOS |
| 65 | +bunx expo run:android # Build and run on Android |
| 66 | +``` |
| 67 | + |
| 68 | +## Release Commands (EAS) |
| 69 | + |
| 70 | +### Setup EAS |
| 71 | +```bash |
| 72 | +npm install -g eas-cli # Install EAS CLI |
| 73 | +eas login # Login to Expo account |
| 74 | +eas init # Initialize EAS in project |
| 75 | +eas build:configure # Create eas.json config |
| 76 | +``` |
| 77 | + |
| 78 | +### Development Builds |
| 79 | +```bash |
| 80 | +eas build --profile development --platform ios |
| 81 | +eas build --profile development --platform android |
| 82 | +``` |
| 83 | + |
| 84 | +### Production Builds |
| 85 | +```bash |
| 86 | +eas build --platform all # Build for both platforms |
| 87 | +eas build --platform ios --profile production |
| 88 | +eas build --platform android --profile production |
| 89 | +``` |
| 90 | + |
| 91 | +### Local Builds (for debugging) |
| 92 | +```bash |
| 93 | +eas build --platform ios --local |
| 94 | +eas build --platform android --local |
| 95 | +``` |
| 96 | + |
| 97 | +### App Store Submission |
| 98 | +```bash |
| 99 | +eas submit --platform ios # Submit to App Store |
| 100 | +eas submit --platform android # Submit to Google Play |
| 101 | +``` |
| 102 | + |
| 103 | +### Build Management |
| 104 | +```bash |
| 105 | +eas build:list # List all builds |
| 106 | +eas build:view [BUILD_ID] # View build details |
| 107 | +eas build:cancel [BUILD_ID] # Cancel running build |
| 108 | +``` |
| 109 | + |
| 110 | +## Key Features |
| 111 | + |
| 112 | +- **Multi-Model Chat**: Access 20+ AI models (GPT, Claude, Gemini, etc.) |
| 113 | +- **Real-time Streaming**: Live AI responses via Server-Sent Events |
| 114 | +- **Authentication**: Email + OTP flow with secure token storage |
| 115 | +- **Chat History**: Full conversation history with sidebar navigation |
| 116 | +- **AI Applications**: Extensible app ecosystem (Article Summarizer) |
| 117 | +- **Theme Support**: Light/Dark mode with system integration |
| 118 | +- **Credit System**: Premium subscription with usage tracking |
| 119 | +- **Responsive Design**: Optimized for phones and tablets |
| 120 | + |
| 121 | +## API Integration |
| 122 | + |
| 123 | +- **Base URL**: `https://api.1ai.co` |
| 124 | +- **Provider**: OpenRouter API (not direct OpenAI) |
| 125 | +- **Authentication**: JWT Bearer tokens |
| 126 | +- **Storage**: Expo SecureStore for sensitive data |
| 127 | + |
| 128 | +## Environment Requirements |
| 129 | + |
| 130 | +- **iOS**: iOS 13+ (iPhone 6s and newer) |
| 131 | +- **Android**: Android 6+ (API level 23+) |
| 132 | +- **Development**: |
| 133 | + - Node.js 18+ |
| 134 | + - Bun runtime |
| 135 | + - Expo CLI |
| 136 | + - iOS: Xcode 14+ (macOS only) |
| 137 | + - Android: Android Studio |
| 138 | + |
| 139 | +## Release Prerequisites |
| 140 | + |
| 141 | +- **iOS**: Apple Developer Program membership ($99/year) |
| 142 | +- **Android**: Google Play Developer account ($25 one-time) |
| 143 | + |
| 144 | +## Configuration Files |
| 145 | + |
| 146 | +- `app.json` - Expo app configuration |
| 147 | +- `eas.json` - EAS build profiles (created by `eas build:configure`) |
| 148 | +- `package.json` - Dependencies and scripts |
| 149 | +- `tsconfig.json` - TypeScript configuration |
0 commit comments