Part 1. Getting started with Electron

Have you used Slack recently? Maybe you’ve written some code in Atom or Visual Studio Code or sent a message to a friend using the WhatsApp desktop application. If so, then you’ve used an Electron application. So, what is Electron? The short version is that it’s a platform for building desktop applications that run on macOS, Windows, and Linux using web technologies. Electron combines Node.js with Chromium—the open source foundation of Google Chrome. The long answer is the focus of this book in general and chapter 1 in particular.

If you’re part of a small team tasked with building desktop applications for multiple platforms, Electron is a great way to build your product without the hassle of managing two or three distinct code bases, squashing related bugs on two or three platforms, or implementing the same feature two or three times. If you’re a Node.js developer who wants to get your command-line application in front of a wider audience, Electron makes it easy to build a graphical user interface (GUI) without having to learn an entirely new skill set. If you’re a web developer who has grown accustomed to building your own solutions to problems, Electron makes it easy to access the parts of your computer that exist outside of the browser’s sandbox.

In my experience, learning Electron has both short- and long-term implications. It’s immediately gratifying to see an icon appear in your dock or task bar when you start it up or trigger a native file dialog box from the operating system using JavaScript. But, as you become more and more comfortable with Electron, you’ll find ideas for applications that you couldn’t build with either the browser or Node.js alone. You’ll be able to build a new class of applications that you may not have been able to build otherwise. My hope is that the examples in this book provide inspiration rather than merely guidelines as you embark on your journey as a desktop application developer.

In part 1, we’ll tease out exactly what Electron is and isn’t. We’ll look at some of the big players using it in the wild. I’ll elaborate on what makes it different from browser-based applications in chapter 1. In chapter 2, we’ll build a simple Electron application in a thinly veiled attempt to convince you that building applications with Electron is both easy and fun.