Skip to content

Architecture Overview

livrasand edited this page Nov 28, 2026 · 1 revision

Architecture Overview

This page is a developer orientation to Updainium's structure. It covers the three layers, the main modules in each, and how they talk to each other. For setup, build commands, and supported platforms, see Architecture and Compatibility.

Layers

Updainium is a Tauri 2 desktop app with two halves:

  1. Native shell (Rust, src-tauri/): the window, tray, single-instance handling, deep links, autostart, process control, the OS credential store, backup file I/O, and downloads.
  2. Frontend (SvelteKit, src/): the UI running inside the system WebView, plus the update engine that decides what to check, download, and open.

The frontend is built as a static single-page app with @sveltejs/adapter-static. Tauri loads that build (frontendDist points to ../build). In development, npm run dev serves it on port 1420.

flowchart LR
    UI["SvelteKit UI<br/>src/routes"] --> Engine["Update engine<br/>src/lib"]
    Engine -- "fetch: release metadata" --> Forges["Forge REST APIs"]
    Engine -- "invoke: download, hash, process, credentials" --> Rust["Tauri Rust backend<br/>src-tauri/src"]
    Rust -- "events: download-progress, deep-link" --> UI
    Rust --> OS["OS: keyring, processes, installers"]
Loading

Main modules

Rust backend (src-tauri/src/)

Module Responsibility
main.rs Entry point. Calls updainium_lib::run().
lib.rs Application setup, plugin registration, tray icon, platform helpers, and the list of IPC commands.
github.rs GitHub Gist backups, API token validation, request cancellation, and the keyring-backed credential store.
deep_link.rs Parses updainium:// URLs into actions, queues them, and emits them to the frontend.
process.rs Inspects running apps, quits them gracefully, and relaunches installed apps.
backup.rs Reads and writes settings export files, with a 5 MB size limit.

Tauri plugins used include single-instance, deep-link, opener, autostart, dialog, and fs.

Frontend (src/)

Area Files Responsibility
Routes src/routes/+layout.svelte, +page.svelte, settings/ App shell, library view, and settings. The layout starts themes, keybindings, the command palette, and notifications.
Catalog src/lib/catalog.ts, sourceValidation.ts The TrackedSource record, its validation, and validation of add/edit input.
Providers src/lib/providers/ (github.ts, gitlab.ts, gitea.ts, shared.ts, types.ts) Turn repository URLs into API URLs and normalize forge responses.
Registry src/lib/registry.ts Holds the provider list, registers providers and commands from plugins, and loads plugin manifests.
Release checks src/lib/releaseCheck.ts, assets.ts, versionComparison.ts Poll a source, pick the installer for the current platform, and compare versions.
Install flow src/lib/downloadFlow.ts Closes the running app, downloads, verifies the SHA-256 hash, and opens the installer.
Backups src/lib/backup.ts, gists.ts Build and restore JSON exports and Gist backups.

How the layers communicate

  • Frontend to Rust: the frontend calls Tauri commands with invoke. Commands are registered with tauri::generate_handler! in lib.rs. Examples include download_release_asset_resilient, quit_running_app, get_running_app_state, open_installed_app, and the github_* commands.
  • Rust to frontend: the backend emits events. download-progress reports download phases. deep-link://action carries updainium:// actions.
  • Deep-link queue: links that arrive before the frontend has registered its listener are kept in PendingDeepLinks. The frontend drains the queue with take_pending_deep_links on mount and on each event.
  • Network split: release metadata is requested by the frontend with fetch. Asset downloads run in the Rust backend, which writes them to the local cache.

Design constraints

These constraints shape the code and are documented in the project README:

  • Release data comes directly from each forge. There is no proxy or proprietary backend.
  • There is no telemetry and no account system.
  • Installers are opened after user approval. Updainium does not run unattended installs.
  • Downloads use HTTPS only.
  • GitHub tokens are kept in the OS credential store, not in localStorage or backup files.
  • Themes, init.js, and plugins are trusted code. They run in the WebView and are not sandboxed.

The security implications are covered in Security Model.

Where to go next

Clone this wiki locally