Summary
- Electron allows easy creation of desktop apps on the web. The frameworks provides access to native system calls for a seamless experience.
- Rapid development and cross-platform deployment make Electron attractive for developers.
- Electron comes with downsides, such as size and lack of efficiency, but they're outweighed by its cross-platform nature.
Applications on the desktop have been changing over the last decade, whether you've noticed it or not. Since the mid-2010's, we've seen an explosion in the number of companies, small or large, turning to the technologies of the web to build applications that would traditionally be native on your desktop. Even in some enterprise settings, businesses are surrendering native clients in favor of slick Javascript-powered experiences on the desktop. Everything from Slack to the new Outlook to Discord has fallen victim.
But how did this happen, and is there any benefit to running web apps on the desktop?
What is Discord?
Although it was built for gamers, Discord is a versatile messaging platform that's great for pretty much every demographic out there
What is Electron?
Electron kicked started a desktop revolution👁 Screenshot at Mar 28 10-38-21
Whether you've heard of Electron or not, you've almost certainly used it. Electron is a javascript framework released in 2013 by the OpenJS foundation to allow the creation of desktop applications using a traditional web stack (HTML, Javascript, CSS, and even Web Assembly.) Electron itself effectively bundles a Chromium browser with a Node.js runtime, and then runs your application as a single webpage inside this browser.
Electron then provides this web browser with access to a set of APIs, which allow your application in the browser to make native system calls like using your filesystem or accessing devices. This gives what is essentially a website the ability to look, feel, and act like it's an app running natively.
Electron bundles a Chromium browser with a Node.js runtime, and then runs your application as a single webpage inside this browser.
You won't necessarily notice you're running in a browser — Electron allows apps to hide all menu bars, developer consoles and options inside the browser, keeping the look and feel of your application as close to native as possible.
That sounds great!
Electron is great. Desktop apps, especially cross-platform ones, have traditionally been difficult to make. Each operating system has its own set of APIs and system calls, and more advanced graphics require deep knowledge to get started with. Electron allows developers to write an application once for the web, and then deploy it easily to Linux, macOS, and Windows 11 without significant changes. This makes rapid development, fast deployment of changes, and quick prototyping easier for developers, who can update a single unified code-base instead of supporting a different version of the application explicitly for each platform.
I turned Discord into a Google Drive replacement
While we don't recommend it, you can pretty easily use Discord as a Google Drive replacement for storing your files.
Electron also makes it easy to run an in-browser version of your app — you'll notice discord.com is an almost fully-fledged version of the desktop client. It also allows developers to tap into the same wealth of libraries, documentation and examples they already know and use for writing interactive, responsive apps for the web. Developers can bring their favorite existing frameworks, like React.js or Vue, as well as utilize Javascript's wide library support for everything from accessing APIs to developing UIs.
Are there alternatives to Electron?
Electron is far from the only tool capable of doing this, but it has proved popular and resilient over the years. There's a well-maintained Github page with a list of alternatives. Skimming through the section on Javascript/Node.js can give you a good idea of some of Electron's flaws (like bundling a whole version of Chromium).
We've chosen to highlight Electron here as it's arguably got the largest ongoing user base of any web-view desktop library - apps like Slack, Discord and Visual Studio Code are commonplace on millions of PCs worldwide. Its popularity has bloomed with businesses and developers in the last decade.
Are there downsides to desktop web apps?
Electron apps bundle a full version of Chromium👁 Google Chrome Windows 10 RAM management
One of the key downsides of Electron apps is that they require both Chromium and Node.js to be bundled with each app. This problem has alleviated itself slightly since Electron's first launch, as available disk space has increased, but it's still a pain point for many developers. A simple Hello World app using Electron can easily be > 50MBs, and many common apps like Slack, Discord or Visual Studio Code can easily run into the hundreds of MB. Some alternative runtimes have attempted to alleviate this by bundling smaller browser components and minimalistic backend servers in place of Node.js (like neutralino.js, to name an example), but these upstarts have had problems gaining the momentum needed to get big applications built on Electron to even consider switching.
Web apps are inherently inefficient
Your desktop operating system is perfectly capable of drawing a window, some shapes, rendering some text and images, all on its own. In fact, a lot of development effort has gone into that capability on behalf of your operating system developers. Which makes the idea that we need a full browser to render these things for us on the desktop a little... Obtuse.
This is an argument as old as time — some developers will sacrifice performance and efficiency to ship products quickly and iterate rapidly, while others will argue that writing code once and well can reap rewards in the long term (never forget the original RollerCoaster Tycoon being written in raw assembly). We won't weigh in here, but it's an argument that's been played out with pros and cons on both sides hundreds of times online.
Electron is here to stay
Whether you're a fan of or dislike the rise of web apps on your desktop - fundamentally, they're here to stay. The benefits offered to businesses and developers of being able to easily build and deploy a largely identical version of an application have been huge. While some users will always complain that they don't feel as responsible as desktop apps, and some developers will bemoan the inefficiencies of running web apps on the desktop, ultimately, they've proven their worth in some truly mass-market software.
