| 
									
										
										
										
											2015-08-30 22:31:43 -07:00
										 |  |  | # Source Code Directory Structure
 | 
					
						
							| 
									
										
										
										
											2013-09-09 15:35:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:31:43 -07:00
										 |  |  | The source code of Electron is separated into a few parts, mostly | 
					
						
							| 
									
										
										
										
											2013-08-29 16:37:51 +02:00
										 |  |  | following Chromium on the separation conventions. | 
					
						
							| 
									
										
										
										
											2013-08-14 15:43:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-28 11:15:18 -07:00
										 |  |  | You may need to become familiar with | 
					
						
							|  |  |  | [Chromium's multi-process architecture](https://dev.chromium.org/developers/design-documents/multi-process-architecture) | 
					
						
							| 
									
										
										
										
											2013-08-29 16:37:51 +02:00
										 |  |  | to understand the source code better. | 
					
						
							| 
									
										
										
										
											2013-08-14 15:43:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:31:43 -07:00
										 |  |  | ## Structure of Source Code
 | 
					
						
							| 
									
										
										
										
											2013-08-14 15:43:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 14:21:50 -05:00
										 |  |  | ```diff | 
					
						
							| 
									
										
										
										
											2015-08-31 21:49:05 -07:00
										 |  |  | Electron | 
					
						
							| 
									
										
										
										
											2020-01-12 21:08:00 -08:00
										 |  |  | ├── 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. | 
					
						
							| 
									
										
										
										
											2020-10-09 03:56:07 -07:00
										 |  |  | |   |   ├── remote/ - Logic that handles use of the remote module in | 
					
						
							| 
									
										
										
										
											2020-01-12 21:08:00 -08:00
										 |  |  | |   |   |             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. | 
					
						
							| 
									
										
										
										
											2016-05-28 00:22:47 +02:00
										 |  |  | |   ├── app/ - System entry code. | 
					
						
							|  |  |  | |   ├── browser/ - The frontend including the main window, UI, and all of the | 
					
						
							| 
									
										
										
										
											2018-06-27 17:46:14 +10:00
										 |  |  | |   |   |          main process things. This talks to the renderer to manage web | 
					
						
							|  |  |  | |   |   |          pages. | 
					
						
							| 
									
										
										
										
											2016-05-28 00:22:47 +02:00
										 |  |  | |   |   ├── 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, | 
					
						
							| 
									
										
										
										
											2018-06-27 17:46:14 +10:00
										 |  |  | |       |         including some utility functions and code to integrate node's | 
					
						
							|  |  |  | |       |         message loop into Chromium's message loop. | 
					
						
							| 
									
										
										
										
											2016-05-28 00:22:47 +02:00
										 |  |  | |       └── api/ - The implementation of common APIs, and foundations of | 
					
						
							| 
									
										
										
										
											2018-06-27 17:46:14 +10:00
										 |  |  | |                  Electron's built-in modules. | 
					
						
							| 
									
										
										
										
											2022-08-16 12:23:13 -07:00
										 |  |  | ├── spec/ - Components of Electron's test suite run in the main process. | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | └── BUILD.gn - Building rules of Electron. | 
					
						
							| 
									
										
										
										
											2015-08-31 21:49:05 -07:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2013-08-14 15:43:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:31:43 -07:00
										 |  |  | ## Structure of Other Directories
 | 
					
						
							| 
									
										
										
										
											2013-08-14 15:43:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-15 11:26:41 -07:00
										 |  |  | * **.github** - GitHub-specific config files including issues templates, CI with GitHub Actions and CODEOWNERS. | 
					
						
							| 
									
										
										
										
											2013-08-29 16:37:51 +02:00
										 |  |  | * **dist** - Temporary directory created by `script/create-dist.py` script | 
					
						
							| 
									
										
										
										
											2016-02-01 14:40:36 +05:30
										 |  |  |   when creating a distribution. | 
					
						
							| 
									
										
										
										
											2020-01-12 21:08:00 -08:00
										 |  |  | * **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. | 
					
						
							| 
									
										
										
										
											2020-11-05 14:12:43 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-12 21:08:00 -08:00
										 |  |  | ```diff | 
					
						
							|  |  |  | 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. | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2020-11-05 14:12:43 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-12 21:08:00 -08:00
										 |  |  | * **typings** - TypeScript typings for Electron's internal code. |