# rwkv-app/rwkv_app architecture

> Architecture diagram of the GitHub repository rwkv-app/rwkv_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rwkv-app/rwkv_app
- Repository: https://github.com/rwkv-app/rwkv_app

## Overview

RWKV App is documented as a cross-platform, local-first AI app: users select a model, then use chat, speech, or vision workflows, with an optional desktop API. The supplied tree does not include the Flutter app or inference-engine sources, so those documented capabilities are shown without invented implementation paths. The source available here mainly covers the Windows in-app webview plugin and native platform shells; its internal relationships are limited to those visible in excerpts or the source index.

Main entry points: [`packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h) (Windows plugin), [`packages/flutter_inappwebview_windows/windows/webview_environment/webview_environment_manager.cpp`](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/webview_environment/webview_environment_manager.cpp) (Environment manager), [`packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp`](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp) (Webview manager), [`packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp`](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp) (Headless manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["AI product capabilities"]
  node_modelchoice["Model selection"]
  node_models["Model downloads"]
  node_inference["On-device inference"]
  node_chat["AI chat"]
  node_speech["Text-to-speech"]
  node_vision["Visual understanding"]
  node_localapi["Local API"]
end

subgraph group_webview["Windows webview plugin"]
  node_plugin["Windows plugin"]
  node_webviewmgr["Webview manager"]
  node_headlessmgr["Headless manager"]
  node_browsermgr["Browser manager"]
  node_envmgr["Environment manager"]
  node_cookies["Cookie manager<br/>[cookie_manager.cpp]"]
  node_usercontent["User content"]
end

subgraph group_hosts["Platform hosts"]
  node_android["Android host<br/>[MainActivity.kt]"]
  node_ios["iOS host<br/>[AppDelegate.swift]"]
  node_windows["Windows host<br/>[main.cpp]"]
  node_macos["macOS host<br/>[AppDelegate.swift]"]
  node_linux["Linux host<br/>[main.cc]"]
end

node_user(("App user"))
node_hf(("Hugging Face"))

node_user -->|"selects model"| node_modelchoice
node_hf -->|"provides weights"| node_models
node_models -->|"offers models"| node_modelchoice
node_modelchoice -->|"loads model"| node_inference
node_user -->|"starts chat"| node_chat
node_user -->|"requests speech"| node_speech
node_user -->|"provides image"| node_vision
node_chat -->|"uses inference"| node_inference
node_speech -.->|"uses inference"| node_inference
node_vision -.->|"uses inference"| node_inference
node_user -.->|"enables endpoint"| node_localapi
node_plugin -->|"owns manager"| node_webviewmgr
node_plugin -->|"owns manager"| node_headlessmgr
node_plugin -->|"owns manager"| node_browsermgr
node_plugin -->|"owns manager"| node_envmgr
node_plugin -->|"owns manager"| node_cookies
node_webviewmgr -->|"uses environment"| node_envmgr
node_headlessmgr -->|"uses environment"| node_envmgr
node_cookies -->|"uses environment"| node_envmgr
node_android -.->|"hosts app"| node_user
node_ios -.->|"hosts app"| node_user
node_windows -.->|"hosts app"| node_user
node_macos -.->|"hosts app"| node_user
node_linux -.->|"hosts app"| node_user

click node_plugin "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h"
click node_webviewmgr "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp"
click node_headlessmgr "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp"
click node_browsermgr "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_browser/in_app_browser_manager.cpp"
click node_envmgr "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/webview_environment/webview_environment_manager.cpp"
click node_cookies "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/cookie_manager.cpp"
click node_usercontent "https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_webview/user_content_controller.cpp"
click node_android "https://github.com/rwkv-app/rwkv_app/blob/dev/android/app/src/main/kotlin/com/rwkvzone/chat/MainActivity.kt"
click node_ios "https://github.com/rwkv-app/rwkv_app/blob/dev/ios/Runner/AppDelegate.swift"
click node_windows "https://github.com/rwkv-app/rwkv_app/blob/dev/windows/runner/main.cpp"
click node_macos "https://github.com/rwkv-app/rwkv_app/blob/dev/macos/Runner/AppDelegate.swift"
click node_linux "https://github.com/rwkv-app/rwkv_app/blob/dev/linux/runner/main.cc"

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_modelchoice,node_models,node_inference,node_chat,node_speech,node_vision,node_localapi,node_user toneBlue
class node_plugin,node_webviewmgr,node_headlessmgr,node_browsermgr,node_envmgr,node_cookies,node_usercontent toneAmber
class node_android,node_ios,node_windows,node_macos,node_linux toneMint
class node_hf toneIndigo
```

## Components

### AI product capabilities

- **Model selection**
- **Model downloads**
- **On-device inference**
- **AI chat**
- **Text-to-speech**
- **Visual understanding**
- **Local API**

### Windows webview plugin

- [Windows plugin](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h): `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`
- [Webview manager](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp): `packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp`
- [Headless manager](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp): `packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp`
- [Browser manager](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_browser/in_app_browser_manager.cpp): `packages/flutter_inappwebview_windows/windows/in_app_browser/in_app_browser_manager.cpp`
- [Environment manager](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/webview_environment/webview_environment_manager.cpp): `packages/flutter_inappwebview_windows/windows/webview_environment/webview_environment_manager.cpp`
- [Cookie manager](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/cookie_manager.cpp): `packages/flutter_inappwebview_windows/windows/cookie_manager.cpp`
- [User content](https://github.com/rwkv-app/rwkv_app/blob/dev/packages/flutter_inappwebview_windows/windows/in_app_webview/user_content_controller.cpp): `packages/flutter_inappwebview_windows/windows/in_app_webview/user_content_controller.cpp`

### Platform hosts

- [Android host](https://github.com/rwkv-app/rwkv_app/blob/dev/android/app/src/main/kotlin/com/rwkvzone/chat/MainActivity.kt): `android/app/src/main/kotlin/com/rwkvzone/chat/MainActivity.kt`
- [iOS host](https://github.com/rwkv-app/rwkv_app/blob/dev/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`
- [Windows host](https://github.com/rwkv-app/rwkv_app/blob/dev/windows/runner/main.cpp): `windows/runner/main.cpp`
- [macOS host](https://github.com/rwkv-app/rwkv_app/blob/dev/macos/Runner/AppDelegate.swift): `macos/Runner/AppDelegate.swift`
- [Linux host](https://github.com/rwkv-app/rwkv_app/blob/dev/linux/runner/main.cc): `linux/runner/main.cc`

### Other components

- **App user**
- **Hugging Face**

## Connections

- App user → Model selection: selects model (evidence: `README.md`)
- Hugging Face → Model downloads: provides weights (evidence: `README.md`)
- Model downloads → Model selection: offers models (evidence: `README.md`)
- Model selection → On-device inference: loads model (evidence: `README.md`)
- App user → AI chat: starts chat (evidence: `README.md`)
- App user → Text-to-speech: requests speech (evidence: `README.md`)
- App user → Visual understanding: provides image (evidence: `README.md`)
- AI chat → On-device inference: uses inference (evidence: `README.md`)
- Text-to-speech → On-device inference: uses inference
- Visual understanding → On-device inference: uses inference
- App user → Local API: enables endpoint (evidence: `README.md`)
- Windows plugin → Webview manager: owns manager (evidence: `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`)
- Windows plugin → Headless manager: owns manager (evidence: `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`)
- Windows plugin → Browser manager: owns manager (evidence: `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`)
- Windows plugin → Environment manager: owns manager (evidence: `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`)
- Windows plugin → Cookie manager: owns manager (evidence: `packages/flutter_inappwebview_windows/windows/flutter_inappwebview_windows_plugin.h`)
- Webview manager → Environment manager: uses environment (evidence: `packages/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview_manager.cpp`)
- Headless manager → Environment manager: uses environment (evidence: `packages/flutter_inappwebview_windows/windows/headless_in_app_webview/headless_in_app_webview_manager.cpp`)
- Cookie manager → Environment manager: uses environment (evidence: `packages/flutter_inappwebview_windows/windows/cookie_manager.cpp`)
- Android host → App user: hosts app (evidence: `README.md`)
- iOS host → App user: hosts app (evidence: `README.md`)
- Windows host → App user: hosts app (evidence: `README.md`)
- macOS host → App user: hosts app (evidence: `README.md`)
- Linux host → App user: hosts app (evidence: `README.md`)
