Learn ELECTRON with Real Code Examples
Updated Nov 23, 2025
Installation Setup
Install Node.js and npm/yarn
Install Electron via npm (`npm install electron --save-dev`)
Set up your frontend framework project
Create main process entry script (`main.js`) with Electron APIs
Run app in development mode using `electron .`
Environment Setup
Install Node.js and npm/yarn
Install Electron CLI and dependencies
Set up frontend framework project
Write main and renderer processes
Run and test app on all desktop platforms
Config Files
package.json - dependencies and scripts
main.js - main process entry
src/ - frontend source code
node_modules/ - installed packages
dist/ - packaged binaries
Cli Commands
electron . - run app
npm install electron --save-dev - install Electron
electron-builder - package app
electron-packager - alternative packaging
electron-rebuild - rebuild native modules
Internationalization
Use i18n libraries for text localization
Support multiple languages and locales
Localize dates, numbers, and assets
Maintain resource files for translations
Ensure UI accommodates different languages
Accessibility
Follow web accessibility standards
Ensure keyboard navigation
Screen reader support in frontend
Platform-specific accessibility via Electron APIs
Test accessibility on all desktop platforms
Ui Styling
Standard CSS, SCSS, or framework styles
Responsive design via frontend framework
Custom window and menu styling
Reusable components for consistency
Platform-specific adjustments via Electron APIs
State Management
Frontend state via framework (React/Vue/Angular/Svelte)
Backend state via Node.js modules
Global state management possible via Redux/Vuex
Synchronize frontend-backend via IPC
Optional database integration for persistent state
Data Management
Frontend data handled by framework
Backend operations via Node.js APIs
Filesystem and OS API access
SQLite, local storage, or JSON files for persistence
Secure handling of sensitive data