# atidev17/eden-updater architecture

> Architecture diagram of the GitHub repository atidev17/eden-updater, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atidev17/eden-updater
- Repository: https://github.com/atidev17/eden-updater

## Overview

1. **Product shape**
   - This is a **Flutter desktop/mobile updater app** for the Eden emulator.
   - It is a **single UI codebase** with **platform-specific backends** for Windows, Linux, and Android.

2. **Entry points and host shells**
   - `lib/main.dart` starts the Flutter app.
   - Native host projects exist under `windows/`, `linux/`, and `android/` to launch the Flutter runtime on each target.
   - Android has a Kotlin `MainActivity` plus manifest/resource setup; Windows and Linux use the standard Flutter desktop runner shells.

3. **UI layer**
   - The screens live in `lib/screens/`.
   - `updater_screen.dart` is the main user-facing screen, with smaller widgets for channel selection, version cards, progress, logs, auto-launch, settings, and warnings.
   - UI state is separated into `updater_controller.dart` and `updater_state.dart`, so the screen renders state while the controller drives the workflow.

4. **Update workflow**
   - The core flow is: **check release source → compare versions → download artifact → extract/install → optionally launch Eden**.
   - This is orchestrated by `lib/services/update_service.dart`, which coordinates the specialized services below.

5. **Service layer responsibilities**
   - `network/github_api_service.dart` talks to GitHub release endpoints to discover stable/nightly versions and assets.
   - `download/download_service.dart` fetches the release payload.
   - `extraction/extraction_service.dart` unpacks downloaded archives.
   - `installation/installation_service.dart` applies files into the Eden install location.
   - `launcher/launcher_service.dart` starts Eden after install/update.
   - `storage/preferences_service.dart` persists user choices such as channel and auto-launch behavior.

6. **Platform abstraction boundary**
   - The repo has a dedicated cross-platform abstraction under `lib/core/platform/`.
   - Interfaces define the capabilities the app needs: file handling, installation, installer invocation, launching, version detection, and update logic.
   - `platform_factory.dart` selects the concrete implementation for the current OS.

7. **Platform-specific implementations**
   - Each supported platform has its own backend in `lib/core/platform/implementations/`.
   - Windows, Linux, and Android each implement file handling, installation service, installer, launcher, update service, and version detector in platform-appropriate ways.
   - This is the main architectural boundary that lets the same Flutter UI drive different native installation behaviors.

8. **Runtime model and shared domain**
   - Shared data models such as `UpdateInfo`, `InstallationContext`, and `PlatformConfig` live under `lib/models/` and `lib/core/platform/models/`.
   - Shared enums, constants, exceptions, and utility helpers are centralized under `lib/core/`.
   - This keeps version/channel/configuration logic separate from UI and from OS-specific installation code.

9. **Operational concerns**
   - Logging is handled by `lib/core/services/logging_service.dart`.
   - A service locator is present in `lib/core/services/service_locator.dart`, indicating dependency wiring is centralized rather than spread through widgets.
   - Utilities cover command-line parsing, cleanup, file handling, date formatting, and URL launching; these support the updater flow and CLI modes like `--auto-launch` and `--channel`.

10. **External dependencies and release sources**
   - The app’s primary external dependency is **GitHub Releases**.
   - The README documents two update channels sourced from different repositories: **stable** and **nightly**.
   - The updater installs Eden into `Documents/Eden/`, with separate folders per channel, which is a key data/layout boundary for the installer and launcher.

11. **Packaging and delivery**
   - Distribution is handled by platform scripts: `package_windows.ps1`, `package_linux.sh`, and `package_android.ps1`.
   - GitHub Actions in `.github/workflows/` automate build and release workflows.
   - Platform build files exist for Flutter, Gradle, CMake, and native desktop runners, reflecting a mixed Flutter + native packaging architecture.

12. **Test structure**
   - Tests are concentrated around the platform abstraction and services.
   - There are platform-specific tests for Windows, Linux, and Android implementations, plus tests for the platform factory and extraction service.
   - This shows the repo’s main risk surface is the OS-specific update/install behavior rather than the UI alone.

Main entry points: [`lib/services/update_service.dart`](https://github.com/atidev17/eden-updater/blob/main/lib/services/update_service.dart) (Update service), [`lib/core/platform/platform_factory.dart`](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/platform_factory.dart) (Platform factory), [`test/core/platform/platform_factory_test.dart`](https://github.com/atidev17/eden-updater/blob/main/test/core/platform/platform_factory_test.dart) (Platform tests), [`lib/screens/controllers/updater_controller.dart`](https://github.com/atidev17/eden-updater/blob/main/lib/screens/controllers/updater_controller.dart) (Updater controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_app["App shell"]
  node_node_main["Main<br/>Flutter entry<br/>[main.dart]"]
  node_node_screen["Updater screen<br/>UI screen"]
  node_node_controller["Updater controller<br/>UI controller"]
  node_node_state["Updater state<br/>UI state<br/>[updater_state.dart]"]
  node_node_update_service["Update service<br/>orchestrator"]
  node_node_github["GitHub API<br/>release source"]
  node_node_download["Download<br/>artifact fetcher"]
  node_node_extract["Extract<br/>archive unpacker"]
  node_node_install["Installer<br/>install service"]
  node_node_launch["Launcher"]
  node_node_prefs["Preferences<br/>storage"]
end

subgraph group_grp_platform["Platform layer"]
  node_node_platform_factory["Platform factory<br/>abstraction selector"]
  node_node_platform_interfaces["Platform APIs<br/>interfaces"]
  node_node_windows_impl["Windows backend<br/>windows impl"]
  node_node_linux_impl["Linux backend<br/>linux impl"]
  node_node_android_impl["Android backend<br/>android impl"]
end

subgraph group_grp_native["Native hosts"]
  node_node_windows_runner["Windows runner<br/>native shell<br/>[main.cpp]"]
  node_node_linux_runner["Linux runner<br/>native shell<br/>[main.cc]"]
  node_node_android_activity["MainActivity<br/>native host<br/>[MainActivity.kt]"]
end

subgraph group_grp_delivery["Delivery"]
  node_node_packaging["Packaging<br/>release automation"]
  node_node_ci["CI workflows<br/>automation<br/>[build.yml]"]
end

subgraph group_grp_tests["Tests"]
  node_node_platform_tests["Platform tests<br/>test suite"]
  node_node_service_tests["Service tests<br/>test suite"]
end

node_node_main -->|"opens"| node_node_screen
node_node_screen -->|"driven by"| node_node_controller
node_node_controller -->|"renders"| node_node_state
node_node_controller -->|"orchestrates"| node_node_update_service
node_node_update_service -->|"checks releases"| node_node_github
node_node_update_service -->|"downloads"| node_node_download
node_node_update_service -->|"extracts"| node_node_extract
node_node_update_service -->|"installs"| node_node_install
node_node_update_service -->|"launches"| node_node_launch
node_node_controller -->|"reads/writes"| node_node_prefs
node_node_update_service -->|"uses"| node_node_platform_factory
node_node_platform_factory -->|"returns"| node_node_platform_interfaces
node_node_platform_factory -->|"selects"| node_node_windows_impl
node_node_platform_factory -->|"selects"| node_node_linux_impl
node_node_platform_factory -->|"selects"| node_node_android_impl
node_node_windows_runner -->|"starts"| node_node_main
node_node_linux_runner -->|"starts"| node_node_main
node_node_android_activity -->|"starts"| node_node_main
node_node_packaging -->|"packages"| node_node_windows_runner
node_node_packaging -->|"packages"| node_node_linux_runner
node_node_packaging -->|"packages"| node_node_android_activity
node_node_ci -->|"automates"| node_node_packaging
node_node_platform_tests -->|"verifies"| node_node_platform_factory
node_node_platform_tests -->|"verifies"| node_node_windows_impl
node_node_platform_tests -->|"verifies"| node_node_linux_impl
node_node_platform_tests -->|"verifies"| node_node_android_impl
node_node_service_tests -->|"verifies"| node_node_extract

click node_node_main "https://github.com/atidev17/eden-updater/blob/main/lib/main.dart"
click node_node_screen "https://github.com/atidev17/eden-updater/blob/main/lib/screens/updater_screen.dart"
click node_node_controller "https://github.com/atidev17/eden-updater/blob/main/lib/screens/controllers/updater_controller.dart"
click node_node_state "https://github.com/atidev17/eden-updater/blob/main/lib/screens/state/updater_state.dart"
click node_node_update_service "https://github.com/atidev17/eden-updater/blob/main/lib/services/update_service.dart"
click node_node_github "https://github.com/atidev17/eden-updater/blob/main/lib/services/network/github_api_service.dart"
click node_node_download "https://github.com/atidev17/eden-updater/blob/main/lib/services/download/download_service.dart"
click node_node_extract "https://github.com/atidev17/eden-updater/blob/main/lib/services/extraction/extraction_service.dart"
click node_node_install "https://github.com/atidev17/eden-updater/blob/main/lib/services/installation/installation_service.dart"
click node_node_launch "https://github.com/atidev17/eden-updater/blob/main/lib/services/launcher/launcher_service.dart"
click node_node_prefs "https://github.com/atidev17/eden-updater/blob/main/lib/services/storage/preferences_service.dart"
click node_node_platform_factory "https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/platform_factory.dart"
click node_node_platform_interfaces "https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/interfaces/i_platform_update_service.dart"
click node_node_windows_impl "https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/windows/windows_update_service.dart"
click node_node_linux_impl "https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/linux/linux_update_service.dart"
click node_node_android_impl "https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/android/android_update_service.dart"
click node_node_windows_runner "https://github.com/atidev17/eden-updater/blob/main/windows/runner/main.cpp"
click node_node_linux_runner "https://github.com/atidev17/eden-updater/blob/main/linux/runner/main.cc"
click node_node_android_activity "https://github.com/atidev17/eden-updater/blob/main/android/app/src/main/kotlin/com/eden/updater/eden_updater/MainActivity.kt"
click node_node_packaging "https://github.com/atidev17/eden-updater/blob/main/package_windows.ps1"
click node_node_ci "https://github.com/atidev17/eden-updater/blob/main/.github/workflows/build.yml"
click node_node_platform_tests "https://github.com/atidev17/eden-updater/blob/main/test/core/platform/platform_factory_test.dart"
click node_node_service_tests "https://github.com/atidev17/eden-updater/blob/main/test/services/extraction_service_test.dart"

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_node_main,node_node_screen,node_node_controller,node_node_state,node_node_update_service,node_node_github,node_node_download,node_node_extract,node_node_install,node_node_launch,node_node_prefs toneBlue
class node_node_platform_factory,node_node_platform_interfaces,node_node_windows_impl,node_node_linux_impl,node_node_android_impl toneAmber
class node_node_windows_runner,node_node_linux_runner,node_node_android_activity toneMint
class node_node_packaging,node_node_ci toneRose
class node_node_platform_tests,node_node_service_tests toneIndigo
```

## Components

### App shell

Flutter entry, UI, and shared app services

- [Main](https://github.com/atidev17/eden-updater/blob/main/lib/main.dart): Flutter entry · Starts the app and wires top-level startup. · `lib/main.dart`
- [Updater screen](https://github.com/atidev17/eden-updater/blob/main/lib/screens/updater_screen.dart): UI screen · Primary user-facing updater interface. · `lib/screens/updater_screen.dart`
- [Updater controller](https://github.com/atidev17/eden-updater/blob/main/lib/screens/controllers/updater_controller.dart): UI controller · Coordinates screen state and update workflow triggers. · `lib/screens/controllers/updater_controller.dart`
- [Updater state](https://github.com/atidev17/eden-updater/blob/main/lib/screens/state/updater_state.dart): UI state · Immutable view state rendered by the updater screen. · `lib/screens/state/updater_state.dart`
- [Update service](https://github.com/atidev17/eden-updater/blob/main/lib/services/update_service.dart): orchestrator · Central update workflow: check, compare, download, extract, install, launch. · `lib/services/update_service.dart`
- [GitHub API](https://github.com/atidev17/eden-updater/blob/main/lib/services/network/github_api_service.dart): release source · Discovers stable and nightly releases and their assets. · `lib/services/network/github_api_service.dart`
- [Download](https://github.com/atidev17/eden-updater/blob/main/lib/services/download/download_service.dart): artifact fetcher · Downloads release payloads. · `lib/services/download/download_service.dart`
- [Extract](https://github.com/atidev17/eden-updater/blob/main/lib/services/extraction/extraction_service.dart): archive unpacker · Unpacks downloaded release archives. · `lib/services/extraction/extraction_service.dart`
- [Installer](https://github.com/atidev17/eden-updater/blob/main/lib/services/installation/installation_service.dart): install service · Applies extracted files into the Eden install location. · `lib/services/installation/installation_service.dart`
- [Launcher](https://github.com/atidev17/eden-updater/blob/main/lib/services/launcher/launcher_service.dart): process launcher · Starts Eden after install or update. · `lib/services/launcher/launcher_service.dart`
- [Preferences](https://github.com/atidev17/eden-updater/blob/main/lib/services/storage/preferences_service.dart): storage · Persists channel, auto-launch, and related user choices. · `lib/services/storage/preferences_service.dart`

### Platform layer

Cross-platform abstractions plus OS-specific implementations

- [Platform factory](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/platform_factory.dart): abstraction selector · Selects the concrete backend for the current OS. · `lib/core/platform/platform_factory.dart`
- [Platform APIs](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/interfaces/i_platform_update_service.dart): interfaces · Defines file, install, launcher, update, and version capabilities. · `lib/core/platform/interfaces/i_platform_update_service.dart`
- [Windows backend](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/windows/windows_update_service.dart): windows impl · Windows-specific file, install, launcher, update, and version logic. · `lib/core/platform/implementations/windows/windows_update_service.dart`
- [Linux backend](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/linux/linux_update_service.dart): linux impl · Linux-specific file, install, launcher, update, and version logic. · `lib/core/platform/implementations/linux/linux_update_service.dart`
- [Android backend](https://github.com/atidev17/eden-updater/blob/main/lib/core/platform/implementations/android/android_update_service.dart): android impl · Android-specific file, install, launcher, update, and version logic. · `lib/core/platform/implementations/android/android_update_service.dart`

### Native hosts

Desktop and Android runner shells

- [Windows runner](https://github.com/atidev17/eden-updater/blob/main/windows/runner/main.cpp): native shell · Native desktop host that boots the Flutter runtime on Windows. · `windows/runner/main.cpp`
- [Linux runner](https://github.com/atidev17/eden-updater/blob/main/linux/runner/main.cc): native shell · Native desktop host that boots the Flutter runtime on Linux. · `linux/runner/main.cc`
- [MainActivity](https://github.com/atidev17/eden-updater/blob/main/android/app/src/main/kotlin/com/eden/updater/eden_updater/MainActivity.kt): native host · Android host activity and manifest-backed runtime entrypoint. · `android/app/src/main/kotlin/com/eden/updater/eden_updater/MainActivity.kt`

### Delivery

Packaging and release automation

- [Packaging](https://github.com/atidev17/eden-updater/blob/main/package_windows.ps1): release automation · Platform packaging scripts used for distribution builds. · `package_windows.ps1`
- [CI workflows](https://github.com/atidev17/eden-updater/blob/main/.github/workflows/build.yml): automation · GitHub Actions build and release pipelines. · `.github/workflows/build.yml`

### Tests

Coverage focused on platform behavior and core services

- [Platform tests](https://github.com/atidev17/eden-updater/blob/main/test/core/platform/platform_factory_test.dart): test suite · Tests for platform factory and Windows, Linux, and Android backends. · `test/core/platform/platform_factory_test.dart`
- [Service tests](https://github.com/atidev17/eden-updater/blob/main/test/services/extraction_service_test.dart): test suite · Tests for core services such as extraction. · `test/services/extraction_service_test.dart`

## Connections

- Main → Updater screen: opens · Bootstraps the main UI.
- Updater screen → Updater controller: driven by · Screen delegates interaction and workflow actions to controller.
- Updater controller → Updater state: renders · Controller updates state consumed by the screen.
- Updater controller → Update service: orchestrates · Controller triggers the update workflow.
- Update service → GitHub API: checks releases · Finds available versions and assets.
- Update service → Download: downloads · Fetches the chosen artifact.
- Update service → Extract: extracts · Unpacks downloaded archives.
- Update service → Installer: installs · Applies files into the target install location.
- Update service → Launcher: launches · Optionally starts Eden after update.
- Updater controller → Preferences: reads/writes · Uses persisted channel and auto-launch settings.
- Update service → Platform factory: uses · Resolves OS-specific capabilities through the platform boundary.
- Platform factory → Platform APIs: returns · Contracts for platform capabilities.
- Platform factory → Windows backend: selects · Chooses Windows backend when running on Windows.
- Platform factory → Linux backend: selects · Chooses Linux backend when running on Linux.
- Platform factory → Android backend: selects · Chooses Android backend when running on Android.
- Windows runner → Main: starts · Desktop host launches the Flutter app.
- Linux runner → Main: starts · Desktop host launches the Flutter app.
- MainActivity → Main: starts · Android host launches the Flutter app.
- Packaging → Windows runner: packages · Builds Windows distribution artifacts.
- Packaging → Linux runner: packages · Builds Linux distribution artifacts.
- Packaging → MainActivity: packages · Builds Android distribution artifacts.
- CI workflows → Packaging: automates · CI drives release packaging and publishing.
- Platform tests → Platform factory: verifies · Covers platform selection and backend behavior.
- Platform tests → Windows backend: verifies · Covers Windows-specific behavior.
- Platform tests → Linux backend: verifies · Covers Linux-specific behavior.
- Platform tests → Android backend: verifies · Covers Android-specific behavior.
- Service tests → Extract: verifies · Covers archive extraction behavior.
