なぜ Electron なのか
Electronは、ウェブ技術(HTML、JavaScript、CSS)とNode.js、そしてネイティブコードを組み合わせることで、macOS、Windows、Linux向けのクロスプラットフォームデスクトップアプリケーションを開発できるフレームワークです。 本ソフトウェアは、オープンソースのMITライセンスに基づき、商用・非商用の目的を問わず、無償でご利用いただけます。 このドキュメントでは、なぜ企業や開発者が Electron を選ぶのかをご説明します。
Electronのメリットは2つの質問に分けることができます。まず、アプリケーションの構築に Web テクノロジーを使うべきなのか? そして、なぜそのフレームワークとして Electron を選ぶべきなのか?
もしあなたがすでにアプリケーションにウェブ技術を使用している場合、下の章「Electronを選ぶ理由」からご覧ください。
ウェブ技術を選ぶ理由
Web 技術には HTML や CSS、JavaScript、WebAssembly などがあります。 これらは現代のインターネットの「顔」と言えるものです。 これらの技術は、消費者向けアプリケーションだけでなく、ミッションクリティカルなビジネスアプリケーションにもユーザーインターフェースを構築するための最適な選択肢として登場しました。 これは、ブラウザ上で実行する必要があるアプリケーションだけでなく、ブラウザからアクセスできないデスクトップアプリケーションにも当てはまります。 ここでの我々の主張は、これが単に複数のオペレーティングシステムで動作する必要のあるクロスプラットフォームアプリケーションに限らず、あらゆるアプリケーションに当てはまるというものです。
例えば、NASA の実際のミッションコントロールは Web 技術を使って書かれています。 金融機関で使われているコンピュータシステム、ブルームバーグ ターミナルも Web 技術で書かれており、 Chromium 内で動作しています。 そのコストは年間1ユーザーあたり25,000ドルです。 世界最大の飲食小売業者であるマクドナルドの注文端末も、完全に Chromium で構築されています。 SpaceX のドラゴン2宇宙カプセルは、インターフェースを表示するために Chromium を使用しています。 要するに、Web 技術はユーザーインターフェースを構築するのに優れた技術スタックであるということです。
Electron のメンテナンスを行っている私たちが Web 技術に賭ける理由をご紹介します。
汎用性
現代の HTML や CSS により、開発者やデザイナーは自身の表現力を十分に発揮できます。 Web のショーケースには、Google Earth、Netflix、Spotify、Gmail、Facebook、Airbnb、GitHub などがあります。 あなたのアプリケーションがどのようなインターフェースを必要としていても、HTML、CSS、そして JavaScript を使えば表現できます。
特定の UI フレームワークでデザイナーのビジョンをどう実現するかを考えるのではなく、素晴らしい製品づくりに集中したいなら、Web は安全な選択肢です。
信頼性
Web 技術は、地球上でもっとも広く使われているユーザーインターフェースの基盤です。 それゆえに徹底的に強化されてきました。 現代のコンピュータは、CPU からオペレーティングシステムに至るまで、Web 技術を効率よく実行できるよう最適化されています。 Android スマートフォンでも最新の MacBook でも、ユーザーがウェブサイトを閲覧したり、YouTube で動画を再生したり、メールを表示したりできるように、端末メーカーが保証しています。 その結果、ユーザーが一人しかいなくても、あなたのアプリが安定した基盤の上で動作することが保証されるのです。
誰も遭遇したことのない奇妙な挙動をデバッグするのではなく、素晴らしい製品づくりに集中したいなら、Web は安全な選択肢です。
相互運用性
あなたが扱う必要のあるプロバイダや顧客データは、ほぼ確実に Web との連携経路が用意されています。 どの技術を選ぶかによって、YouTube 動画の埋め込みが 30 秒で済むこともあれば、ストリーミングやハードウェアアクセラレーションによる動画デコードの専門チームを雇う必要があることもあります。 YouTube の場合、提供されているプレーヤー以外を使うことは利用規約に反するため、独自の動画ストリーミングデコーダを実装するのではなく、ブラウザフレームを埋め込むことになるでしょう。
Web 技術でアプリを作れば、動作しないプラットフォームは事実上存在しません。 ATM、車載インフォテインメントシステム、スマートテレビ、冷蔵庫、Nintendo Switch など、画面を持つほとんどのデバイスは Web 技術を表示できます。 クロスプラットフォームを目指すなら、Web は安全な選択肢です。
遍在性
Web 技術の経験を持つ開発者を見つけるのは簡単です。 あなたが開発者であれば、Google、Stack Overflow、GitHub、あるいはお好みのコーディング AI を使って質問の答えを見つけるのも容易でしょう。 あなたが解決しようとしている問題は、ほぼ確実に過去に誰かが解決しており、その答えはインターネットで見つけられます。
豊富なリソースや資料にアクセスしながら素晴らしい製品づくりに集中したいなら、Web は安全な選択肢です。
Electronを選ぶ理由
Electron combines Chromium, Node.js, and the ability to write custom native code into one framework for building powerful desktop applications. There are three main reasons to use Electron:
Enterprise-grade
Electron is reliable, secure, stable, and mature. It is the premier choice for companies building their flagship product. We have a list of some of those companies on our homepage, but just among chat apps, Slack, Discord, and Signal are built with Electron. Among AI applications, both OpenAI’s ChatGPT and Anthropic’s Claude use Electron. Visual Studio Code, Loom, Canva, Notion, Docker, and countless other leading developers of software bet on Electron.
We did make it a priority to make Electron easy to work with and a delight for developers. That’s likely the main reason why Electron became as popular as it is today — but what keeps Electron alive and thriving is the maintainer’s focus on making Electron as stable, secure, performant, and capable of mission-critical use cases for end users as possible. We’re building an Electron that is ready to be used in scenarios where unfixable bugs, unpatched security holes, and outages of any kind are worst-case scenarios.
Mature
Our current estimation is that most desktop computers on the planet run at least one Electron app. Electron has grown by prioritizing talent in its maintainer group, fostering excellent and sustainable engineering practices in managing the ongoing maintenance, and proactively inviting companies betting on Electron to directly contribute to the project. We’re an impact project with the OpenJS foundation, which is itself a part of the Linux foundation. We share resources and expertise with other foundation projects like Node.js, ESLint, Webpack - or the Linux Kernel or Kubernetes.
What does all of that mean for you, a developer, in practice?
- Reliable release schedule: Electron will release a new major version in lockstep with every second major Chromium release, usually on the same day as Chromium. A lot of work, both in the form of building processes and tools, but also in terms of raw invested hours every week, has to go into making that happen.
- No dictators: Sometimes, betting on a technology also requires you to bet on a single person or company. In turn, it requires you to trust that the person or company never has a breakdown, starts fighting you directly, or does anything else drastic that’ll force you rethink your entire tech stack. Electron is maintained by a diverse set of companies (Microsoft, Slack/Salesforce, Notion, and more) and will continue to welcome more companies interested in ensuring their “seat at the decision-making table”.
Stability, security, performance
Electron delivers the best experience on all target platforms (macOS, Windows, Linux) by bundling the latest version of Chromium, V8, and Node.js directly with the application binary. When it comes to running and rendering web content with upmost stability, security, and performance, we currently believe that stack to be “best in class”.
Why bundle anything at all
You might wonder why we bundle Chromium’s web stack with our apps when most modern operating systems already ship a browser and some form of web view. Bundling doesn’t just increase the amount of work for Electron maintainers dramatically, it also increases the total disk size of Electron apps (most apps are >100MB). Many Electron maintainers once developed applications that did make use of embedded web views — and have since accepted the increased disk size and maintainer work as a worthy trade-off.
When using an operating system's built-in web view, you're limited by the browser version included in the oldest operating system version you need to support. We have found the following problems with this approach:
- Stability: The modern web technology stack is complex, and as a result, you’ll sooner or later encounter bugs. If you use the operating system’s web view, your only recourse will be to ask your customers to upgrade their operating system. If no upgrade is available for that machine (because of no ability to upgrade to the latest macOS or Windows 11), you’ll have to ask them to buy a new computer. If you’re unlucky, you’re now losing a major customer because they will not upgrade their entire fleet of thousands of machines just because one team wanted to try your startup’s app. You have no recourse in this situation. Even the risk of that happening is unacceptable to the companies that employ the Electron maintainers.
- Security: Similar to how you can fix stability bugs by releasing an app update, you can also release security fixes to your application without asking your customer to upgrade their operating system. Even if operating system providers prioritize updates to their built-in browser, we have not seen them reliably update the built-in web views with similar urgency. Bundling a web renderer gives you, the developer, control.
- Performance: For simple HTML documents, a built-in web view will sometimes use fewer resources than an app with a bundled framework. For bigger apps, it is our experience that we can deliver better performance with the latest version of Chromium than we can with built-in web views. You might think that the built-in view can share a lot of resources with other apps and the operating system— but for security reasons, apps have to run in their own sandboxes, isolated from each other. At that point, the question is whether the OS’ web view is more performant than Chromium. Across many apps, our experience is that bundling Chromium and Node.js enables us to build better and more performant experiences.
Why bundle Chromium and Node.js
Electron aims to enable the apps it supports to deliver the best possible user experience, followed by the best possible developer experience. Chromium is currently the best cross-platform rendering stack available. Node.js uses Chromium’s JavaScript engine V8, allowing us to combine the powers of both.
- Native code when you want it: Thanks to Node.js’ mature native addon system, you can always write native code. There is no system API out of reach for you. Whatever macOS, Windows, or Linux feature you’ll want to integrate with —as long as you can do it in C, C++, Objective-C, Rust, or another native language, you’ll be able to do it in Electron. Again, this gives you, the developer, maximum control. With Electron, you can use web technologies without choosing only web technologies.
Developer experience
To summarize, we aim to build an Electron that is mature, enterprise-grade, and ready for mission-critical applications. We prioritize reliability, stability, security, and performance. That said, you might also choose Electron for its developer experience:
- Powerful ecosystem: Anything you find on npm will run inside Electron. Any resource available to you about how to work with Node.js also applies to Electron. In addition, Electron itself has a thriving ecosystem — including plenty of choices for installers, updaters, deeper operating system-integration, and more.
- Plenty of built-in capabilities: Over the last ten years, Electron’s core has gained plenty of native capabilities that you might need to build your application. Written in C++ and Objective-C, Electron has dozens of easy-to-use APIs for deeper operating-system integration — like advanced window customization for transparent or oddly shaped widgets, receiving push notifications from the Apple Push Notification Network, or handling a custom URL protocol for your app.
- Open source: The entire stack is open source and open to your inspection. This ensures your freedom to add any feature or fix any bug you might encounter in the future.
- Native code when you need it: It bears repeating that Electron allows you to mix and match web technologies and C++, C, Objective-C, Rust, and other native languages. Whether it be SQLite, a whole LLM, or just the ability to call one specific native API, Electron will make it easy.
Why choose something else
As outlined above, the web is an amazing platform for building interfaces. That doesn’t mean that we, the maintainers, would build everything with HTML and CSS. Here are some notable exceptions:
Resource-Constrained Environments and IoT: In scenarios with very limited memory or processing power (say, one megabyte of memory and 100MHz of processing power on a low-powered ARM Cortex-M), you will likely need to use a low-level language to directly talk to the display to output basic text and images. Even on slightly higher-powered single-chip devices you might want to consider an embedded UI framework. A classic example is a smart watch.
Small Disk Footprint: Zipped Electron apps are usually around 80 to 100 Megabytes. If a smaller disk footprint is a hard requirement, you’ll have to use something else.
Operating System UI Frameworks and Libraries: By allowing you to write native code, Electron can do anything a native application can do, including the use of the operating system’s UI components, like WinUI, SwiftUI, or AppKit. In practice, most Electron apps make rare use of that ability. If you want the majority of your app to be built with operating system-provided interface components, you’ll likely be better off building fully native apps for each operating system you’d like to target. It’s not that it’s impossible with Electron, it’ll just likely be an overall easier development process.
Games and Real-Time Graphics: If you're building a high-performance game or application requiring complex real-time 3D graphics, native frameworks like Unity, Unreal Engine, or DirectX/OpenGL will provide better performance and more direct access to graphics hardware. Web fans might point out caveats, like the fact that even Unreal Engine ships with Chromium — or that WebGPU and WebGL are developing rapidly and many game engines, including the ones listed here, can now output their games in a format that runs in a browser. That said, if you asked us to build the next AAA game, we’d likely use something else than just web technologies.
Embedding Lightweight Websites: Electron apps typically are mostly web apps with native code sprinkled in where useful. Processing-heavy Electron applications tend to write the UI in HTML/CSS and build the backend in Rust, C++, or another native language. If you’re planning to build a primarily native application that also wants to display a little website in a specific view, you might be better off using the OS-provided web view or something like ultralight.