Introduction
Electron Forge is the official, all-in-one toolchain for building Electron applications, maintained by the Electron team. It handles project scaffolding, local development with hot reload, packaging into platform-native bundles, and publishing to distribution channels, all driven by a plugin-based configuration.
What Electron Forge Does
- Scaffolds new Electron projects with templates for vanilla JS, TypeScript, React, Vue, and Webpack or Vite
- Runs a development server with live reload and source map support
- Packages applications into platform-specific bundles (app, exe, or directory)
- Creates distributable installers using Makers for DMG, Squirrel, deb, rpm, snap, and Flatpak
- Publishes artifacts to GitHub Releases, S3, Electron Release Server, or custom targets
Architecture Overview
Electron Forge is built around a plugin architecture with four hook points: Template, Plugin, Maker, and Publisher. Templates generate the initial project structure. Plugins modify the build pipeline (e.g., integrating Vite or Webpack). Makers convert the packaged app into distributable formats. Publishers upload the final artifacts to release channels. The Forge CLI orchestrates these components through lifecycle commands: init, start, package, make, and publish.
Self-Hosting and Configuration
- Initialize with
npm init electron-app@latestand select a template - Configure makers and publishers in
forge.config.jsorforge.config.ts - Use the Vite plugin for modern bundling or the Webpack plugin for legacy setups
- Set code-signing environment variables for macOS notarization and Windows signing
- Integrate with CI by running
npx electron-forge makein your pipeline
Key Features
- Official Electron tooling with first-party maintenance and compatibility guarantees
- Template system supports React, Vue, Svelte, and custom starters
- Vite integration provides fast builds with hot module replacement in development
- Extensible plugin API lets you hook into every stage of the build lifecycle
- Built-in Squirrel.Windows and macOS auto-update support
Comparison with Similar Tools
- Electron Builder — focuses on packaging and distribution with extensive installer options; Forge covers the full lifecycle from scaffolding to publishing
- electron-packager — low-level packaging tool without installer creation; Forge wraps and extends it
- Vite — a general web bundler; Forge integrates Vite specifically for the Electron development workflow
- Tauri — a Rust-based alternative framework to Electron itself, not a compatible build tool
FAQ
Q: Is Electron Forge the recommended way to build Electron apps? A: Yes. The Electron documentation recommends Forge as the primary build tool for new projects.
Q: Can I migrate an existing Electron project to Forge?
A: Yes. Run npx @electron-forge/cli import in your project directory to add Forge configuration to an existing app.
Q: Does Forge support Apple Silicon? A: Yes. Forge can build universal, x64, or arm64 binaries for macOS through its maker configuration.
Q: How do I add a custom maker? A: Implement the MakerBase interface and register it in forge.config.js. Custom makers can produce any artifact format you need.