How to get started with Electron?

Electron is an open-source framework developed and maintained by the fine folks from GitHub. It allows for the development of cross platform (Windows, MacOS and Linux!) desktop apps with CSS, JavaScript and HTML.

This is a simple ‘Hello World’ tutorial to get you quickly started.

  1. Download and install Node.js
  2. Run the following command to install electron prebuilt globally

    npm install -g electron
    
  3. In its most basic form, an electron app requires 3 files: package.json, main.js, and index.html. So your folder structure should look like this;

    /electron-hello-world/  
    - package.json
    - main.js
    - index.html
    
  4. Download the files (package.json, main.js, index.html) and save them in a folder.

  5. Run the following command to build the application

    electron .
    
  6. You’re done!

    Hello World!

Once you’re ready to move on to something more exciting, you can check out a couple of simple electron apps here.

15 October 2018

index