Source Code Directory Structure
The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.
You may need to become familiar with Chromium's multi-process architecture to understand the source code better.
Structure of Source Codeβ
Electron
βββ build/ - Build configuration files needed to build with GN.
βββ buildflags/ - Determines the set of features that can be conditionally built.
βββ chromium_src/ - Source code copied from Chromium that isn't part of the content layer.
βββ default_app/ - A default app run when Electron is started without
| providing a consumer app.
βββ docs/ - Electron's documentation.
| βββ api/ - Documentation for Electron's externally-facing modules and APIs.
| βββ development/ - Documentation to aid in developing for and with Electron.
| βββ fiddles/ - A set of code snippets one can run in Electron Fiddle.
| βββ images/ - Images used in documentation.
| βββ tutorial/ - Tutorial documents for various aspects of Electron.
βββ lib/ - JavaScript/TypeScript source code.
| βββ browser/ - Main process initialization code.
| | βββ api/ - API implementation for main process modules.
| | βββ remote/ - Code related to the remote module as it is
| | used in the main process.
| βββ common/ - Relating to logic needed by both main and renderer processes.
| | βββ api/ - API implementation for modules that can be used in
| | both the main and renderer processes
| βββ isolated_renderer/ - Handles creation of isolated renderer processes when
| | contextIsolation is enabled.
| βββ renderer/ - Renderer process initialization code.
| | βββ api/ - API implementation for renderer process modules.
| | βββ extension/ - Code related to use of Chrome Extensions
| | | in Electron's renderer process.
| | βββ remote/ - Logic that handles use of the remote module in
| | | the main process.
| | βββ web-view/ - Logic that handles the use of webviews in the
| | renderer process.
| βββ sandboxed_renderer/ - Logic that handles creation of sandboxed renderer
| | | processes.
| | βββ api/ - API implementation for sandboxed renderer processes.
| βββ worker/ - Logic that handles proper functionality of Node.js
| environments in Web Workers.
βββ patches/ - Patches applied on top of Electron's core dependencies
| | in order to handle differences between our use cases and
| | default functionality.
| βββ boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.
| βββ chromium/ - Patches applied to Chromium.
| βββ node/ - Patches applied on top of Node.js.
| βββ v8/ - Patches applied on top of Google's V8 engine.
βββ shell/ - C++ source code.
| βββ app/ - System entry code.
| βββ browser/ - The frontend including the main window, UI, and all of the
| | | main process things. This talks to the renderer to manage web
| | | pages.
| | βββ ui/ - Implementation of UI stuff for different platforms.
| | | βββ cocoa/ - Cocoa specific source code.
| | | βββ win/ - Windows GUI specific source code.
| | | βββ x/ - X11 specific source code.
| | βββ api/ - The implementation of the main process APIs.
| | βββ net/ - Network related code.
| | βββ mac/ - Mac specific Objective-C source code.
| | βββ resources/ - Icons, platform-dependent files, etc.
| βββ renderer/ - Code that runs in renderer process.
| | βββ api/ - The implementation of renderer process APIs.
| βββ common/ - Code that used by both the main and renderer processes,
| | including some utility functions and code to integrate node's
| | message loop into Chromium's message loop.
| βββ api/ - The implementation of common APIs, and foundations of
| Electron's built-in modules.
βββ spec/ - Components of Electron's test suite run in the main process.
βββ BUILD.gn - Building rules of Electron.
Structure of Other Directoriesβ
- .github - GitHub-specific config files including issues templates, CI with GitHub Actions and CODEOWNERS.
- dist - Temporary directory created by
script/create-dist.py
script when creating a distribution. - node_modules - Third party node modules used for building.
- npm - Logic for installation of Electron via npm.
- out - Temporary output directory of
ninja
. - script - Scripts used for development purpose like building, packaging, testing, etc.
script/ - The set of all scripts Electron runs for a variety of purposes.
βββ codesign/ - Fakes codesigning for Electron apps; used for testing.
βββ lib/ - Miscellaneous python utility scripts.
βββ release/ - Scripts run during Electron's release process.
βββ notes/ - Generates release notes for new Electron versions.
βββ uploaders/ - Uploads various release-related files during release.
- typings - TypeScript typings for Electron's internal code.