React Native SDK architecture
@orga-ai/react-native translates the shared Orga core runtime into a mobile-aware stack. It wraps Expo/bare apps with a provider, orchestrates native WebRTC modules, and still relies on your backend for credential minting.
Layer map
| Layer | What it owns |
|---|---|
| UI | Camera previews, control overlays, navigation decisions. |
| React Native SDK | Provider lifecycle, hook state, native module coordination. |
| Core | Config storage, logging, sending SDP offers to Orga Cloud. |
| Backend | Secret storage (ORGA_API_KEY) and credential exchange. |
Session timeline
Key behaviors:
react-native-webrtchandles peer connections, ICE gathering, and rendering through<RTCView>(wrapped by<OrgaAICameraView>).react-native-incall-managermanages audio focus and routing (speaker, receiver, Bluetooth).- The provider listens for AppState changes to pause/resume gracefully when the app background/foreground transitions.
Interaction with the backend
Your backend (commonly a Node SDK route hosted in Expo API Routes, Next.js API Routes, or any HTTP service) remains the security boundary. It alone touches the permanent API key, calls Orga’s REST endpoints, and hands the mobile client short-lived credentials.
🔒 Security recap: mobile clients never see
sk_orga_ai_*. They only receiveephemeralToken+iceServers, both of which expire quickly.
Native considerations
- Permissions – iOS Info.plist and Android manifest entries must be in place before
startSession()is called; otherwise the OS will deny camera/mic access. - Expo dev builds – Because the SDK depends on native modules, Expo Go is not sufficient. Ship a dev build even for local QA.
- Audio routing –
incall-managerdefaults to the device speaker; your UI can callsetSpeakerphoneOnorchooseAudioRoutefor more control. - Lifecycle – Tie
OrgaAIProviderto the top of your app (typically_layout.tsx) so navigation changes do not reinitialize the client mid-call.
Related reading
- Need the conceptual background for credential exchange? Review the WebRTC model explanation.
- Planning the backend side? See the Node SDK architecture explanation.
- Ready for hands-on steps? Follow the React Native tutorial and consult the React Native reference.
Last updated on