How to auto-start electron applications on startup

I was developing an electron application that required to auto-start when the computer is booted and started up and it had to be cross-platform and automatic. So when the computer starts the program should run and there should be no setup required, once the user launches the application it should auto-start upon login.

To solve this problem I tried various methods and none of them worked reliably until I came across a very useful library by name of “auto-launch”.

To install the application run :

npm install auto-launch

To configure it, edit the main.js file of your electron application and add the following code:

var AutoLaunch = require('auto-launch');
var autoLauncher = new AutoLaunch({
    name: "MyApp"
// Checking if autoLaunch is enabled, if not then enabling it.
autoLauncher.isEnabled().then(function(isEnabled) {
  if (isEnabled) return;
}).catch(function (err) {
  throw err;

The name parameter is optional and you can put any name in there but I recommend specifying the name parameter because if not specified AutoLaunch does not work correctly.

Auto-Launch also provide other configuration options, you can check out the full documentation at it’s Github page

That’s it! Let me know if you have any questions in the comment section.






Leave a Reply

Your email address will not be published. Required fields are marked *