---
title: Bringing Electron applications to millions of Linux users
description: Electron is one of the most popular frameworks for creating cross-platform
  desktop applications right now. Many developers use electron-builder to do the heavy-lifting
  of package management for their Electron apps. electron-builder has support for
  creating snap packages out of the box. Bringing your Electron desktop app to Linux
  can be as […]
url: https://canonical.com/blog/bringing-electron-applications-to-linux?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Alan Pope](https://canonical.com/blog/author/popey "More about Alan Pope")

26 July 2018

# Bringing Electron applications to millions of Linux users

[Electron](https://canonical.com/blog/tag/electron)
[snapcraft.io](https://canonical.com/blog/tag/snapcraft-io)

---

Share the article

Electron is one of the most popular frameworks for creating cross-platform desktop applications right now. Many developers use [electron-builder](https://github.com/electron-userland/electron-builder) to do the heavy-lifting of package management for their Electron apps.

`electron-builder` has support for creating snap packages out of the box. Bringing your Electron desktop app to Linux can be as simple as a one-line change in your `package.json`. Here we’ll use an existing application – [BitWarden](https://snapcraft.io/bitwarden) – to show you how.

BitWarden is a cross-platform password store featuring secure cloud sync across their desktop and mobile clients. The desktop client is available for Linux in the snap store.

The source for BitWarden is on [GitHub](https://github.com/bitwarden/desktop/), but that’s not a requirement for building snaps. It just makes it easier for us to point out how they implemented the snap build. BitWarden are currently using electron builder 20.8.1 or later,

> ```
> "devDependencies": {
> ⋮
> "electron-builder": "^20.8.1",
> ⋮
> }
> ```

In the `"linux"` section of the package.json the BitWarden developers added a `'snap'` build target. This is alongside the other build targets the developers have chosen to support.

> ```
> "linux": {
> "category": "Utility",
> "synopsis": "A secure and free password manager for all of your devices.",
> "target": [
> "deb",
> "freebsd",
> "rpm",
> "AppImage",
> "snap"
> ]
> }
> ```

For many electron applications this one line is enough to generate a working snap! Simply build as you normally do either locally or using a remote service such as [Travis](https://www.travis-ci.org/) or [CircleCI](https://circleci.com/blog/circleci-and-snapcraft/) and this will produce a snap.

`electron-builder` exposes additional snap features via an optional `'snap'` stanza in the `package.json`. For example the BitWarden application requires an additional interface to access the password management service, and an additional package to be staged inside the snap.

Interfaces are comprised of plugs and slots at each end, so the term ‘plugs’ allows you to specify a list of interfaces you want to enable in the snap. The `'stagePackages'` section allows you to specify debs from the Ubuntu 16.04 archive which will be pulled into the snap at build time.

> ```
> "snap": {
> "confinement": "strict",
> "plugs": [
> "default",
> "password-manager-service"
> ],
> "stagePackages": [
> "default",
> "libsecret-1-0"
> ]
> }
> ```

That’s it! The full [package.json](https://github.com/bitwarden/desktop/blob/master/package.json) can be found in the [BitWarden GitHub repo](https://github.com/bitwarden/desktop/).

The community of developers building snap, snapcraft and snaps hang out on the [snapcraft forums](https://forum.snapcraft.io/). Join us!

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Creating Snaps on Ubuntu Touch](https://canonical.com/blog/creating-snaps-on-ubuntu-touch)

This article was written in collaboration with Alfred E. Neumayer of the UBports Project. Tablets, phones and current technology’s capabilities are phenomenal. Who would have...

[Aaron Prisk](https://canonical.com/blog/author/aaronprisk)

3 April 2024

[### Managing software in complex network environments: the Snap Store Proxy](https://canonical.com/blog/managing-software-snap-store-proxy)

As enterprises grapple with the evolving landscape of security threats, the need to safeguard internal networks from the broader internet is increasingly important. In...

[Holly Hall](https://canonical.com/blog/author/hollyhall)

15 January 2024

[### We wish you RISC-V holidays!](https://canonical.com/blog/we-wish-you-risc-v-holidays)

There are three types of computer users: the end user, the system administrator, and the involuntary system administrator. As it happens, everyone has found themselves in the...

[Igor Ljubuncic](https://canonical.com/blog/author/igorljubuncic)

21 December 2023

[### Snapcraft.io reloaded: check out the new look and feel](https://canonical.com/blog/snapcraft-io-reloaded-check-out-the-new-look-and-feel)

We’re happy to announce that snapcraft.io has a fresh, new look! Time for an update After keeping the same user interface and style for several years, we embarked on a project...

[Holly Hall](https://canonical.com/blog/author/hollyhall)

30 June 2023
