How to add auto-updates to your Electron application: An up to date guide

Akash Nimare
Dec 30, 2016 · 2 min read

Lately I’ve been busy creating and maintaining Zulip’s desktop client. It’s been fun and challenging to use HTML/CSS/JavaScript for creating native desktop applications.

Electron has certainly changed the way of building cross-platform desktop apps, but it’s not all rainbows and sunshine in the world of Electron. Adding and configuring automatic updates is still a challenge for most developers.

This article will cover two simple parts -

  • Setting up a releases/downloads server for auto-updater
  • Adding autoupdates to your app

Before proceeding to Part 1 it’s important that you’ve already packaged your app and have gotten it signed, in case you plan on adding auto-updates to a native macOS app. If that’s not the case though, you can follow the single step mentioned in this article to create an installer.

Part 1 - Setting up a releases server

To enable autoupdate you’ll need a multi-platform release server for distributing the application. For this we’re going to use nuts which is a smart release server and uses GitHub as a backend.

Deploying nuts to Herkou -

Steps to follow -

Part2 - Adding autoupdates to your code

Awesome, now let’s write some code to handle the auto-updates.

AutoUpdater function
Add this in your main.js

Above code will enable your app to automatically download the latest version of your app and will prompt a dialog whenever there is an update available.

There are of course other ways to implement auto-updates in your app such as adding a menu item like below:

You don’t want to check auto-updates while development, so you gotta use something to detect it. I’ve used electron-is-dev for the purpose. Also you need to handle Squirrel.Windows event on windows. For this I’ve used electron-squirrel-startup. Don’t forget to add these two modules in your apps package.json file.

(Note — This post was originally posted here — https://howtoelectron.app/)

If you have any trouble adding autoupdates to your electron app, feel free to drop me a tweet 😎

I’m Akash — a physics undergrad and a software developer based in India, focusing mostly on open source ❤ and building tiny side projects. You can find out more about me at akashnimare.in or contact me on twitter.

How to electron

How to do X in electron

Akash Nimare

Written by

A messy web developer who likes to write about web, life and motivation. Previously @hackerrank. Currently with @zulip. Open source all the way ❤

How to electron

How to do X in electron

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade