# sjj1024/pakeplus-android architecture

> Architecture diagram of the GitHub repository sjj1024/pakeplus-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sjj1024/pakeplus-android
- Repository: https://github.com/sjj1024/pakeplus-android

## Overview

#### Purpose and Scope
This repository is the Android packaging template for PakePlus: it produces a native Android wrapper around packaged web content, including optional injected JavaScript and debugging assets. It is intended to be forked and built through GitHub Actions as part of PakePlus’s cloud packaging flow.

#### Build and Delivery Entry Points
- Gradle defines the Android application build: `settings.gradle.kts`, `build.gradle.kts`, `app/build.gradle.kts`.
- The Android runtime starts from `app/src/main/AndroidManifest.xml` and `app/src/main/java/com/app/pakeplus/MainActivity.kt`.
- Node/pnpm scripts provide asset-processing or packaging support: `package.json`, `scripts/ppworker.cjs`, `scripts/optimize_assets.sh`.
- CI/release automation is defined in `.github/workflows/build.yml` and the reusable back-end workflow files under `.github/back/`.

#### Native Android Shell
The `app` module is a Kotlin/AndroidX application shell built around a drawer/navigation template.
- `MainActivity` is the native entry point and host for the app’s navigation/UI container: `app/src/main/java/com/app/pakeplus/MainActivity.kt`.
- The main activity composition is resource-driven: `app/src/main/res/layout/activity_main.xml`, `app/src/main/res/layout/content_main.xml`, `app/src/main/res/navigation/mobile_navigation.xml`.
- Android manifest and resource boundaries separate native lifecycle, permissions/configuration, and UI from packaged web assets: `app/src/main/AndroidManifest.xml`, `app/src/main/res/xml/`.

#### Screen and Navigation Layer
The shell has three Android Fragment/ViewModel screen pairs, likely retained from the standard navigation template and serving as native host surfaces around the packaged experience.
- Home: `app/src/main/java/com/app/pakeplus/ui/home/HomeFragment.kt`, `app/src/main/java/com/app/pakeplus/ui/home/HomeViewModel.kt`.
- Gallery: `app/src/main/java/com/app/pakeplus/ui/gallery/GalleryFragment.kt`, `app/src/main/java/com/app/pakeplus/ui/gallery/GalleryViewModel.kt`.
- Slideshow: `app/src/main/java/com/app/pakeplus/ui/slideshow/SlideshowFragment.kt`, `app/src/main/java/com/app/pakeplus/ui/slideshow/SlideshowViewModel.kt`.
Navigation destinations and drawer menu definitions are decoupled from Kotlin code in `app/src/main/res/navigation/mobile_navigation.xml` and `app/src/main/res/menu/activity_main_drawer.xml`.

#### Web Payload and Customization Boundary
Web content is embedded as Android assets, making the APK self-contained rather than dependent on a hosted frontend.
- Primary configurable assets: `app/src/main/assets/app.json`, `app/src/main/assets/custom.js`, `app/src/main/assets/pppwd.html`.
- `custom.js` is the explicit application-to-web customization boundary; it supports user-provided JavaScript injection.
- `vConsole.js` provides an embedded client-side debugging facility: `app/src/main/assets/vConsole.js`.
- Script-side equivalents suggest assets are assembled or transformed before inclusion: `scripts/assets/index.html`, `scripts/assets/custom.js`, `scripts/www/pppwd.html`.

#### Packaged Artifacts and Reference Payloads
`packages/` contains unpacked Android package contents and a ZIP payload, rather than maintainable application source.
- `packages/Payload/` includes a compiled Android resource/assets payload with a static web bundle under `packages/Payload/assets/`.
- `packages/fuap/` is a much larger extracted Android application payload containing Lua projects, templates, native libraries, Firebase metadata, and OkHttp resources; its application-level assets are under `packages/fuap/assets/`.
- Treat these directories as binary/generated or reference packaging inputs unless build scripts explicitly consume them; source changes should primarily target `app/` and `scripts/`.

#### Runtime, Infrastructure, and External Services
Runtime is Android/Kotlin with AndroidX Navigation, lifecycle ViewModels, Material UI, and coroutine dependencies evidenced by the Android payload metadata. Build infrastructure is Gradle plus Node/pnpm, with GitHub Actions used for cloud compilation and releases. The product workflow depends on GitHub APIs and a user-provided GitHub token for repository forking, workflow execution, and release publishing; no application backend is represented in the source tree.

Main entry points: [`app/src/main/assets/app.json`](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/app.json) (App configuration), [`.github/workflows/build.yml`](https://github.com/sjj1024/pakeplus-android/blob/main/.github/workflows/build.yml) (GitHub Actions build), [`app/build.gradle.kts`](https://github.com/sjj1024/pakeplus-android/blob/main/app/build.gradle.kts) (App module build), [`build.gradle.kts`](https://github.com/sjj1024/pakeplus-android/blob/main/build.gradle.kts) (Gradle build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; automation"]
  node_gradle{{"Gradle build<br/>Android build<br/>[build.gradle.kts]"}}
  node_app_gradle{{"App module build<br/>Gradle module<br/>[build.gradle.kts]"}}
  node_node_scripts{{"Asset tooling<br/>Node/pnpm scripts<br/>[ppworker.cjs]"}}
  node_ci{{"GitHub Actions build<br/>CI workflow<br/>[build.yml]"}}
  node_backend_workflows{{"Reusable release workflows<br/>CI workflows<br/>[build.yml]"}}
end

subgraph group_android["Android shell"]
  node_manifest["Android manifest<br/>runtime boundary"]
  node_main_activity["Main activity<br/>Kotlin entry point<br/>[MainActivity.kt]"]
  node_native_layout["Native UI container<br/>layouts<br/>[activity_main.xml]"]
  node_navigation["Drawer navigation<br/>navigation resources"]
  node_screens["Fragment screens<br/>Kotlin UI<br/>[HomeFragment.kt]"]
  node_viewmodels["Screen ViewModels<br/>AndroidX lifecycle<br/>[HomeViewModel.kt]"]
end

subgraph group_web["Embedded web payload"]
  node_app_assets["App configuration<br/>Android asset<br/>[app.json]"]
  node_custom_js["Injected JavaScript<br/>customization asset<br/>[custom.js]"]
  node_debug_js["vConsole debug asset<br/>web debugging<br/>[vConsole.js]"]
  node_password_page["Password web page<br/>web asset<br/>[pppwd.html]"]
  node_script_assets["Asset source templates<br/>web inputs<br/>[index.html]"]
end

subgraph group_reference["Reference payloads"]
  node_payload[("Compiled payload<br/>reference package")]
  node_fuap[("FUAP extracted package<br/>reference package")]
end

node_github(("GitHub packaging flow<br/>external service"))

node_gradle -->|"configures"| node_app_gradle
node_app_gradle -->|"packages"| node_manifest
node_app_gradle -->|"embeds"| node_app_assets
node_manifest -->|"launches"| node_main_activity
node_main_activity -->|"hosts"| node_native_layout
node_native_layout -->|"uses"| node_navigation
node_navigation -->|"selects destinations"| node_screens
node_screens -->|"uses"| node_viewmodels
node_node_scripts -->|"processes"| node_script_assets
node_script_assets -->|"assembles"| node_app_assets
node_custom_js -->|"included with"| node_app_assets
node_debug_js -->|"included with"| node_app_assets
node_password_page -->|"included with"| node_app_assets
node_ci -->|"runs build"| node_gradle
node_ci -->|"runs tooling"| node_node_scripts
node_backend_workflows -.->|"reused by"| node_ci
node_github -->|"triggers and publishes"| node_ci
node_payload -.->|"reference only"| node_app_assets
node_fuap -.->|"reference only"| node_app_assets

click node_gradle "https://github.com/sjj1024/pakeplus-android/blob/main/build.gradle.kts"
click node_app_gradle "https://github.com/sjj1024/pakeplus-android/blob/main/app/build.gradle.kts"
click node_node_scripts "https://github.com/sjj1024/pakeplus-android/blob/main/scripts/ppworker.cjs"
click node_ci "https://github.com/sjj1024/pakeplus-android/blob/main/.github/workflows/build.yml"
click node_backend_workflows "https://github.com/sjj1024/pakeplus-android/blob/main/.github/back/build.yml"
click node_manifest "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/AndroidManifest.xml"
click node_main_activity "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/MainActivity.kt"
click node_native_layout "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/res/layout/activity_main.xml"
click node_navigation "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/res/navigation/mobile_navigation.xml"
click node_screens "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/ui/home/HomeFragment.kt"
click node_viewmodels "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/ui/home/HomeViewModel.kt"
click node_app_assets "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/app.json"
click node_custom_js "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/custom.js"
click node_debug_js "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/vConsole.js"
click node_password_page "https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/pppwd.html"
click node_script_assets "https://github.com/sjj1024/pakeplus-android/blob/main/scripts/assets/index.html"
click node_payload "https://github.com/sjj1024/pakeplus-android/blob/main/packages/Payload/AndroidManifest.xml"
click node_fuap "https://github.com/sjj1024/pakeplus-android/blob/main/packages/fuap/AndroidManifest.xml"

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_gradle,node_app_gradle,node_node_scripts,node_ci,node_backend_workflows toneBlue
class node_manifest,node_main_activity,node_native_layout,node_navigation,node_screens,node_viewmodels toneAmber
class node_app_assets,node_custom_js,node_debug_js,node_password_page,node_script_assets toneMint
class node_payload,node_fuap toneRose
class node_github toneNeutral
```

## Components

### Build & automation

- [Gradle build](https://github.com/sjj1024/pakeplus-android/blob/main/build.gradle.kts): Android build · `build.gradle.kts`
- [App module build](https://github.com/sjj1024/pakeplus-android/blob/main/app/build.gradle.kts): Gradle module · `app/build.gradle.kts`
- [Asset tooling](https://github.com/sjj1024/pakeplus-android/blob/main/scripts/ppworker.cjs): Node/pnpm scripts · `scripts/ppworker.cjs`
- [GitHub Actions build](https://github.com/sjj1024/pakeplus-android/blob/main/.github/workflows/build.yml): CI workflow · `.github/workflows/build.yml`
- [Reusable release workflows](https://github.com/sjj1024/pakeplus-android/blob/main/.github/back/build.yml): CI workflows · `.github/back/build.yml`

### Android shell

- [Android manifest](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/AndroidManifest.xml): runtime boundary · Declares lifecycle, permissions, and application configuration. · `app/src/main/AndroidManifest.xml`
- [Main activity](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/MainActivity.kt): Kotlin entry point · `app/src/main/java/com/app/pakeplus/MainActivity.kt`
- [Native UI container](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/res/layout/activity_main.xml): layouts · `app/src/main/res/layout/activity_main.xml`
- [Drawer navigation](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/res/navigation/mobile_navigation.xml): navigation resources · `app/src/main/res/navigation/mobile_navigation.xml`
- [Fragment screens](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/ui/home/HomeFragment.kt): Kotlin UI · Home, gallery, and slideshow host surfaces. · `app/src/main/java/com/app/pakeplus/ui/home/HomeFragment.kt`
- [Screen ViewModels](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/java/com/app/pakeplus/ui/home/HomeViewModel.kt): AndroidX lifecycle · `app/src/main/java/com/app/pakeplus/ui/home/HomeViewModel.kt`

### Embedded web payload

- [App configuration](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/app.json): Android asset · `app/src/main/assets/app.json`
- [Injected JavaScript](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/custom.js): customization asset · User-provided web customization boundary. · `app/src/main/assets/custom.js`
- [vConsole debug asset](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/vConsole.js): web debugging · `app/src/main/assets/vConsole.js`
- [Password web page](https://github.com/sjj1024/pakeplus-android/blob/main/app/src/main/assets/pppwd.html): web asset · `app/src/main/assets/pppwd.html`
- [Asset source templates](https://github.com/sjj1024/pakeplus-android/blob/main/scripts/assets/index.html): web inputs · `scripts/assets/index.html`

### Reference payloads

Generated or extracted package contents.

- [Compiled payload](https://github.com/sjj1024/pakeplus-android/blob/main/packages/Payload/AndroidManifest.xml): reference package · Unpacked resource and web-bundle payload. · `packages/Payload/AndroidManifest.xml`
- [FUAP extracted package](https://github.com/sjj1024/pakeplus-android/blob/main/packages/fuap/AndroidManifest.xml): reference package · Extracted Android application payload and native resources. · `packages/fuap/AndroidManifest.xml`

### Other components

- **GitHub packaging flow**: external service · Forking, workflow execution, and release publishing use a user token.

## Connections

- Gradle build → App module build: configures
- App module build → Android manifest: packages
- App module build → App configuration: embeds
- Android manifest → Main activity: launches
- Main activity → Native UI container: hosts
- Native UI container → Drawer navigation: uses
- Drawer navigation → Fragment screens: selects destinations
- Fragment screens → Screen ViewModels: uses
- Asset tooling → Asset source templates: processes
- Asset source templates → App configuration: assembles
- Injected JavaScript → App configuration: included with
- vConsole debug asset → App configuration: included with
- Password web page → App configuration: included with
- GitHub Actions build → Gradle build: runs build
- GitHub Actions build → Asset tooling: runs tooling
- Reusable release workflows → GitHub Actions build: reused by
- GitHub packaging flow → GitHub Actions build: triggers and publishes
- Compiled payload → App configuration: reference only
- FUAP extracted package → App configuration: reference only
