🧩 Using the ToDesktop CLI

The ToDesktop Command Line Interface (CLI) allows you to build and deploy your Electron app with native installers, auto-updates and code signing included.

Checkout the todesktop-quick-start GitHub project or follow the steps below to get started:

Step 1: Install the ToDesktop CLI

To install the ToDesktop CLI with npm, run the following in your terminal:

$ npm install -g @todesktop/cli


Step 2: Setup your todesktop.json file

Create a todesktop.json file in the root of your Electron project with the following configuration:

"icon": "./desktop-icon.png", // location to your app icon
"appPath": ".", // location to your electron app from the todesktop.json
"productName": "My App", // your product's name
"schemaVersion": 1 // ToDesktop schema version (set at 1)


Step 3: Add @todesktop/runtime as a dependency

The ToDesktop runtime package takes care of auto-updating, crash reporting, and more.

$ npm install @todesktop/runtime

In your main (background process) script, require the package and call the init function. The key is to call it right at the beginning:

const { app, BrowserWindow } = require("electron");
const todesktop = require("@todesktop/runtime");
function createWindow() {
// Create the browser window.
let win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
// and load the index.html of the app.


Step 4: Build and release your app

To build your app, run the following command in the root of your Electron project:

$ todesktop .

When prompted to login, use the email address and accessToken we have provided you with. Contact us if you do not have these.

Once the build has succeeded, you should see the following output in your terminal. These are links to the download binaries for each platform.

> ✅ todesktop-quick-start@1.0.0
> Released! https://dl.todesktop.com/200301s7gg0kd5i
> Mac: https://dl.todesktop.com/200301s7gg0kd5i/mac
> Windows: https://dl.todesktop.com/200301s7gg0kd5i/windows
> Linux: https://dl.todesktop.com/200301s7gg0kd5i/linux

Automating your builds

You may want to automate builds with your Continuous Integration (CI) provider. To achieve this, simply set up environment variables for TODESKTOP_ACCESS_TOKEN and TODESKTOP_EMAIL within your CI project.


Electron Versioning

If you want to control the electron version that your app is built with, then fix the electron version in you package.json (i.e. the electron version should not start with a ~ or a ^).

"devDependencies": {
"electron": "8.0.0" // fixes the electron version at 8.0.0