Skip to main content
@capgo/electron-updater Updates Open source

Electron Updater Electron plugin

OTA live updates for Electron apps with the same API surface as capacitor-updater

Install

bun add @capgo/electron-updater
npm, pnpm or yarn
  • npm install @capgo/electron-updater
  • pnpm add @capgo/electron-updater
  • yarn add @capgo/electron-updater

Guide

How to use Electron Updater in Electron

Using @capgo/electron-updater

@capgo/electron-updater gives Electron apps the same Capgo live-update model as @capgo/capacitor-updater. You initialize it in the main process, expose the renderer bridge through preload, and call notifyAppReady() on every launch so rollback protection knows the bundle is healthy.

Installation

bun add @capgo/electron-updater

Main process setup

import { app, BrowserWindow } from 'electron';
import path from 'node:path';
import { ElectronUpdater, setupEventForwarding, setupIPCHandlers } from '@capgo/electron-updater';

const updater = new ElectronUpdater({
  appId: 'com.example.desktop',
  autoUpdate: true,
});

app.whenReady().then(async () => {
  const window = new BrowserWindow({
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      contextIsolation: true,
    },
  });

  const builtinPath = path.join(__dirname, 'www/index.html');
  await updater.initialize(window, builtinPath);
  setupIPCHandlers(updater);
  setupEventForwarding(updater, window);

  await window.loadFile(updater.getCurrentBundlePath());
});

Preload bridge

import { exposeUpdaterAPI } from '@capgo/electron-updater/preload';

exposeUpdaterAPI();

Renderer usage

import { requireUpdater } from '@capgo/electron-updater/renderer';

const updater = requireUpdater();

await updater.notifyAppReady();

const latest = await updater.getLatest();

if (latest.url && !latest.error) {
  const bundle = await updater.download({
    url: latest.url,
    version: latest.version,
    checksum: latest.checksum,
  });

  await updater.next({ id: bundle.id });
}

Listen for update events

updater.addListener('download', ({ percent }) => {
  console.log('Download progress', percent);
});

updater.addListener('updateFailed', ({ bundle }) => {
  console.error('Update failed', bundle.version);
});

Deploy a new bundle

bun run build
bunx @capgo/cli@latest bundle upload --channel=production

Practical advice

  • Always call notifyAppReady() early in the renderer so rollback protection works as intended.
  • Keep the built-in path stable and let the updater decide whether to load the shipped bundle or a downloaded one.
  • Reuse the same Capgo channel and rollout model you already use on mobile when your Electron app shares a backend release pipeline.

Keep going from Using @capgo/electron-updater

If you are using Using @capgo/electron-updater to plan native plugin work, connect it with @capgo/electron-updater for the implementation detail in @capgo/electron-updater, Getting Started with Electron Updater for the implementation detail in Getting Started with Electron Updater, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Electron Updater plugin FAQ

How do I install the Electron Updater plugin in an Electron app?

Run "bun add @capgo/electron-updater" (or "npm install @capgo/electron-updater"), then follow the Electron setup steps in the guide and the GitHub README.

Does @capgo/electron-updater work with React, Vue and Angular?

Yes. Electron Updater is an Electron package, so it works with any web framework that runs inside Electron, React, Vue, Angular, Svelte and plain JavaScript.

Is @capgo/electron-updater free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/electron-updater/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Ship Electron Updater changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo