# beppe2880/opencode-mobile architecture

> Architecture diagram of the GitHub repository beppe2880/opencode-mobile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beppe2880/opencode-mobile
- Repository: https://github.com/beppe2880/opencode-mobile

## Overview

OpenCode Mobile is a native Android/iOS client for an existing OpenCode server. Users connect to a server, choose or resume a session, follow live agent work, and send prompts or answer permission and form requests; they can then inspect changes, files, and terminal output. The shared app sits above repositories and a generated API/network client. The README documents further branches including settings, usage, integrations, voice, widgets, and platform-specific background and sharing features. Several feature implementations were not sampled, so those branches are shown without inferred internal call chains.

Main entry points: [`android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/Composer.kt`](https://github.com/beppe2880/opencode-mobile/blob/main/android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/Composer.kt) (Chat and composer), [`android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt`](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt) (Session repository), [`android/shared/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/navigation/AppNavHost.kt`](https://github.com/beppe2880/opencode-mobile/blob/main/android/shared/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/navigation/AppNavHost.kt) (App navigation), [`android/feature/sessions/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/sessions`](https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/sessions/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/sessions) (Session list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_android_entry["Android entry<br/>[MainActivity.kt]"]
  node_ios_entry["iOS entry"]
  node_navigation["App navigation<br/>[AppNavHost.kt]"]
  node_settings["Settings and themes"]
end

subgraph group_session["Sessions and chat"]
  node_session_list["Session list"]
  node_chat["Chat and composer<br/>[Composer.kt]"]
  node_domain["Session domain"]
  node_usage["Usage statistics"]
end

subgraph group_services["Server and data"]
  node_session_data["Session repository"]
  node_server_profiles[("Saved servers")]
  node_client["OpenCode client<br/>[OpenCodeClient.kt]"]
  node_session_api["Session API<br/>[SessionApi.kt]"]
end

subgraph group_capabilities["Review and tools"]
  node_review["Diffs and files"]
  node_terminal["Remote terminal"]
  node_integrations["MCP connections"]
end

subgraph group_platform["Platform features"]
  node_voice["Voice input"]
  node_notifications["Session notifications"]
  node_widgets["Session widgets<br/>[SessionsWidget.kt]"]
  node_sharing["Share-to-session<br/>[ShareActivity.kt]"]
end

node_user(("Phone user"))
node_server{{"OpenCode server"}}

node_user -->|"opens app"| node_android_entry
node_user -->|"opens app"| node_ios_entry
node_android_entry -->|"hosts"| node_navigation
node_ios_entry -->|"hosts"| node_navigation
node_navigation -.->|"shows sessions"| node_session_list
node_navigation -.->|"opens session"| node_chat
node_session_list -.->|"loads sessions"| node_session_data
node_chat -.->|"sends prompts"| node_session_data
node_chat -->|"uses models"| node_domain
node_session_data -->|"uses client"| node_client
node_session_data -->|"calls sessions"| node_session_api
node_client -.->|"requests data"| node_server
node_session_api -->|"HTTP requests"| node_server
node_server_profiles -.->|"configures connection"| node_client
node_chat -.->|"supports review"| node_review
node_chat -.->|"opens terminal"| node_terminal
node_navigation -.->|"opens settings"| node_settings
node_settings -->|"previews chat"| node_chat
node_settings -->|"previews sessions"| node_session_list
node_session_data -.->|"provides activity"| node_usage
node_chat -.->|"manages MCP"| node_integrations
node_chat -->|"dictates prompts"| node_voice
node_session_data -.->|"monitors sessions"| node_notifications
node_session_list -.->|"surfaces sessions"| node_widgets
node_android_entry -->|"handles shared content"| node_sharing

click node_android_entry "https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/MainActivity.kt"
click node_ios_entry "https://github.com/beppe2880/opencode-mobile/blob/main/android/shared/src/iosMain/kotlin/io/github/beppe2880/opencodemobile/MainViewController.kt"
click node_navigation "https://github.com/beppe2880/opencode-mobile/blob/main/android/shared/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/navigation/AppNavHost.kt"
click node_session_list "https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/sessions/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/sessions"
click node_chat "https://github.com/beppe2880/opencode-mobile/blob/main/android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/Composer.kt"
click node_domain "https://github.com/beppe2880/opencode-mobile/tree/main/android/core/domain/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/domain"
click node_session_data "https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt"
click node_server_profiles "https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/server/StoredServerRepository.kt"
click node_client "https://github.com/beppe2880/opencode-mobile/blob/main/android/core/network/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/network/OpenCodeClient.kt"
click node_session_api "https://github.com/beppe2880/opencode-mobile/blob/main/android/core/api/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/api/apis/SessionApi.kt"
click node_review "https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat"
click node_terminal "https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/terminal/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/terminal"
click node_integrations "https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/integration/RemoteIntegrationRepository.kt"
click node_settings "https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/settings/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/settings"
click node_usage "https://github.com/beppe2880/opencode-mobile/tree/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data"
click node_voice "https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/voice/VoiceRecordingService.kt"
click node_notifications "https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/notifications/SessionMonitorService.kt"
click node_widgets "https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/widget/SessionsWidget.kt"
click node_sharing "https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/share/ShareActivity.kt"

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_android_entry,node_ios_entry,node_navigation,node_settings,node_user toneBlue
class node_session_list,node_chat,node_domain,node_usage toneAmber
class node_session_data,node_server_profiles,node_client,node_session_api,node_server toneMint
class node_review,node_terminal,node_integrations toneRose
class node_voice,node_notifications,node_widgets,node_sharing toneIndigo
```

## Components

### App and navigation

- [Android entry](https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/MainActivity.kt): `android/app/src/main/java/io/github/beppe2880/opencodemobile/MainActivity.kt`
- [iOS entry](https://github.com/beppe2880/opencode-mobile/blob/main/android/shared/src/iosMain/kotlin/io/github/beppe2880/opencodemobile/MainViewController.kt): `android/shared/src/iosMain/kotlin/io/github/beppe2880/opencodemobile/MainViewController.kt`
- [App navigation](https://github.com/beppe2880/opencode-mobile/blob/main/android/shared/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/navigation/AppNavHost.kt): `android/shared/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/navigation/AppNavHost.kt`
- [Settings and themes](https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/settings/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/settings): `android/feature/settings/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/settings`

### Sessions and chat

- [Session list](https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/sessions/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/sessions): `android/feature/sessions/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/sessions`
- [Chat and composer](https://github.com/beppe2880/opencode-mobile/blob/main/android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/Composer.kt): `android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/Composer.kt`
- [Session domain](https://github.com/beppe2880/opencode-mobile/tree/main/android/core/domain/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/domain): `android/core/domain/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/domain`
- [Usage statistics](https://github.com/beppe2880/opencode-mobile/tree/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data): `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data`

### Server and data

- [Session repository](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt): `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt`
- [Saved servers](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/server/StoredServerRepository.kt): `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/server/StoredServerRepository.kt`
- [OpenCode client](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/network/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/network/OpenCodeClient.kt): `android/core/network/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/network/OpenCodeClient.kt`
- [Session API](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/api/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/api/apis/SessionApi.kt): `android/core/api/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/api/apis/SessionApi.kt`

### Review and tools

- [Diffs and files](https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat): `android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat`
- [Remote terminal](https://github.com/beppe2880/opencode-mobile/tree/main/android/feature/terminal/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/terminal): `android/feature/terminal/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/terminal`
- [MCP connections](https://github.com/beppe2880/opencode-mobile/blob/main/android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/integration/RemoteIntegrationRepository.kt): `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/integration/RemoteIntegrationRepository.kt`

### Platform features

- [Voice input](https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/voice/VoiceRecordingService.kt): `android/app/src/main/java/io/github/beppe2880/opencodemobile/voice/VoiceRecordingService.kt`
- [Session notifications](https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/notifications/SessionMonitorService.kt): `android/app/src/main/java/io/github/beppe2880/opencodemobile/notifications/SessionMonitorService.kt`
- [Session widgets](https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/widget/SessionsWidget.kt): `android/app/src/main/java/io/github/beppe2880/opencodemobile/widget/SessionsWidget.kt`
- [Share-to-session](https://github.com/beppe2880/opencode-mobile/blob/main/android/app/src/main/java/io/github/beppe2880/opencodemobile/share/ShareActivity.kt): `android/app/src/main/java/io/github/beppe2880/opencodemobile/share/ShareActivity.kt`

### Other components

- **Phone user**
- **OpenCode server**

## Connections

- Phone user → Android entry: opens app (evidence: `README.md`)
- Phone user → iOS entry: opens app (evidence: `README.md`)
- Android entry → App navigation: hosts (evidence: `android/app/src/main/java/io/github/beppe2880/opencodemobile/MainActivity.kt`)
- iOS entry → App navigation: hosts (evidence: `android/shared/src/iosMain/kotlin/io/github/beppe2880/opencodemobile/MainViewController.kt`)
- App navigation → Session list: shows sessions
- App navigation → Chat and composer: opens session
- Session list → Session repository: loads sessions
- Chat and composer → Session repository: sends prompts
- Chat and composer → Session domain: uses models (evidence: `android/feature/chat/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/feature/chat/ChatPreview.kt`)
- Session repository → OpenCode client: uses client (evidence: `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt`)
- Session repository → Session API: calls sessions (evidence: `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt`)
- OpenCode client → OpenCode server: requests data
- Session API → OpenCode server: HTTP requests (evidence: `android/core/api/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/api/apis/SessionApi.kt`)
- Saved servers → OpenCode client: configures connection
- Chat and composer → Diffs and files: supports review (evidence: `README.md`)
- Chat and composer → Remote terminal: opens terminal (evidence: `README.md`)
- App navigation → Settings and themes: opens settings
- Settings and themes → Chat and composer: previews chat
- Settings and themes → Session list: previews sessions
- Session repository → Usage statistics: provides activity (evidence: `android/core/data/src/commonMain/kotlin/io/github/beppe2880/opencodemobile/core/data/session/RemoteSessionRepository.kt`)
- Chat and composer → MCP connections: manages MCP (evidence: `README.md`)
- Chat and composer → Voice input: dictates prompts (evidence: `README.md`)
- Session repository → Session notifications: monitors sessions
- Session list → Session widgets: surfaces sessions (evidence: `README.md`)
- Android entry → Share-to-session: handles shared content (evidence: `android/app/src/main/java/io/github/beppe2880/opencodemobile/MainActivity.kt`)
