# jiyahan/gpui-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/jiyahan/gpui-mobile
- Repository: https://github.com/jiyahan/gpui-mobile

## Overview

GPUI Mobile is a Rust mobile platform layer and component library for running GPUI applications natively on iOS and Android, with an experimental minimal OHOS host. The primary workflow is an application selecting the current platform, receiving native input and lifecycle events, and rendering a GPUI scene through the mobile window and GPU stack. Separate branches provide reusable design-system components and feature-gated mobile-operation packages. Platform wiring is documented and partly sampled; package implementations beyond the camera, video, and maps excerpts are represented at their documented module boundary.

Main entry points: [`src/packages/mod.rs`](https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/mod.rs) (Package APIs), [`src/android/mod.rs`](https://github.com/jiyahan/gpui-mobile/blob/main/src/android/mod.rs) (Android Host), [`src/components/mod.rs`](https://github.com/jiyahan/gpui-mobile/blob/main/src/components/mod.rs) (Design Components), [`src/ios/window.rs`](https://github.com/jiyahan/gpui-mobile/blob/main/src/ios/window.rs) (iOS Window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform Hosts"]
  node_api["Public API<br/>[lib.rs]"]
  node_ios["iOS Host<br/>[mod.rs]"]
  node_android["Android Host<br/>[mod.rs]"]
  node_ohos["OHOS Host<br/>[mod.rs]"]
end

subgraph group_rendering["Input And Rendering"]
  node_ios_window["iOS Window<br/>[window.rs]"]
  node_android_window["Android Window<br/>[window.rs]"]
  node_android_jni["Android JNI<br/>[jni.rs]"]
  node_dispatch["Platform Dispatch<br/>[dispatcher.rs]"]
  node_frame["Frame Scheduling<br/>[frame_demand.rs]"]
  node_renderer["GPU And Text"]
  node_platform_views["Platform Views<br/>[platform_view.rs]"]
end

subgraph group_ui["UI Components"]
  node_components["Design Components<br/>[mod.rs]"]
  node_glass["Glass Components<br/>[mod.rs]"]
  node_material["Material Components<br/>[mod.rs]"]
  node_shared_components["Shared Components<br/>[mod.rs]"]
end

subgraph group_capabilities["Mobile Capabilities"]
  node_packages["Package APIs<br/>[mod.rs]"]
  node_camera["Camera<br/>[mod.rs]"]
  node_video["Video Player<br/>[mod.rs]"]
  node_maps["Embedded Maps<br/>[mod.rs]"]
  node_native_apis{{"Native APIs"}}
end

node_app(("GPUI App"))
node_native_os{{"Mobile OS"}}

node_app -->|"selects platform"| node_api
node_api -->|"dispatches to"| node_ios
node_api -->|"dispatches to"| node_android
node_app -.->|"registers host"| node_ohos
node_ios -->|"creates windows"| node_ios_window
node_android -->|"creates windows"| node_android_window
node_android -->|"provides dispatcher"| node_dispatch
node_android -->|"uses JNI"| node_android_jni
node_native_os -->|"delivers events"| node_android_jni
node_native_os -->|"provides events"| node_ios_window
node_android_window -->|"requests frames"| node_frame
node_ios_window -->|"requests frames"| node_frame
node_android_window -->|"renders via"| node_renderer
node_ios_window -->|"renders via"| node_renderer
node_ohos -.->|"renders via"| node_renderer
node_app -->|"composes UI"| node_components
node_components -->|"offers"| node_glass
node_components -->|"offers"| node_material
node_components -->|"offers"| node_shared_components
node_app -->|"calls capabilities"| node_packages
node_packages -->|"exposes"| node_camera
node_packages -->|"exposes"| node_video
node_packages -->|"exposes"| node_maps
node_camera -->|"creates preview"| node_platform_views
node_video -->|"embeds surface"| node_platform_views
node_maps -->|"embeds map"| node_platform_views
node_camera -->|"controls camera"| node_native_apis
node_video -->|"controls playback"| node_native_apis
node_maps -->|"uses map SDK"| node_native_apis
node_packages -.->|"invokes platform APIs"| node_native_apis

click node_api "https://github.com/jiyahan/gpui-mobile/blob/main/src/lib.rs"
click node_ios "https://github.com/jiyahan/gpui-mobile/blob/main/src/ios/mod.rs"
click node_android "https://github.com/jiyahan/gpui-mobile/blob/main/src/android/mod.rs"
click node_ohos "https://github.com/jiyahan/gpui-mobile/blob/main/src/ohos/mod.rs"
click node_ios_window "https://github.com/jiyahan/gpui-mobile/blob/main/src/ios/window.rs"
click node_android_window "https://github.com/jiyahan/gpui-mobile/blob/main/src/android/window.rs"
click node_android_jni "https://github.com/jiyahan/gpui-mobile/blob/main/src/android/jni.rs"
click node_dispatch "https://github.com/jiyahan/gpui-mobile/blob/main/src/android/dispatcher.rs"
click node_frame "https://github.com/jiyahan/gpui-mobile/blob/main/src/frame_demand.rs"
click node_platform_views "https://github.com/jiyahan/gpui-mobile/blob/main/src/platform_view.rs"
click node_components "https://github.com/jiyahan/gpui-mobile/blob/main/src/components/mod.rs"
click node_glass "https://github.com/jiyahan/gpui-mobile/blob/main/src/components/glass/mod.rs"
click node_material "https://github.com/jiyahan/gpui-mobile/blob/main/src/components/material/mod.rs"
click node_shared_components "https://github.com/jiyahan/gpui-mobile/blob/main/src/components/shared/mod.rs"
click node_packages "https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/mod.rs"
click node_camera "https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/camera/mod.rs"
click node_video "https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/video_player/mod.rs"
click node_maps "https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/maps/mod.rs"

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_api,node_ios,node_android,node_ohos,node_app toneBlue
class node_ios_window,node_android_window,node_android_jni,node_dispatch,node_frame,node_renderer,node_platform_views toneAmber
class node_components,node_glass,node_material,node_shared_components toneMint
class node_packages,node_camera,node_video,node_maps,node_native_apis toneRose
class node_native_os toneIndigo
```

## Components

### Platform Hosts

- [Public API](https://github.com/jiyahan/gpui-mobile/blob/main/src/lib.rs): `src/lib.rs`
- [iOS Host](https://github.com/jiyahan/gpui-mobile/blob/main/src/ios/mod.rs): `src/ios/mod.rs`
- [Android Host](https://github.com/jiyahan/gpui-mobile/blob/main/src/android/mod.rs): `src/android/mod.rs`
- [OHOS Host](https://github.com/jiyahan/gpui-mobile/blob/main/src/ohos/mod.rs): `src/ohos/mod.rs`

### Input And Rendering

- [iOS Window](https://github.com/jiyahan/gpui-mobile/blob/main/src/ios/window.rs): `src/ios/window.rs`
- [Android Window](https://github.com/jiyahan/gpui-mobile/blob/main/src/android/window.rs): `src/android/window.rs`
- [Android JNI](https://github.com/jiyahan/gpui-mobile/blob/main/src/android/jni.rs): `src/android/jni.rs`
- [Platform Dispatch](https://github.com/jiyahan/gpui-mobile/blob/main/src/android/dispatcher.rs): `src/android/dispatcher.rs`
- [Frame Scheduling](https://github.com/jiyahan/gpui-mobile/blob/main/src/frame_demand.rs): `src/frame_demand.rs`
- **GPU And Text**
- [Platform Views](https://github.com/jiyahan/gpui-mobile/blob/main/src/platform_view.rs): `src/platform_view.rs`

### UI Components

- [Design Components](https://github.com/jiyahan/gpui-mobile/blob/main/src/components/mod.rs): `src/components/mod.rs`
- [Glass Components](https://github.com/jiyahan/gpui-mobile/blob/main/src/components/glass/mod.rs): `src/components/glass/mod.rs`
- [Material Components](https://github.com/jiyahan/gpui-mobile/blob/main/src/components/material/mod.rs): `src/components/material/mod.rs`
- [Shared Components](https://github.com/jiyahan/gpui-mobile/blob/main/src/components/shared/mod.rs): `src/components/shared/mod.rs`

### Mobile Capabilities

- [Package APIs](https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/mod.rs): `src/packages/mod.rs`
- [Camera](https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/camera/mod.rs): `src/packages/camera/mod.rs`
- [Video Player](https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/video_player/mod.rs): `src/packages/video_player/mod.rs`
- [Embedded Maps](https://github.com/jiyahan/gpui-mobile/blob/main/src/packages/maps/mod.rs): `src/packages/maps/mod.rs`
- **Native APIs**

### Other components

- **GPUI App**
- **Mobile OS**

## Connections

- GPUI App → Public API: selects platform
- Public API → iOS Host: dispatches to
- Public API → Android Host: dispatches to
- GPUI App → OHOS Host: registers host
- iOS Host → iOS Window: creates windows
- Android Host → Android Window: creates windows
- Android Host → Platform Dispatch: provides dispatcher
- Android Host → Android JNI: uses JNI
- Mobile OS → Android JNI: delivers events
- Mobile OS → iOS Window: provides events
- Android Window → Frame Scheduling: requests frames
- iOS Window → Frame Scheduling: requests frames
- Android Window → GPU And Text: renders via
- iOS Window → GPU And Text: renders via
- OHOS Host → GPU And Text: renders via
- GPUI App → Design Components: composes UI
- Design Components → Glass Components: offers
- Design Components → Material Components: offers
- Design Components → Shared Components: offers
- GPUI App → Package APIs: calls capabilities
- Package APIs → Camera: exposes
- Package APIs → Video Player: exposes
- Package APIs → Embedded Maps: exposes
- Camera → Platform Views: creates preview
- Video Player → Platform Views: embeds surface
- Embedded Maps → Platform Views: embeds map
- Camera → Native APIs: controls camera
- Video Player → Native APIs: controls playback
- Embedded Maps → Native APIs: uses map SDK
- Package APIs → Native APIs: invokes platform APIs
