How az11k-dev/jarvis-app works
Project Type & Purpose
• Type: Cross-platform mobile application (React Native/Expo)
• Purpose: Listen to voice commands, process them via OpenAI/GitHub/web APIs, and respond with TTS or actions (app launches, notifications).
File Structure
• Native folders:
– android/… (Android Gradle project, Java/Kotlin entry points)
– ios/… (Xcode project, Swift/Objective-C bridging)
• JavaScript code under src/…:
– components/ (UI)
– screens/ (views/routes)
– services/ (API calls & business logic)
– core/github/ (GitHub–specific commands)
– hooks/, utils/, styles/
• Config: app.config.js, eas.json, package.json, .env expectations.
Main Components
A. Presentation Layer (UI)
• React Native Screens & Components (Home, MicrophoneButton, ResponseBox, VoicePickerModal, AccessDenied)
B. Business Logic / Orchestration
• services/jarvisService.jsx (central command workflow)
• services/ttsService.jsx (expo-speech wrapper)
• services/notificationsService.jsx (expo-notifications)
• core/github/* (createRepo, deleteRepo, commits)
C. Hooks & Utilities
• useVoiceSetup (initializing audio recording)
• utils/auth.jsx (AsyncStorage + expo-local-authentication)
• utils/constants.jsx
D. Native Modules & Expo APIs
• expo-av (Audio recording/STT)
• expo-speech (TTS)
• expo-local-authentication (FaceID/TouchID)
• expo-notifications
E. External Services
• OpenAI API (GPT requests)
• GitHub REST API
• Web fetch (internet-aware intelligence)
• Deep linking / Intent framework (launch YouTube, Telegram, etc.)
F. Data Storage
• AsyncStorage (session memory)
G. Native Hosts
• Android (MainActivity.kt, Gradle)
• iOS (AppDelegate.swift, bridging header)
Relationships & Data Flows
1) User taps “Mic” (UI) → React Native JS thread
2) useVoiceSetup initializes expo-av recorder (Native)
3) Audio stream → STT (either cloud or expo-speech) → Text
4) jarvisService orchestrates:
– Sends text + context to OpenAI API → receives reply
– Alternatively calls GitHub APIs via core/github
– Parses “open YouTube” → triggers deep link
5) jarvisService passes reply text to ttsService → expo-speech (Native)
6) NotificationsService schedules local reminders via expo-notifications
7) AsyncStorage stores recent commands/context
8) utils/auth enforces biometric before app start
Architectural Patterns & Principles
• Layered architecture: UI → Services → API/Native
• Single Responsibility: each service handles one domain (TTS, notifications, GitHub)
• Hooks for cross-cutting concerns (voice init)
• Async event flow (promises/async-await)
• Native bridging via Expo modules