# pushpak1203/kudo-voice-bot architecture

> Architecture diagram of the GitHub repository pushpak1203/kudo-voice-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pushpak1203/kudo-voice-bot
- Repository: https://github.com/pushpak1203/kudo-voice-bot

## Overview

#### Purpose and entry points
This is a React Native mobile controller for a Bluetooth-connected robot, with voice and manual command paths, robot-status display, and command history. JavaScript starts at `index.js`, mounts `App.tsx`, then composes application providers and navigation. Native shells target Android and iOS.

#### Application composition and navigation
`App.tsx` is the top-level UI boundary. `app/providers/AppProviders.tsx` centralizes cross-screen providers, including robot status state; `app/navigation/AppNavigator.tsx` defines the screen flow. Primary user surfaces cover splash, dashboard, Bluetooth pairing, manual/voice controls, status, history, and settings under `app/screens/`.

#### Domain model and state
Typed models separate UI from robot transport semantics: commands, messages, connection state, health, and status are represented in `app/models/RobotCommand.ts`, `app/models/RobotMessage.ts`, and `app/models/RobotStatus.ts`. Shared live robot state is exposed through `app/hooks/RobotStatusContext.tsx`; dedicated hooks provide Bluetooth and history-facing behavior in `app/hooks/useBluetooth.ts` and `app/hooks/useHistory.ts`.

#### Command and Bluetooth pipeline
User actions from control screens are converted into domain commands, handled by `app/services/command/CommandService.ts`, serialized via `app/services/protocol/ProtocolSerializer.ts`, and sent through the Bluetooth service abstraction. `app/services/bluetooth/IBluetoothService.ts` defines the transport boundary, while `BluetoothService.ts` is the device implementation and `MockBluetoothService.ts` supports non-device execution. `app/services/connection/ConnectionManager.ts` owns connection lifecycle coordination.

#### Incoming robot data and persistence
Bluetooth payloads enter through the transport layer, are decoded by `app/services/protocol/ProtocolParser.ts`, and update status through `app/services/status/RobotStatusService.ts`. Command events are retained through `app/services/history/HistoryService.ts` for the history screen. This establishes a bidirectional boundary: mobile commands are serialized outbound; robot telemetry/messages are parsed inbound.

#### Voice and platform permissions
Voice input is isolated behind `app/services/voice/VoiceService.ts`; `app/services/voice/IntentMapper.ts` maps recognized intent to robot commands rather than letting UI directly control transport. Permissions are centralized at `app/permissions/PermissionService.ts`. Android additionally contains a custom native React Native bridge in `android/app/src/main/java/com/pananivoicebot/VoiceRecognitionModule.kt`, registered by `VoiceRecognitionPackage.kt`, indicating platform speech-recognition integration.

#### Robot firmware and protocol boundary
The robot endpoint is Arduino firmware rooted at `arduino_firmware/src/main.ino`. It composes Bluetooth handling, motor control, and sensor management through `arduino_firmware/include/BluetoothHandler.h`, `MotorController.h`, and `SensorManager.h`; hardware pin assignments reside in `arduino_firmware/config/pinout.h`. Bluetooth message contract and state-machine behavior are architecturally documented in `docs/BluetoothProtocol.md` and `docs/RobotStateMachine.md`.

#### Runtime and infrastructure
The app runs in the React Native runtime with Metro for development, Gradle/Android native integration, and Xcode/CocoaPods for iOS. Android application bootstrap is `android/app/src/main/java/com/pananivoicebot/MainApplication.kt`; iOS bootstrap is `ios/PananiVoiceBot/AppDelegate.swift`. External/device-facing dependencies are Bluetooth hardware, Android voice recognition, microphone/Bluetooth permissions, and the Arduino robot; no backend service is indicated.

Main entry points: [`app/services/command/CommandService.ts`](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/command/CommandService.ts) (Command Service), [`app/services/voice/VoiceService.ts`](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/voice/VoiceService.ts) (Voice Service & Intent Mapper), [`app/services/bluetooth/BluetoothService.ts`](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/bluetooth/BluetoothService.ts) (Bluetooth Service), [`app/providers/AppProviders.tsx`](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/providers/AppProviders.tsx) (App Providers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["React Native App"]
  node_entry["JS Entry<br/>bootstrap<br/>[index.js]"]
  node_app["App Root<br/>UI composition<br/>[App.tsx]"]
  node_providers["App Providers<br/>provider composition<br/>[AppProviders.tsx]"]
  node_navigator["App Navigator<br/>navigation<br/>[AppNavigator.tsx]"]
  node_controls["Control Screens<br/>UI screens"]
  node_statuscontext["Robot Status Context<br/>live state"]
  node_models["Robot Domain Models<br/>typed contracts<br/>[RobotCommand.ts]"]
end

subgraph group_services["Application Services"]
  node_command["Command Service<br/>command orchestration<br/>[CommandService.ts]"]
  node_protocolout["Protocol Serializer<br/>protocol encoder"]
  node_bluetooth["Bluetooth Service<br/>transport implementation"]
  node_connection["Connection Manager<br/>connection lifecycle"]
  node_protocolin["Protocol Parser<br/>protocol decoder<br/>[ProtocolParser.ts]"]
  node_status["Robot Status Service<br/>telemetry state updater"]
  node_history[("History Service<br/>command event store<br/>[HistoryService.ts]")]
  node_voice["Voice Service &amp; Intent Mapper<br/>voice command pipeline<br/>[VoiceService.ts]"]
  node_permissions["Permission Service<br/>platform permissions"]
end

subgraph group_platform["Native &amp; Device"]
  node_androidvoice{{"Android Voice Bridge<br/>native React Native module"}}
end

subgraph group_firmware["Robot Firmware"]
  node_robot{{"Arduino Robot Firmware<br/>device endpoint<br/>[main.ino]"}}
end

node_entry -->|"mounts"| node_app
node_app -->|"composes"| node_providers
node_providers -->|"hosts"| node_navigator
node_navigator -->|"presents"| node_controls
node_providers -->|"provides"| node_statuscontext
node_controls -->|"manual commands"| node_command
node_controls -->|"voice input"| node_voice
node_voice -->|"uses native recognition"| node_androidvoice
node_voice -->|"requests microphone access"| node_permissions
node_voice -->|"mapped intent"| node_command
node_command -->|"uses commands"| node_models
node_command -->|"serializes"| node_protocolout
node_command -->|"records events"| node_history
node_protocolout -->|"outbound payload"| node_bluetooth
node_connection -->|"coordinates lifecycle"| node_bluetooth
node_bluetooth -->|"Bluetooth messages"| node_robot
node_bluetooth -->|"inbound payload"| node_protocolin
node_protocolin -->|"decoded telemetry"| node_status
node_status -->|"updates live state"| node_statuscontext
node_statuscontext -->|"drives status UI"| node_navigator

click node_entry "https://github.com/pushpak1203/kudo-voice-bot/blob/main/index.js"
click node_app "https://github.com/pushpak1203/kudo-voice-bot/blob/main/App.tsx"
click node_providers "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/providers/AppProviders.tsx"
click node_navigator "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/navigation/AppNavigator.tsx"
click node_statuscontext "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/hooks/RobotStatusContext.tsx"
click node_models "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/models/RobotCommand.ts"
click node_command "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/command/CommandService.ts"
click node_protocolout "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/protocol/ProtocolSerializer.ts"
click node_bluetooth "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/bluetooth/BluetoothService.ts"
click node_connection "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/connection/ConnectionManager.ts"
click node_protocolin "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/protocol/ProtocolParser.ts"
click node_status "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/status/RobotStatusService.ts"
click node_history "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/history/HistoryService.ts"
click node_voice "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/voice/VoiceService.ts"
click node_permissions "https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/permissions/PermissionService.ts"
click node_androidvoice "https://github.com/pushpak1203/kudo-voice-bot/blob/main/android/app/src/main/java/com/pananivoicebot/VoiceRecognitionModule.kt"
click node_robot "https://github.com/pushpak1203/kudo-voice-bot/blob/main/arduino_firmware/src/main.ino"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_app,node_providers,node_navigator,node_controls,node_statuscontext,node_models toneBlue
class node_command,node_protocolout,node_bluetooth,node_connection,node_protocolin,node_status,node_history,node_voice,node_permissions toneAmber
class node_androidvoice toneMint
class node_robot toneRose
```

## Components

### React Native App

- [JS Entry](https://github.com/pushpak1203/kudo-voice-bot/blob/main/index.js): bootstrap · `index.js`
- [App Root](https://github.com/pushpak1203/kudo-voice-bot/blob/main/App.tsx): UI composition · `App.tsx`
- [App Providers](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/providers/AppProviders.tsx): provider composition · Supplies shared robot status state. · `app/providers/AppProviders.tsx`
- [App Navigator](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/navigation/AppNavigator.tsx): navigation · Routes splash, dashboard, pairing, controls, status, history, and settings. · `app/navigation/AppNavigator.tsx`
- **Control Screens**: UI screens · Manual and voice actions originate here.
- [Robot Status Context](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/hooks/RobotStatusContext.tsx): live state · `app/hooks/RobotStatusContext.tsx`
- [Robot Domain Models](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/models/RobotCommand.ts): typed contracts · Commands, messages, connection state, health, and status. · `app/models/RobotCommand.ts`

### Application Services

- [Command Service](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/command/CommandService.ts): command orchestration · `app/services/command/CommandService.ts`
- [Protocol Serializer](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/protocol/ProtocolSerializer.ts): protocol encoder · `app/services/protocol/ProtocolSerializer.ts`
- [Bluetooth Service](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/bluetooth/BluetoothService.ts): transport implementation · Implements the Bluetooth transport abstraction; mock supports non-device runs. · `app/services/bluetooth/BluetoothService.ts`
- [Connection Manager](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/connection/ConnectionManager.ts): connection lifecycle · `app/services/connection/ConnectionManager.ts`
- [Protocol Parser](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/protocol/ProtocolParser.ts): protocol decoder · `app/services/protocol/ProtocolParser.ts`
- [Robot Status Service](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/status/RobotStatusService.ts): telemetry state updater · `app/services/status/RobotStatusService.ts`
- [History Service](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/history/HistoryService.ts): command event store · `app/services/history/HistoryService.ts`
- [Voice Service & Intent Mapper](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/services/voice/VoiceService.ts): voice command pipeline · Recognizes speech and maps intents to robot commands. · `app/services/voice/VoiceService.ts`
- [Permission Service](https://github.com/pushpak1203/kudo-voice-bot/blob/main/app/permissions/PermissionService.ts): platform permissions · `app/permissions/PermissionService.ts`

### Native & Device

- [Android Voice Bridge](https://github.com/pushpak1203/kudo-voice-bot/blob/main/android/app/src/main/java/com/pananivoicebot/VoiceRecognitionModule.kt): native React Native module · `android/app/src/main/java/com/pananivoicebot/VoiceRecognitionModule.kt`

### Robot Firmware

- [Arduino Robot Firmware](https://github.com/pushpak1203/kudo-voice-bot/blob/main/arduino_firmware/src/main.ino): device endpoint · Coordinates Bluetooth, motors, and sensors. · `arduino_firmware/src/main.ino`

## Connections

- JS Entry → App Root: mounts
- App Root → App Providers: composes
- App Providers → App Navigator: hosts
- App Navigator → Control Screens: presents
- App Providers → Robot Status Context: provides
- Control Screens → Command Service: manual commands
- Control Screens → Voice Service & Intent Mapper: voice input
- Voice Service & Intent Mapper → Android Voice Bridge: uses native recognition
- Voice Service & Intent Mapper → Permission Service: requests microphone access
- Voice Service & Intent Mapper → Command Service: mapped intent
- Command Service → Robot Domain Models: uses commands
- Command Service → Protocol Serializer: serializes
- Command Service → History Service: records events
- Protocol Serializer → Bluetooth Service: outbound payload
- Connection Manager → Bluetooth Service: coordinates lifecycle
- Bluetooth Service → Arduino Robot Firmware: Bluetooth messages · Bidirectional device transport.
- Bluetooth Service → Protocol Parser: inbound payload
- Protocol Parser → Robot Status Service: decoded telemetry
- Robot Status Service → Robot Status Context: updates live state
- Robot Status Context → App Navigator: drives status UI
