
Electron Egg
- 29 installs
- 3 repo stars
- Updated July 29, 2026
- full-statck-skills/electron-skills
Build Electron desktop apps with the EGG framework, covering project structure, main/renderer IPC, and window management.
About
Guides building desktop applications with the Electron EGG framework, covering project structure, IPC, and window management. A developer uses it to create or configure an Electron EGG app.
- Electron EGG project structure, setup, and configuration
- Main/renderer process IPC, window management, and desktop app patterns
Electron Egg by the numbers
- 29 all-time installs (skills.sh)
- Ranked #1,470 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/full-statck-skills/electron-skills --skill electron-eggAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 29 |
|---|---|
| repo stars | ★ 3 |
| Last updated | July 29, 2026 |
| Repository | full-statck-skills/electron-skills ↗ |
What it does
Build Electron desktop apps with the EGG framework, covering project structure, main/renderer IPC, and window management.
Files
When to use this skill
Use this skill whenever the user wants to:
- Install and set up Electron EGG in a project
- Create Electron desktop applications
- Use Electron EGG core features
- Configure Electron EGG
- Handle main process and renderer process communication
- Use Electron EGG API methods
- Build and package Electron applications
- Troubleshoot Electron EGG issues
How to use this skill
This skill is organized to match the Electron EGG official documentation structure (https://www.kaka996.com/, https://www.kaka996.com/pages/987b1c/, https://www.kaka996.com/pages/a99b72/). When working with Electron EGG:
1. Identify the topic from the user's request:
- Installation/安装 →
examples/guide/installation.md - Quick Start/快速开始 →
examples/guide/quick-start.md - Features/功能特性 →
examples/features/ - API/API 文档 →
api/
2. Load the appropriate example file from the examples/ directory:
Guide (使用文档):
examples/guide/intro.md- Introduction to Electron EGGexamples/guide/installation.md- Installation guideexamples/guide/quick-start.md- Quick start guideexamples/guide/project-structure.md- Project structureexamples/guide/configuration.md- Configurationexamples/guide/build.md- Build and package
Features (功能特性):
examples/features/main-process.md- Main processexamples/features/renderer-process.md- Renderer processexamples/features/ipc-communication.md- IPC communicationexamples/features/window-management.md- Window managementexamples/features/menu.md- Menuexamples/features/tray.md- System trayexamples/features/auto-updater.md- Auto updaterexamples/features/plugin-system.md- Plugin system
3. Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- Electron EGG is based on Electron and Egg.js
- Main process and renderer process separation
- IPC communication between processes
- Each example file includes key concepts, code examples, and key points
4. Reference API documentation in the api/ directory when needed:
api/main-api.md- Main process APIapi/renderer-api.md- Renderer process APIapi/ipc-api.md- IPC APIapi/window-api.md- Window APIapi/config-api.md- Configuration API
API Files:
api/main-api.md- Application class, BrowserWindow, ipcMain, app methodsapi/renderer-api.md- ipcRenderer, contextBridge, DOM APIsapi/ipc-api.md- IPC communication methods and eventsapi/window-api.md- Window creation and managementapi/config-api.md- Configuration options and environment variables
5. Use templates from the templates/ directory:
templates/installation.md- Installation templatestemplates/project-setup.md- Project setup templatestemplates/configuration.md- Configuration templates
1. Understanding Electron EGG
Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
Key Concepts:
- Electron: Cross-platform desktop application framework
- Egg.js: Node.js enterprise application framework
- Main Process: Main application process
- Renderer Process: UI rendering process
- IPC: Inter-process communication
- Plugin System: Extensible plugin architecture
2. Installation
Using npm:
npm install ee-coreUsing yarn:
yarn add ee-coreUsing pnpm:
pnpm add ee-core3. Basic Setup
// main.js
const { Application } = require('ee-core')
const app = new Application({
// Configuration
})
app.start()Doc mapping (one-to-one with official documentation)
examples/→ https://www.kaka996.com/pages/987b1c/api/→ https://www.kaka996.com/pages/a99b72/
Examples and Templates
This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).
To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/directory for common scaffolding - Adapt templates to your specific needs and coding style
API Reference
Detailed API documentation is available in the api/ directory, organized to match the official Electron EGG API documentation structure (https://www.kaka996.com/pages/a99b72/):
Main Process API (api/main-api.md)
- Application class and methods
- BrowserWindow creation and management
- ipcMain IPC handling
- Application lifecycle hooks
Renderer Process API (api/renderer-api.md)
- ipcRenderer IPC communication
- contextBridge for secure API exposure
- DOM APIs available in renderer
- Event handling
IPC API (api/ipc-api.md)
- IPC communication methods (ipcMain, ipcRenderer)
- Message sending and receiving
- Async and sync IPC
- Event handling and channels
Window API (api/window-api.md)
- BrowserWindow creation and options
- Window management methods
- Window events
- Window lifecycle
Configuration API (api/config-api.md)
- Configuration file structure
- App info configuration
- Window configuration
- Plugin configuration
- Environment variables
To use API reference: 1. Identify the API you need help with 2. Load the corresponding API file from the api/ directory 3. Find the API signature, parameters, return type, and examples 4. Reference the linked example files for detailed usage patterns 5. All API files include links to relevant example files in the examples/ directory
Best Practices
1. Separate processes: Keep main process and renderer process code separate 2. Use IPC: Use IPC for inter-process communication 3. Handle errors: Properly handle errors in both processes 4. Security: Follow Electron security best practices 5. Performance: Optimize application performance 6. Build configuration: Configure build and package properly 7. Plugin system: Use plugin system for extensibility
Resources
- Official Documentation: https://www.kaka996.com/
- Usage Guide: https://www.kaka996.com/pages/987b1c/
- API Documentation: https://www.kaka996.com/pages/a99b72/
- Gitee Repository: https://gitee.com/dromara/electron-egg
Keywords
Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system
能力边界
✅ 适用场景
- 当你需要使用此技能对应的技术栈时
- 当项目需要遵循最佳实践时
- 当需要快速上手或深入理解核心概念时
⚠️ 需要注意
- 复杂业务逻辑需要结合具体场景调整
- 性能优化需要根据实际数据量评估
❌ 不适用场景
- 不相关的技术栈或框架
- 需要完全自定义的特殊场景
常见陷阱 (Gotchas)
1. 版本兼容性:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 2. 配置文件格式:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 3. 环境变量:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 4. 依赖冲突:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 5. 性能陷阱:大数据量场景下注意性能优化,避免 N+1 查询等常见问题
使用流程
Step 1: 环境准备
确保开发环境已安装必要的依赖和工具。
Step 2: 配置初始化
根据项目需求进行基础配置。
Step 3: 核心功能使用
按照示例代码实现核心功能。
Step 4: 测试验证
运行测试确保功能正常。
Step 5: 部署上线
完成开发后进行部署和监控。
Configuration API
API Reference
Electron EGG configuration API.
Configuration Files
Configuration files are in the config/ directory:
config.default.js- Default configurationconfig.local.js- Local development configurationconfig.prod.js- Production configuration
App Info Configuration
appInfo: {
name: string, // App name
baseDir: string, // Base directory
env: string, // Environment
home: string, // Home directory
root: string, // Root directory
appUserDataDir: string // User data directory
}Window Configuration
mainWindow: {
width: number, // Window width
height: number, // Window height
minWidth: number, // Minimum width
minHeight: number, // Minimum height
title: string, // Window title
frame: boolean, // Show frame
transparent: boolean // Transparent window
}Plugin Configuration
addons: {
tray: {
enable: boolean // Enable system tray
},
security: {
enable: boolean // Enable security
},
autoUpdater: {
enable: boolean // Enable auto updater
}
}Environment Variables
NODE_ENV- Node environmentELECTRON_EGG_ENV- Electron EGG environment
See also: examples/guide/configuration.md for detailed examples
IPC API
API Reference
Electron EGG IPC communication API.
Main Process (ipcMain)
ipcMain.on(channel, listener)
- Listen for IPC messages from renderer
ipcMain.once(channel, listener)
- Listen for IPC message once
ipcMain.handle(channel, listener)
- Handle IPC requests (async)
ipcMain.removeListener(channel, listener)
- Remove IPC listener
ipcMain.removeAllListeners(channel)
- Remove all listeners for channel
Renderer Process (ipcRenderer)
ipcRenderer.send(channel, ...args)
- Send message to main process
ipcRenderer.sendSync(channel, ...args)
- Send synchronous message to main process
ipcRenderer.on(channel, listener)
- Listen for IPC messages from main
ipcRenderer.once(channel, listener)
- Listen for IPC message once
ipcRenderer.invoke(channel, ...args)
- Invoke handler in main process (async)
ipcRenderer.removeListener(channel, listener)
- Remove IPC listener
Event Object
event.sender
- WebContents that sent the message
event.reply(channel, ...args)
- Reply to sender
event.returnValue
- Return value for synchronous messages
See also: examples/features/ipc-communication.md for detailed examples
Main Process API
API Reference
Electron EGG main process API.
Application Class
new Application(options)
- Create new application instance
app.start()
- Start the application
app.on(event, callback)
- Listen to application events
BrowserWindow
new BrowserWindow(options)
- Create new browser window
window.loadFile(path)
- Load HTML file
window.loadURL(url)
- Load URL
window.webContents.send(channel, ...args)
- Send message to renderer
ipcMain
ipcMain.on(channel, listener)
- Listen for IPC messages
ipcMain.handle(channel, listener)
- Handle IPC requests
ipcMain.removeListener(channel, listener)
- Remove IPC listener
app
app.quit()
- Quit the application
app.getPath(name)
- Get application path
app.on(event, callback)
- Listen to app events
See also: examples/features/main-process.md for detailed examples
Renderer Process API
API Reference
Electron EGG renderer process API.
ipcRenderer
ipcRenderer.send(channel, ...args)
- Send message to main process
ipcRenderer.sendSync(channel, ...args)
- Send synchronous message to main process
ipcRenderer.on(channel, listener)
- Listen for IPC messages from main
ipcRenderer.once(channel, listener)
- Listen for IPC message once
ipcRenderer.invoke(channel, ...args)
- Invoke handler in main process (async)
ipcRenderer.removeListener(channel, listener)
- Remove IPC listener
ipcRenderer.removeAllListeners(channel)
- Remove all listeners for channel
remote (deprecated)
remote.require(module)
- Require module from main process (deprecated in Electron 12+)
remote.getCurrentWindow()
- Get current window (deprecated)
contextBridge (Electron 12+)
contextBridge.exposeInMainWorld(apiKey, api)
- Expose API to renderer process securely
Example:
// Main process
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
send: (channel, data) => ipcRenderer.send(channel, data),
on: (channel, callback) => ipcRenderer.on(channel, callback)
})DOM APIs
Renderer process has access to all standard DOM APIs:
document- Document objectwindow- Window objectlocalStorage- Local storagesessionStorage- Session storage
See also: examples/features/renderer-process.md for detailed examples
Window API
API Reference
Electron EGG window management API.
BrowserWindow
new BrowserWindow(options)
- Create new browser window
Options:
width- Window widthheight- Window heightminWidth- Minimum widthminHeight- Minimum heighttitle- Window titleframe- Show window frametransparent- Transparent windowresizable- Resizable windowmaximizable- Maximizable windowminimizable- Minimizable window
Window Methods
window.loadFile(path)
- Load HTML file
window.loadURL(url)
- Load URL
window.show()
- Show window
window.hide()
- Hide window
window.close()
- Close window
window.minimize()
- Minimize window
window.maximize()
- Maximize window
window.restore()
- Restore window
Window Events
window.on('closed', callback)
- Window closed event
window.on('ready-to-show', callback)
- Window ready to show event
window.on('maximize', callback)
- Window maximized event
window.on('unmaximize', callback)
- Window unmaximized event
See also: examples/features/window-management.md for detailed examples
IPC Communication
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates IPC communication in Electron EGG.
Key Concepts
- IPC channels
- Message sending
- Message receiving
- Event handling
Example: Main Process IPC
// main/index.js
const { ipcMain } = require('electron')
// Listen for messages
ipcMain.on('message', (event, data) => {
console.log('Received:', data)
// Reply to renderer
event.reply('reply', { status: 'success' })
})
// Handle synchronous messages
ipcMain.on('sync-message', (event, data) => {
event.returnValue = 'Response'
})Example: Renderer Process IPC
// renderer/src/index.js
const { ipcRenderer } = require('electron')
// Send message to main process
ipcRenderer.send('message', { data: 'Hello' })
// Listen for reply
ipcRenderer.on('reply', (event, data) => {
console.log('Received:', data)
})
// Send synchronous message
const result = ipcRenderer.sendSync('sync-message', { data: 'Hello' })
console.log('Result:', result)Example: IPC Channels
// Define IPC channels
const IPC_CHANNELS = {
GET_DATA: 'get-data',
SET_DATA: 'set-data',
NOTIFY: 'notify'
}
// Main process
ipcMain.on(IPC_CHANNELS.GET_DATA, (event) => {
event.reply(IPC_CHANNELS.GET_DATA, { data: 'value' })
})
// Renderer process
ipcRenderer.send(IPC_CHANNELS.GET_DATA)
ipcRenderer.on(IPC_CHANNELS.GET_DATA, (event, data) => {
console.log('Data:', data)
})Key Points
- Use ipcMain in main process
- Use ipcRenderer in renderer process
- Define IPC channels
- Handle async and sync messages
- Proper error handling
Main Process
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates main process usage in Electron EGG.
Key Concepts
- Main process entry
- Application lifecycle
- Window management
- IPC handling
Example: Main Process Entry
// main/index.js
const { Application } = require('ee-core')
const app = new Application({
// Configuration
})
app.start()Example: Application Lifecycle
// main/index.js
const { Application } = require('ee-core')
const app = new Application()
app.on('ready', () => {
console.log('Application ready')
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.start()Example: Window Management
// main/window/main.js
const { BrowserWindow } = require('electron')
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 800
})
win.loadFile('renderer/index.html')
return win
}
module.exports = { createWindow }Example: IPC Handling
// main/index.js
const { ipcMain } = require('electron')
ipcMain.on('message', (event, data) => {
console.log('Received:', data)
event.reply('reply', 'Response')
})Key Points
- Main process runs in Node.js
- Handle application lifecycle
- Manage windows
- Handle IPC communication
- Access Node.js APIs
Renderer Process
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates renderer process usage in Electron EGG.
Key Concepts
- Renderer process entry
- UI rendering
- IPC communication
- DOM manipulation
Example: Renderer Process Entry
<!-- renderer/index.html -->
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
</head>
<body>
<div id="app"></div>
<script src="./src/index.js"></script>
</body>
</html>Example: UI Rendering
// renderer/src/index.js
document.addEventListener('DOMContentLoaded', () => {
const app = document.getElementById('app')
app.innerHTML = '<h1>Hello Electron EGG</h1>'
})Example: IPC Communication
// renderer/src/index.js
const { ipcRenderer } = require('electron')
// Send message to main process
ipcRenderer.send('message', { data: 'Hello' })
// Listen for reply
ipcRenderer.on('reply', (event, data) => {
console.log('Received:', data)
})Example: DOM Manipulation
// renderer/src/index.js
const button = document.getElementById('button')
button.addEventListener('click', () => {
console.log('Button clicked')
})Key Points
- Renderer process runs in browser
- Use HTML/CSS/JavaScript
- Communicate via IPC
- Access DOM APIs
- Limited Node.js access
Build and Package
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates how to build and package Electron EGG applications.
Key Concepts
- Build process
- Package configuration
- Platform-specific builds
- Distribution
Example: Build Process
# Build for production
npm run build
# Build for specific platform
npm run build:win
npm run build:mac
npm run build:linuxExample: Package Configuration
{
"build": {
"appId": "com.example.myapp",
"productName": "My App",
"directories": {
"output": "dist"
},
"files": [
"main/**/*",
"renderer/**/*",
"config/**/*"
]
}
}Example: Platform-Specific Builds
# Windows
npm run build:win
# macOS
npm run build:mac
# Linux
npm run build:linux
# All platforms
npm run build:allExample: Distribution
After building, distribution files are in the dist directory:
- Windows:
.exeinstaller - macOS:
.dmgor.pkg - Linux:
.AppImageor.deb
Key Points
- Use npm run build for production
- Configure build options
- Support multiple platforms
- Output to dist directory
- Follow platform conventions
Configuration
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates how to configure Electron EGG.
Key Concepts
- Configuration files
- App info configuration
- Window configuration
- Plugin configuration
Example: Configuration Files
// config/config.default.js
module.exports = {
appInfo: {
name: 'my-app',
baseDir: __dirname,
env: 'local',
home: process.env.HOME,
root: process.cwd(),
appUserDataDir: ''
}
}Example: App Info Configuration
module.exports = {
appInfo: {
name: 'my-app', // App name
baseDir: __dirname, // Base directory
env: 'local', // Environment
home: process.env.HOME, // Home directory
root: process.cwd(), // Root directory
appUserDataDir: '' // User data directory
}
}Example: Window Configuration
module.exports = {
mainWindow: {
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
title: 'My App',
frame: true,
transparent: false
}
}Example: Plugin Configuration
module.exports = {
addons: {
tray: {
enable: true
},
security: {
enable: true
},
autoUpdater: {
enable: false
}
}
}Key Points
- Configure in config files
- Support multiple environments
- Window configuration options
- Plugin enable/disable
- Environment-specific configs
Installation
官方文档: https://www.kaka996.com/,
Instructions
This example demonstrates how to install Electron EGG.
Key Concepts
- Environment requirements
- Package installation
- Project initialization
- Dependencies
Example: Environment Requirements
- Node.js >= 14.x
- npm or yarn or pnpm
- Go (optional, for Go business process)
Example: Package Installation
# Using npm
npm install ee-core
# Using yarn
yarn add ee-core
# Using pnpm
pnpm add ee-coreExample: Project Initialization
# Clone demo repository
git clone https://gitee.com/dromara/electron-egg.git
# Install dependencies
cd electron-egg
npm installExample: Install Dependencies
# Install all dependencies
npm install
# Or using yarn
yarn install
# Or using pnpm
pnpm installKey Points
- Check Node.js version
- Install dependencies properly
- Use demo repository for quick start
- Support npm, yarn, pnpm
- Optional Go support
Introduction
官方文档: https://www.kaka996.com/,
Instructions
This example provides an introduction to Electron EGG.
Key Concepts
- What is Electron EGG
- Framework architecture
- Core features
- Version information
Example: What is Electron EGG
Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
Example: Framework Architecture
Electron EGG uses a multi-process architecture:
- Main Process: Main application process
- Renderer Process: UI rendering process
- Business Process: Optional business logic process (Python/Go)
Example: Core Features
- Multi-process Architecture: Main, renderer, and business processes
- IPC Communication: Inter-process communication
- Plugin System: Extensible plugin architecture
- Hot Reload: Development hot reload
- Build Tools: Complete build and package tools
- Cross-platform: Support Windows, macOS, Linux
Example: Version Information
Electron EGG v4.x is the current stable version.
Key Points
- Based on Electron and Egg.js
- Multi-process architecture
- Rich development tools
- Plugin system support
- Active development and maintenance
Project Structure
官方文档: https://www.kaka996.com/,
Instructions
This example explains Electron EGG project structure.
Key Concepts
- Directory structure
- File organization
- Configuration files
- Process separation
Example: Directory Structure
project/
├── main/ # Main process
│ ├── index.js # Main entry
│ ├── window/ # Window management
│ ├── menu/ # Menu
│ └── tray/ # System tray
├── renderer/ # Renderer process
│ ├── src/ # Source code
│ ├── public/ # Static files
│ └── index.html # Entry HTML
├── config/ # Configuration
│ ├── config.default.js # Default config
│ └── config.prod.js # Production config
├── build/ # Build scripts
├── public/ # Public resources
└── package.jsonExample: Main Process Files
// main/index.js
const { Application } = require('ee-core')
const app = new Application({
// Configuration
})
app.start()Example: Renderer Process Files
<!-- renderer/index.html -->
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
</head>
<body>
<div id="app"></div>
<script src="./src/index.js"></script>
</body>
</html>Key Points
- Separate main and renderer processes
- Organize files by process
- Configuration in config directory
- Build scripts in build directory
- Follow project structure conventions
Quick Start
官方文档: https://www.kaka996.com/,
Instructions
This example provides a quick start guide for Electron EGG.
Key Concepts
- Project structure
- Start development
- Build application
- Basic configuration
Example: Project Structure
electron-egg/
├── main/ # Main process
├── renderer/ # Renderer process
├── public/ # Static resources
├── config/ # Configuration files
├── build/ # Build scripts
└── package.jsonExample: Start Development
# Start development server
npm run dev
# Or using yarn
yarn dev
# Or using pnpm
pnpm devExample: Build Application
# Build for production
npm run build
# Or using yarn
yarn build
# Or using pnpm
pnpm buildExample: Basic Configuration
// config/config.default.js
module.exports = {
appInfo: {
name: 'my-app',
baseDir: __dirname,
env: 'local'
},
mainWindow: {
width: 1200,
height: 800
}
}Key Points
- Use npm run dev for development
- Use npm run build for production
- Configure in config files
- Follow project structure
- Support hot reload in development
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Configuration Templates
Basic Configuration
// config/config.default.js
module.exports = {
appInfo: {
name: 'my-app',
baseDir: __dirname,
env: 'local'
}
}Window Configuration
module.exports = {
mainWindow: {
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
title: 'My App',
frame: true,
transparent: false
}
}Plugin Configuration
module.exports = {
addons: {
tray: {
enable: true
},
security: {
enable: true
},
autoUpdater: {
enable: false
}
}
}Environment-Specific Configuration
// config/config.prod.js
module.exports = {
appInfo: {
env: 'prod'
},
mainWindow: {
width: 1400,
height: 900
}
}Installation Templates
npm Installation
npm install ee-coreProject Initialization
# Clone demo repository
git clone https://gitee.com/dromara/electron-egg.git
# Install dependencies
cd electron-egg
npm installEnvironment Setup
# Check Node.js version
node --version # Should be >= 14.x
# Install dependencies
npm installComplete Setup
# 1. Clone repository
git clone https://gitee.com/dromara/electron-egg.git
# 2. Install dependencies
cd electron-egg
npm install
# 3. Start development
npm run devProject Setup Templates
Basic Project Structure
project/
├── main/ # Main process
│ ├── index.js
│ └── window/
├── renderer/ # Renderer process
│ ├── src/
│ └── index.html
├── config/ # Configuration
│ └── config.default.js
├── build/ # Build scripts
└── package.jsonMain Process Entry
// main/index.js
const { Application } = require('ee-core')
const app = new Application({
// Configuration
})
app.start()Renderer Process Entry
<!-- renderer/index.html -->
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
</head>
<body>
<div id="app"></div>
<script src="./src/index.js"></script>
</body>
</html>Configuration File
// config/config.default.js
module.exports = {
appInfo: {
name: 'my-app',
baseDir: __dirname,
env: 'local'
},
mainWindow: {
width: 1200,
height: 800
}
}package.json Scripts
{
"scripts": {
"dev": "electron-egg dev",
"build": "electron-egg build",
"start": "electron-egg start"
}
}