# abuljko/nativefier architecture

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

- Interactive diagram: https://gitdiagram.com/abuljko/nativefier
- Repository: https://github.com/abuljko/nativefier

## Overview

Nativefier is a CLI for turning a website into a desktop app bundled with Electron. The main workflow accepts command-line options, normalizes configuration and the target URL, then launches the generated app, whose main window loads the target and handles navigation and desktop interactions. The repository also includes icon/name and browser-version inference, plus app-upgrade support. The build implementation is referenced by the entry point but is not present in the supplied tree, so its internal steps are omitted; edges reflect only shown calls, references, or README claims.

Main entry points: [`src/options/optionsMain.ts`](https://github.com/abuljko/nativefier/blob/main/src/options/optionsMain.ts) (Option builder), [`app/src/components/mainWindow.ts`](https://github.com/abuljko/nativefier/blob/main/app/src/components/mainWindow.ts) (Main window), [`src/helpers/upgrade/upgrade.ts`](https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/upgrade.ts) (Upgrade flow), [`src/cli.ts`](https://github.com/abuljko/nativefier/blob/main/src/cli.ts) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI configuration"]
  node_cli_entry["CLI entry<br/>[cli.ts]"]
  node_option_builder["Option builder<br/>[optionsMain.ts]"]
  node_async_config["Async config<br/>[asyncConfig.ts]"]
  node_user_agent["User-agent options<br/>[userAgent.ts]"]
  node_shared_model["Option model<br/>[model.ts]"]
end

subgraph group_inference["Metadata inference"]
  node_icon_inference["Icon inference<br/>[inferIcon.ts]"]
  node_git_hosting["Git hosting inference<br/>[gitCloud.ts]"]
  node_os_inference["Platform inference<br/>[inferOs.ts]"]
  node_title_inference["Title inference<br/>[inferTitle.ts]"]
  node_browser_versions["Browser versions"]
end

subgraph group_upgrade["App upgrade"]
  node_upgrade_flow["Upgrade flow<br/>[upgrade.ts]"]
  node_upgrade_executable["Executable upgrade"]
  node_upgrade_plist["Plist metadata"]
  node_upgrade_resources["Upgrade resources<br/>[rceditGet.ts]"]
  node_filesystem["Filesystem helpers<br/>[fsHelpers.ts]"]
end

subgraph group_runtime["Electron runtime"]
  node_app_main["App main process<br/>[main.ts]"]
  node_main_window["Main window<br/>[mainWindow.ts]"]
  node_window_events["Window events<br/>[windowEvents.ts]"]
  node_window_helpers["Window helpers<br/>[windowHelpers.ts]"]
  node_context_menu["Context menu<br/>[contextMenu.ts]"]
  node_app_menu["App menu<br/>[menu.ts]"]
  node_tray["System tray<br/>[trayIcon.ts]"]
  node_login["Login window<br/>[loginWindow.ts]"]
  node_preload["Preload bridge<br/>[preload.ts]"]
  node_app_logger["App logging<br/>[loggingHelper.ts]"]
end

node_user(("CLI user"))

node_user -->|"provides options"| node_cli_entry
node_cli_entry -->|"builds options"| node_option_builder
node_cli_entry -->|"infers platform"| node_os_inference
node_option_builder -->|"loads config"| node_async_config
node_option_builder -->|"uses types"| node_shared_model
node_option_builder -->|"infers architecture"| node_os_inference
node_option_builder -->|"configures agent"| node_user_agent
node_user_agent -->|"gets versions"| node_browser_versions
node_icon_inference -->|"uses hosting data"| node_git_hosting
node_upgrade_flow -->|"upgrades executable"| node_upgrade_executable
node_upgrade_flow -->|"updates metadata"| node_upgrade_plist
node_upgrade_flow -->|"uses filesystem"| node_filesystem
node_upgrade_executable -->|"uses resource editor"| node_upgrade_resources
node_app_main -->|"creates window"| node_main_window
node_app_main -->|"creates tray"| node_tray
node_main_window -->|"configures menu"| node_context_menu
node_main_window -->|"configures menu"| node_app_menu
node_main_window -->|"sets up events"| node_window_events
node_window_events -->|"delegates window work"| node_window_helpers
node_context_menu -->|"creates windows"| node_window_helpers
node_main_window -.->|"configures preload"| node_preload

click node_cli_entry "https://github.com/abuljko/nativefier/blob/main/src/cli.ts"
click node_option_builder "https://github.com/abuljko/nativefier/blob/main/src/options/optionsMain.ts"
click node_async_config "https://github.com/abuljko/nativefier/blob/main/src/options/asyncConfig.ts"
click node_user_agent "https://github.com/abuljko/nativefier/blob/main/src/options/fields/userAgent.ts"
click node_shared_model "https://github.com/abuljko/nativefier/blob/main/shared/src/options/model.ts"
click node_icon_inference "https://github.com/abuljko/nativefier/blob/main/src/infer/inferIcon.ts"
click node_git_hosting "https://github.com/abuljko/nativefier/blob/main/src/infer/gitCloud.ts"
click node_os_inference "https://github.com/abuljko/nativefier/blob/main/src/infer/inferOs.ts"
click node_title_inference "https://github.com/abuljko/nativefier/blob/main/src/infer/inferTitle.ts"
click node_browser_versions "https://github.com/abuljko/nativefier/tree/main/src/infer/browsers"
click node_upgrade_flow "https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/upgrade.ts"
click node_upgrade_executable "https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/executableHelpers.ts"
click node_upgrade_plist "https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/plistInfoXMLHelpers.ts"
click node_upgrade_resources "https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/rceditGet.ts"
click node_filesystem "https://github.com/abuljko/nativefier/blob/main/src/helpers/fsHelpers.ts"
click node_app_main "https://github.com/abuljko/nativefier/blob/main/app/src/main.ts"
click node_main_window "https://github.com/abuljko/nativefier/blob/main/app/src/components/mainWindow.ts"
click node_window_events "https://github.com/abuljko/nativefier/blob/main/app/src/helpers/windowEvents.ts"
click node_window_helpers "https://github.com/abuljko/nativefier/blob/main/app/src/helpers/windowHelpers.ts"
click node_context_menu "https://github.com/abuljko/nativefier/blob/main/app/src/components/contextMenu.ts"
click node_app_menu "https://github.com/abuljko/nativefier/blob/main/app/src/components/menu.ts"
click node_tray "https://github.com/abuljko/nativefier/blob/main/app/src/components/trayIcon.ts"
click node_login "https://github.com/abuljko/nativefier/blob/main/app/src/components/loginWindow.ts"
click node_preload "https://github.com/abuljko/nativefier/blob/main/app/src/preload.ts"
click node_app_logger "https://github.com/abuljko/nativefier/blob/main/app/src/helpers/loggingHelper.ts"

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_cli_entry,node_option_builder,node_async_config,node_user_agent,node_shared_model,node_user toneBlue
class node_icon_inference,node_git_hosting,node_os_inference,node_title_inference,node_browser_versions toneAmber
class node_upgrade_flow,node_upgrade_executable,node_upgrade_plist,node_upgrade_resources,node_filesystem toneMint
class node_app_main,node_main_window,node_window_events,node_window_helpers,node_context_menu,node_app_menu,node_tray,node_login,node_preload,node_app_logger toneRose
```

## Components

### CLI configuration

- [CLI entry](https://github.com/abuljko/nativefier/blob/main/src/cli.ts): `src/cli.ts`
- [Option builder](https://github.com/abuljko/nativefier/blob/main/src/options/optionsMain.ts): `src/options/optionsMain.ts`
- [Async config](https://github.com/abuljko/nativefier/blob/main/src/options/asyncConfig.ts): `src/options/asyncConfig.ts`
- [User-agent options](https://github.com/abuljko/nativefier/blob/main/src/options/fields/userAgent.ts): `src/options/fields/userAgent.ts`
- [Option model](https://github.com/abuljko/nativefier/blob/main/shared/src/options/model.ts): `shared/src/options/model.ts`

### Metadata inference

- [Icon inference](https://github.com/abuljko/nativefier/blob/main/src/infer/inferIcon.ts): `src/infer/inferIcon.ts`
- [Git hosting inference](https://github.com/abuljko/nativefier/blob/main/src/infer/gitCloud.ts): `src/infer/gitCloud.ts`
- [Platform inference](https://github.com/abuljko/nativefier/blob/main/src/infer/inferOs.ts): `src/infer/inferOs.ts`
- [Title inference](https://github.com/abuljko/nativefier/blob/main/src/infer/inferTitle.ts): `src/infer/inferTitle.ts`
- [Browser versions](https://github.com/abuljko/nativefier/tree/main/src/infer/browsers): `src/infer/browsers`

### App upgrade

- [Upgrade flow](https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/upgrade.ts): `src/helpers/upgrade/upgrade.ts`
- [Executable upgrade](https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/executableHelpers.ts): `src/helpers/upgrade/executableHelpers.ts`
- [Plist metadata](https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/plistInfoXMLHelpers.ts): `src/helpers/upgrade/plistInfoXMLHelpers.ts`
- [Upgrade resources](https://github.com/abuljko/nativefier/blob/main/src/helpers/upgrade/rceditGet.ts): `src/helpers/upgrade/rceditGet.ts`
- [Filesystem helpers](https://github.com/abuljko/nativefier/blob/main/src/helpers/fsHelpers.ts): `src/helpers/fsHelpers.ts`

### Electron runtime

- [App main process](https://github.com/abuljko/nativefier/blob/main/app/src/main.ts): `app/src/main.ts`
- [Main window](https://github.com/abuljko/nativefier/blob/main/app/src/components/mainWindow.ts): `app/src/components/mainWindow.ts`
- [Window events](https://github.com/abuljko/nativefier/blob/main/app/src/helpers/windowEvents.ts): `app/src/helpers/windowEvents.ts`
- [Window helpers](https://github.com/abuljko/nativefier/blob/main/app/src/helpers/windowHelpers.ts): `app/src/helpers/windowHelpers.ts`
- [Context menu](https://github.com/abuljko/nativefier/blob/main/app/src/components/contextMenu.ts): `app/src/components/contextMenu.ts`
- [App menu](https://github.com/abuljko/nativefier/blob/main/app/src/components/menu.ts): `app/src/components/menu.ts`
- [System tray](https://github.com/abuljko/nativefier/blob/main/app/src/components/trayIcon.ts): `app/src/components/trayIcon.ts`
- [Login window](https://github.com/abuljko/nativefier/blob/main/app/src/components/loginWindow.ts): `app/src/components/loginWindow.ts`
- [Preload bridge](https://github.com/abuljko/nativefier/blob/main/app/src/preload.ts): `app/src/preload.ts`
- [App logging](https://github.com/abuljko/nativefier/blob/main/app/src/helpers/loggingHelper.ts): `app/src/helpers/loggingHelper.ts`

### Other components

- **CLI user**

## Connections

- CLI user → CLI entry: provides options (evidence: `README.md`)
- CLI entry → Option builder: builds options (evidence: `src/cli.ts`)
- CLI entry → Platform inference: infers platform (evidence: `src/cli.ts`)
- Option builder → Async config: loads config (evidence: `src/options/optionsMain.ts`)
- Option builder → Option model: uses types (evidence: `src/options/optionsMain.ts`)
- Option builder → Platform inference: infers architecture (evidence: `src/options/optionsMain.ts`)
- Option builder → User-agent options: configures agent (evidence: `src/options/fields/userAgent.ts`)
- User-agent options → Browser versions: gets versions (evidence: `src/options/fields/userAgent.ts`)
- Icon inference → Git hosting inference: uses hosting data (evidence: `src/infer/inferIcon.ts`)
- Upgrade flow → Executable upgrade: upgrades executable (evidence: `src/helpers/upgrade/upgrade.ts`)
- Upgrade flow → Plist metadata: updates metadata (evidence: `src/helpers/upgrade/upgrade.ts`)
- Upgrade flow → Filesystem helpers: uses filesystem (evidence: `src/helpers/upgrade/upgrade.ts`)
- Executable upgrade → Upgrade resources: uses resource editor (evidence: `src/helpers/upgrade/executableHelpers.ts`)
- App main process → Main window: creates window (evidence: `app/src/main.ts`)
- App main process → System tray: creates tray (evidence: `app/src/main.ts`)
- Main window → Context menu: configures menu (evidence: `app/src/components/mainWindow.ts`)
- Main window → App menu: configures menu (evidence: `app/src/components/mainWindow.ts`)
- Main window → Window events: sets up events (evidence: `app/src/components/mainWindow.ts`)
- Window events → Window helpers: delegates window work (evidence: `app/src/helpers/windowEvents.ts`)
- Context menu → Window helpers: creates windows (evidence: `app/src/components/contextMenu.ts`)
- Main window → Preload bridge: configures preload
