Top Related Projects
:electron: A complete tool for building and publishing Electron applications
Clone to try a simple Electron app
An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
:electron: 🚀 The easiest way to get started with Electron
Easily Build Your Vue.js App For Desktop With Electron
Quick Overview
The electron-react-boilerplate/electron-react-boilerplate
is a boilerplate project that provides a starting point for building desktop applications using Electron and React. It aims to simplify the setup process and provide a well-structured codebase for developers to build upon.
Pros
- Cross-Platform Compatibility: The boilerplate supports building applications for Windows, macOS, and Linux, making it easier to target multiple platforms.
- React Integration: The project seamlessly integrates React, allowing developers to leverage the power and flexibility of this popular JavaScript library for building user interfaces.
- Webpack Configuration: The boilerplate includes a pre-configured Webpack setup, which simplifies the process of bundling and optimizing the application.
- Hot Reloading: The boilerplate supports hot reloading, enabling developers to see changes in the application instantly without the need to manually rebuild the project.
Cons
- Opinionated Structure: The boilerplate follows a specific project structure and conventions, which may not align with the preferences of all developers.
- Potential Overhead: The boilerplate includes several dependencies and configurations, which may add some overhead to the project, especially for smaller or simpler applications.
- Maintenance Overhead: As with any boilerplate, maintaining the project and keeping it up-to-date with the latest versions of Electron, React, and other dependencies can be a ongoing effort.
- Limited Customization: While the boilerplate provides a solid foundation, some developers may find it challenging to deviate significantly from the provided structure and configurations.
Getting Started
To get started with the electron-react-boilerplate/electron-react-boilerplate
, follow these steps:
-
Clone the repository:
git clone https://github.com/electron-react-boilerplate/electron-react-boilerplate.git
-
Navigate to the project directory:
cd electron-react-boilerplate
-
Install the dependencies:
npm install
-
Start the development server:
npm start
This will launch the Electron application in development mode, with hot reloading enabled.
-
To build a production-ready package, run:
npm run package
This will create a packaged version of the application for your target platform.
-
To lint the codebase, run:
npm run lint
This will check the code for any linting issues and provide feedback.
-
To run the tests, use:
npm test
This will execute the project's test suite.
Competitor Comparisons
:electron: A complete tool for building and publishing Electron applications
Pros of electron/forge
- Comprehensive toolset: Electron Forge provides a comprehensive set of tools for building, packaging, and distributing Electron applications, making the development process more streamlined.
- Cross-platform support: Electron Forge supports building applications for multiple platforms (Windows, macOS, and Linux) from a single codebase, simplifying the deployment process.
- Plugin ecosystem: Electron Forge has a rich ecosystem of plugins that can extend its functionality, allowing developers to customize their development workflow.
Cons of electron/forge
- Steeper learning curve: Compared to electron-react-boilerplate, Electron Forge may have a slightly steeper learning curve, especially for developers new to the Electron ecosystem.
- Potential overhead: The comprehensive toolset provided by Electron Forge may introduce some overhead, which could be a concern for smaller projects or developers who prefer a more lightweight approach.
- Dependency on Electron Forge: By using Electron Forge, developers become more dependent on the tool, which could make it more challenging to migrate to alternative solutions in the future.
Code Comparison
Here's a brief code comparison between the two projects:
electron-react-boilerplate/electron-react-boilerplate:
// main.js
const { app, BrowserWindow } = require('electron');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
});
mainWindow.loadURL('http://localhost:3000');
}
app.whenReady().then(createWindow);
electron/forge:
// src/main.js
const { app, BrowserWindow } = require('electron');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
});
mainWindow.loadURL('http://localhost:3000');
}
app.whenReady().then(createWindow);
As you can see, the code structure is very similar between the two projects, as they both use the standard Electron API to create a window and load a React application.
Clone to try a simple Electron app
Pros of minimal-repro
- Extremely lightweight and simple, ideal for quick prototyping or bug reproduction
- Minimal dependencies, making it easier to maintain and update
- Faster setup and initialization due to its bare-bones structure
Cons of minimal-repro
- Lacks built-in React integration, requiring additional setup for React-based projects
- Fewer out-of-the-box features and tooling compared to electron-react-boilerplate
- May require more manual configuration for production-ready applications
Code Comparison
minimal-repro:
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
}
electron-react-boilerplate:
import { app, BrowserWindow, shell, ipcMain } from 'electron';
import { resolveHtmlPath } from './util';
let mainWindow: BrowserWindow | null = null;
const createWindow = async () => {
mainWindow = new BrowserWindow({
show: false,
width: 1024,
height: 728,
// ... additional configuration
});
The minimal-repro example showcases a basic Electron setup, while electron-react-boilerplate includes more advanced configuration options and TypeScript support. The latter also provides additional features like IPC communication and HTML path resolution out of the box.
An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
Pros of Electron-Vue
- Comprehensive Documentation: Electron-Vue provides detailed documentation, making it easier for developers to get started and understand the project's structure and features.
- Vue.js Integration: Electron-Vue seamlessly integrates with the Vue.js framework, allowing developers to leverage the power and flexibility of Vue.js in their Electron applications.
- Boilerplate and Scaffolding: Electron-Vue includes a comprehensive boilerplate and scaffolding tools, which can save developers significant time and effort in setting up a new Electron project.
Cons of Electron-Vue
- Limited React Support: Electron-Vue is primarily focused on Vue.js integration, and may not provide the same level of support or tooling for React-based Electron applications.
- Potential Learning Curve: Developers who are more familiar with React may need to invest time in learning Vue.js and the Electron-Vue specific conventions and patterns.
- Dependency on Vue.js: Electron-Vue is tightly coupled with the Vue.js framework, which may be a drawback for developers who prefer to use other JavaScript frameworks or libraries.
Code Comparison
Electron-React-Boilerplate (React):
import React from 'react';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
const Home = () => <div>Welcome to the Electron React Boilerplate!</div>;
const About = () => <div>This is the About page.</div>;
const App = () => (
<Router>
<div>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
</ul>
</nav>
<Switch>
<Route path="/about">
<About />
</Route>
<Route path="/">
<Home />
</Route>
</Switch>
</div>
</Router>
);
export default App;
Electron-Vue (Vue.js):
<template>
<div id="app">
<nav>
<ul>
<li><router-link to="/">Home</router-link></li>
<li><router-link to="/about">About</router-link></li>
</ul>
</nav>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
:electron: 🚀 The easiest way to get started with Electron
Pros of Electron Fiddle
- Easier Setup: Electron Fiddle provides a more streamlined setup process, making it easier for developers to get started with building Electron applications.
- Built-in Boilerplate: Electron Fiddle comes with a built-in boilerplate, which includes a basic Electron application structure, reducing the initial setup time.
- Integrated Development Environment: Electron Fiddle offers an integrated development environment, allowing developers to write, test, and package their Electron applications within a single tool.
Cons of Electron Fiddle
- Limited Customization: Electron Fiddle's built-in boilerplate and development environment may limit the level of customization available to developers, compared to a more flexible solution like Electron React Boilerplate.
- Potential Performance Overhead: The integrated development environment in Electron Fiddle may introduce some performance overhead, which could be a concern for larger or more complex Electron applications.
- Dependency on Electron Fiddle: Developers using Electron Fiddle may become more dependent on the tool, which could make it more difficult to migrate to a different setup in the future.
Code Comparison
Electron React Boilerplate:
// webpack.config.renderer.dev.js
module.exports = {
// ...
module: {
rules: [
// ...
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: {
localIdentName: '[name]__[local]__[hash:base64:5]',
},
},
},
],
},
],
},
// ...
};
Electron Fiddle:
// main.js
const { app, BrowserWindow } = require('electron');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
});
win.loadFile('index.html');
}
app.whenReady().then(createWindow);
Easily Build Your Vue.js App For Desktop With Electron
Pros of vue-cli-plugin-electron-builder
- Integrates Electron with Vue.js projects seamlessly, making it easier to set up and manage the development environment.
- Provides a simple and straightforward configuration process, reducing the amount of boilerplate code required.
- Supports automatic updates and packaging for various platforms, simplifying the deployment process.
Cons of vue-cli-plugin-electron-builder
- May have a steeper learning curve for developers unfamiliar with Vue.js and the Vue CLI ecosystem.
- Potentially less flexible than a custom Electron setup, as the plugin may not offer the same level of customization as a manual configuration.
- May have a more limited set of features compared to a fully custom Electron setup, depending on the project's specific requirements.
Code Comparison
electron-react-boilerplate/electron-react-boilerplate
// main.js
const { app, BrowserWindow } = require('electron');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
});
win.loadURL('http://localhost:3000');
}
app.whenReady().then(createWindow);
nklayman/vue-cli-plugin-electron-builder
// main.js
'use strict'
import { app, protocol, BrowserWindow } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const isDevelopment = process.env.NODE_ENV !== 'production'
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
async function createWindow() {
// Create the browser window.
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman/vue-cli-plugin-electron-builder#34
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})
}
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Electron React Boilerplate uses Electron, React, React Router, Webpack and React Fast Refresh.
Install
Clone the repo and install dependencies:
git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
cd your-project-name
npm install
Having issues installing? See our debugging guide
Starting Development
Start the app in the dev
environment:
npm start
Packaging for Production
To package apps for the local platform:
npm run package
Docs
See our docs and guides here
Community
Join our Discord: https://discord.gg/Fjy3vfgy5q
Sponsors
Donations
Donations will ensure the following:
- ð¨ Long term maintenance of the project
- ð£ Progress on the roadmap
- ð Quick responses to bug reports and help requests
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
Maintainers
License
MIT © Electron React Boilerplate
Top Related Projects
:electron: A complete tool for building and publishing Electron applications
Clone to try a simple Electron app
An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
:electron: 🚀 The easiest way to get started with Electron
Easily Build Your Vue.js App For Desktop With Electron
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot