Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Auto‑Updates with el | Electron.js Desktop App Development l | BraveProgrammer
  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 13 of 28

·javascript

Auto‑Updates with electron‑updater

13 mins

Course progress46%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • `electron-updater` works with **electron-builder** to handle all platforms.
  • `autoUpdater.checkForUpdatesAndNotify()` checks for a new version and shows a notification. * Listen for `update‑available`, `update‑downloaded`, `error` events.
  • Never expose the updater API directly to the renderer – wrap it in the preload bridge.
  • Code‑sign your binaries; unsigned apps will be rejected by macOS Gatekeeper.

Auto‑Updates with electron‑updater

electron‑updater (part of electron‑builder) abstracts away the platform‑specific update mechanisms (Squirrel on Windows, NSIS, macOS app‑store, etc.).

Install

npm install electron-updater

Basic usage in main.js

const { autoUpdater } = require('electron-updater');

autoUpdater.checkForUpdatesAndNotify();

autoUpdater.on('update-available', info => {
  console.log('Update available', info.version);
});
autoUpdater.on('update-downloaded', info => {
  const choice = dialog.showMessageBoxSync({
    type: 'question',
    buttons: ['Later', 'Install now'],
    defaultId: 1,
    message: `Version ${info.version} downloaded. Install now?`
  });
  if (choice === 1) autoUpdater.quitAndInstall();
});

Packaging for updates

  • Use electron‑builder to create a GitHub release (or any server) that hosts the *.exe, *.dmg, *.AppImage files.
  • Set the publish field in package.json:
"build": {
  "publish": [{ "provider": "github", "owner": "myuser", "repo": "my‑app" }]
}

Now each new release is automatically detected by autoUpdater.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Electron.js Desktop App DevelopmentBrowse activities
Previous lessonInstalling Node, npm & ElectronContinue to lesson 14Packaging & Distribution – electron‑builderBack to Electron.js Desktop App Development curriculum