A comprehensive starter app demonstrating the capabilities of the RunAnywhere SDK - a privacy-first, on-device AI SDK for React Native.
This starter app showcases four main capabilities of the RunAnywhere SDK:
- Streaming text generation with token-by-token output
- Performance metrics (tokens/second, total tokens)
- Cancel generation mid-stream
- Suggested prompts for quick testing
- Beautiful chat UI with message bubbles
- Real-time audio recording
- On-device transcription using Whisper models
- Audio level visualization
- Transcription history
- Privacy-first: all processing happens on device
- Neural voice synthesis with Piper TTS
- Adjustable speech rate (0.5x - 2.0x)
- Sample texts for quick testing
- Audio playback controls
- High-quality, natural-sounding voices
- Full voice assistant experience
- Seamless integration: Speak β Transcribe β Generate β Speak
- Real-time status updates
- Conversation history
- Complete end-to-end voice interaction
This app uses three RunAnywhere packages:
| Package | Purpose | NPM |
|---|---|---|
@runanywhere/core |
Core SDK with infrastructure | View on NPM |
@runanywhere/llamacpp |
LLM backend (LlamaCpp) | View on NPM |
@runanywhere/onnx |
STT/TTS/VAD backend (ONNX) | View on NPM |
# Clone and install
git clone https://github.com/RunanywhereAI/react-native-starter-app.git
cd react-native-starter-app
npm install
# iOS (requires pod install first)
cd ios && pod install && cd ..
npx react-native run-ios
# Android (no additional setup needed)
npx react-native run-android- Node.js 18 or higher
- React Native CLI development environment (setup guide)
- iOS: Xcode 14+, CocoaPods, macOS
- Android:
- Android Studio
- JDK 17+
- Android SDK 36 (compileSdk)
- NDK 27.1.12297006 (install via Android Studio β SDK Manager β SDK Tools β NDK)
- Build Tools 36.0.0
- Physical device recommended for best performance (AI models run slowly on simulators)
-
Clone the repository
git clone https://github.com/RunanywhereAI/react-native-starter-app.git cd react-native-starter-app -
Install dependencies
npm install
Note: This runs
patch-packageautomatically via postinstall to apply necessary compatibility fixes. -
iOS Setup
cd ios pod install cd ..
-
Android Setup (verify your environment)
No additional setup is needed if you have Android Studio installed with the required SDK components. To verify:
# Check that ANDROID_HOME is set (should point to your Android SDK) echo $ANDROID_HOME # Expected: /Users/<username>/Library/Android/sdk (macOS) or similar # Verify ADB is available adb --version # Check installed NDK versions (need 27.1.12297006) ls $ANDROID_HOME/ndk/
If NDK 27 is missing, install it via Android Studio:
- Open Android Studio β Settings β SDK Manager β SDK Tools tab
- Check "Show Package Details" β expand "NDK (Side by side)"
- Select version 27.1.12297006 and click Apply
-
Run the app
For iOS:
npx react-native run-ios
For Android:
npx react-native run-android
For better control and visibility of logs, run Metro bundler and the app build in separate terminals:
Terminal 1 - Start Metro Bundler:
cd react-native-starter-app
npx react-native startWait until you see "Dev server ready", then in a second terminal:
Terminal 2 - Build & Run the App:
cd react-native-starter-app
# For iOS
npx react-native run-ios
# For Android
npx react-native run-androidNote: The first Android build takes 5-10 minutes as it compiles native C++ code. Subsequent builds are much faster.
When running on a physical Android device, you need to set up port forwarding for the Metro bundler:
# Connect your device via USB and verify it's detected
adb devices
# Set up port forwarding (required for each USB session)
adb reverse tcp:8081 tcp:8081
# Start Metro bundler in one terminal
npx react-native start
# Run the app in another terminal
npx react-native run-androidTip: If you see "Could not connect to development server", run
adb reverse tcp:8081 tcp:8081again.
The app requires microphone access. Permissions are already configured in ios/RunAnywhereStarter/Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access for speech recognition and voice agent features</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This app uses on-device speech recognition to transcribe your voice</string>Required permissions are configured in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />src/
βββ App.tsx # Main app entry, SDK initialization
βββ theme/
β βββ colors.ts # Color palette and theme
βββ services/
β βββ ModelService.tsx # Model management (download, load, state)
βββ components/
β βββ FeatureCard.tsx # Home screen feature cards
β βββ ModelLoaderWidget.tsx # Model download/load UI
β βββ ChatMessageBubble.tsx # Chat message UI
β βββ AudioVisualizer.tsx # Audio level visualization
βββ screens/
β βββ HomeScreen.tsx # Main navigation screen
β βββ ChatScreen.tsx # LLM chat interface
β βββ SpeechToTextScreen.tsx # STT interface
β βββ TextToSpeechScreen.tsx # TTS interface
β βββ VoicePipelineScreen.tsx # Voice agent interface
βββ navigation/
βββ types.ts # Navigation type definitions
The app comes preconfigured with these models:
| Model | Purpose | Size | Source |
|---|---|---|---|
| SmolLM2 360M Q8_0 | Text generation | ~400MB | HuggingFace |
| Sherpa ONNX Whisper Tiny EN | Speech recognition | ~80MB | RunAnywhere |
| Piper TTS (US English) | Voice synthesis | ~100MB | RunAnywhere |
You can modify src/services/ModelService.tsx to use different models:
// LLM Model - Example with a larger model
await LlamaCpp.addModel({
id: 'qwen2-1.5b-q4',
name: 'Qwen2 1.5B Q4',
url: 'https://huggingface.co/...',
memoryRequirement: 1500000000,
});
// STT Model - Example with multilingual support
await Onnx.addModel({
id: 'whisper-small-multi',
name: 'Whisper Small Multilingual',
url: 'https://...',
modality: ModelCategory.speechRecognition,
});The app uses a custom dark theme defined in src/theme/colors.ts. You can customize:
export const AppColors = {
primaryDark: '#0A0E1A',
accentCyan: '#00D9FF',
accentViolet: '#8B5CF6',
// ... more colors
};All AI processing happens on-device. No data is sent to external servers. The models are downloaded once and stored locally on the device.
- β No internet required after model download
- β All inference runs locally
- β Your conversations never leave your device
- β No API keys or cloud services needed
This happens on physical Android devices because they can't reach localhost on your computer.
# Set up port forwarding
adb reverse tcp:8081 tcp:8081
# Verify Metro is running
curl http://localhost:8081/status # Should return "packager-status:running"This happens when codegen hasn't run yet. Simply run the build again:
cd android && ./gradlew assembleDebugThe second run will succeed as codegen completes.
- Check your internet connection
- Ensure sufficient storage space (models can be 100MB-1GB)
- Check iOS/Android permissions
- Clear app data and try again
- Grant microphone permission in device settings
- Restart the app after granting permission
- On Android, check if permission is granted in AndroidManifest.xml
- Smaller models (like SmolLM2 360M) work better on mobile devices
- Close other apps to free up memory
- Use quantized models (Q4/Q8) for better performance
- Ensure you're running on a physical device (simulators are slow)
- Clear cache:
cd android && ./gradlew cleanorcd ios && rm -rf Pods Podfile.lock - Reinstall dependencies:
rm -rf node_modules && npm install - For iOS:
cd ios && pod install --repo-update - For Android: Delete
android/app/buildandandroid/.gradlefolders, then rebuild
If you see errors about NDK not found:
# Check if NDK 27 is installed
ls ~/Library/Android/sdk/ndk/
# If missing, install via Android Studio SDK Manager or:
sdkmanager "ndk;27.1.12297006"Ensure local.properties exists in the android/ folder with your SDK path:
sdk.dir=/Users/<username>/Library/Android/sdkThis file is auto-generated when you open the project in Android Studio.
If you see build errors related to react-native-nitro-modules, ensure patches are applied:
npx patch-packageThis should run automatically via postinstall, but you can run it manually if needed.
We welcome contributions! Please see our Contributing Guide for details.
This starter app is provided under the MIT License. The RunAnywhere SDK is licensed under the RunAnywhere License.
For commercial licensing inquiries, contact: san@runanywhere.ai
- GitHub Issues: Report bugs
- Email: san@runanywhere.ai
- Documentation: runanywhere.ai
- Discord: Join our community
- Explore the code: Check out each screen to understand how the SDK works
- Try different models: Swap in your own models to see what works best
- Build your app: Use this as a foundation for your own AI-powered app
- Share feedback: Let us know what you think and what features you'd like to see
Built with:
Special thanks to the open-source community and the RunAnywhere team!
Made with β€οΈ by the RunAnywhere team