git.iko.soy/opencode-android
on 3dd06b2 help sign in
git clone ssh://git.iko.soy/opencode-android

opencode-android

An Android client for the opencode server, built with Crux (shared Rust core + Kotlin shell) and Jetpack Compose.

Architecture

┌─────────────────────────────────────────────────┐
│  Shell (Kotlin / Jetpack Compose)               │
│  ┌─────────────┐  ┌──────────────────────────┐  │
│  │ Compose UI   │  │  HttpClient / SseClient  │  │
│  │ (3 screens)  │  │  (Ktor + OkHttp)         │  │
│  └──────┬───────┘  └────────────┬─────────────┘  │
│         │                       │                │
│    Event (bincode)        Effect (bincode)        │
│         │                       ▲                │
│  ┌──────▼───────────────────────┴────────────┐   │
│  │  Core (ViewModel) — FFI bridge            │   │
│  │  CoreFfi → NativeCoreFfi / PureCoreFfi    │   │
│  └───────────────────────────────────────────┘   │
└──────────┬──────────────────────────────────────┘
           │  JNI (bincode bytes)
┌──────────▼──────────────────────────────────────┐
│  Core (Rust / Crux)                              │
│  ┌────────┐  ┌─────────┐  ┌──────────┐          │
│  │  App   │  │  Model  │  │ Commands │          │
│  │ update │  │ state   │  │ effects  │          │
│  └────────┘  └─────────┘  └──────────┘          │
│  No side-effects — pure logic                   │
└─────────────────────────────────────────────────┘

Rust Core (shared/)

Kotlin Shell (app/)

Generated Types (generated/)

Building

Prerequisites

Generate Kotlin types

cd shared
cargo run --bin codegen --features codegen -- --language kotlin --output-dir ../generated

Build native library (requires NDK)

# Install Android targets
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android

# Build and pack with BoltFFI
boltffi pack android

Build the APK

./gradlew assembleDebug

The app works without the native library — PureCoreFfi provides a pure-Kotlin reimplementation of the core logic. When libopencode.so is present, NativeCoreFfi is used automatically.

Run tests

# Rust core tests
cd shared && cargo test

# Kotlin shell tests
./gradlew testDebugUnitTest

API Coverage

The client connects to an opencode server and supports:

Configuration

The default server URL is http://localhost:4096. Change it in the Connect screen. android:usesCleartextTraffic="true" is enabled for local development.