PageSourceSearch

https://www.electronjs.org/assets/js/e87dbfd5.140e33de.js

js electronjs.org collected 2026-09-24 07:04:51 UTC 12,277 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkelectronjs=self.webpackChunkelectronjs||[]).push([["30141"],{63216(e,n,t){t.r(n),t.d(n,{metadata:()=>o,default:()=>u,frontMatter:()=>i,contentTitle:()=>c,toc:()=>l,assets:()=>d});var o=JSON.parse('{"id":"latest/development/source-code-directory-structure","title":"Source Code Directory Structure","description":"The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.","source":"@site/docs/latest/development/source-code-directory-structure.md","sourceDirName":"latest/development","slug":"/latest/development/source-code-directory-structure","permalink":"/docs/latest/development/source-code-directory-structure","draft":false,"unlisted":false,"editUrl":"https://github.com/electron/electron/edit/main/docs/development/source-code-directory-structure.md","tags":[],"version":"current","frontMatter":{"title":"Source Code Directory Structure","description":"The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.","slug":"source-code-directory-structure","hide_title":false},"sidebar":"docs","previous":{"title":"Patches in Electron","permalink":"/docs/latest/development/patches"},"next":{"title":"Electron Documentation Style Guide","permalink":"/docs/latest/development/style-guide"}}'),r=t(74848),s=t(28453);let i={title:"Source Code Directory Structure",description:"The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.",slug:"source-code-directory-structure",hide_title:!1},c="Source Code Directory Structure",d={},l=[{value:"Project structure",id:"project-structure",level:2},{value:"Structure of Electron source code",id:"structure-of-electron-source-code",level:2},{value:"Structure of other Electron directories",id:"structure-of-other-electron-directories",level:2}];function a(e){let n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"source-code-directory-structure",children:"Source Code Directory Structure"})}),"\n",(0,r.jsx)(n.p,{children:"The source code of Electron is separated into a few parts, mostly\nfollowing Chromium on the separation conventions."}),"\n",(0,r.jsxs)(n.p,{children:["You may need to become familiar with\n",(0,r.jsx)(n.a,{href:"https://www.chromium.org/developers/design-documents/multi-process-architecture/",children:"Chromium's multi-process architecture"}),"\nto understand the source code better."]}),"\n",(0,r.jsx)(n.h2,{id:"project-structure",children:"Project structure"}),"\n",(0,r.jsxs)(n.p,{children:["Electron is a complex project containing multiple upstream dependencies, which are tracked in source\ncontrol via the ",(0,r.jsx)(n.a,{href:"https://github.com/electron/electron/blob/v44.4.5/DEPS",children:(0,r.jsx)(n.code,{children:"DEPS"})})," file. When\n",(0,r.jsx)(n.a,{href:"/docs/latest/development/build-instructions-gn",children:"initializing a local Electron checkout"}),", Electron's source code is just one\nof many nested folders within the project root."]}),"\n",(0,r.jsxs)(n.p,{children:["The project contains a single ",(0,r.jsx)(n.code,{children:"src"})," folder that corresponds to a specific git checkout of\n",(0,r.jsxs)(n.a,{href:"https://source.chromium.org/chromium/chromium/src",children:["Chromium's ",(0,r.jsx)(n.code,{children:"src"})," folder"]}),". In addition, Electron's\nrepository code is contained in ",(0,r.jsx)(n.code,{children:"src/electron"})," (with its own nested git repository), and other\nElectron-specific third-party dependencies (e.g. ",(0,r.jsx)(n.a,{href:"https://github.com/nodejs/nan",children:"nan"})," or\n",(0,r.jsx)(n.a,{href:"https://github.com/nodejs/node",children:"node"}),") are located in ",(0,r.jsx)(n.code,{children:"src/third_party"})," (along with all other\nChromium third-party dependencies, such as WebRTC or ANGLE)."]}),"\n",(0,r.jsxs)(n.p,{children:["For all code outside of ",(0,r.jsx)(n.code,{children:"src/electron"}),", Electron-specific code changes are maintained via git patches.\nSee the ",(0,r.jsx)(n.a,{href:"/docs/latest/development/patches",children:"Patches"})," development guide for more information."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-plaintext",children:"Project Root\n\u2514\u2500\u2500 src\n    \u251C\u2500\u2500 electron\n    \u251C\u2500\u2500 third_party\n    \u2502\xa0\xa0 \u251C\u2500\u2500 nan\n    \u2502\xa0\xa0 \u251C\u2500\u2500 electron_node\n    \u2502\xa0\xa0 \u2514\u2500\u2500 ...other third party deps\n    \u2514\u2500\u2500 ...other folders\n"})}),"\n",(0,r.jsx)(n.h2,{id:"structure-of-electron-source-code",children:"Structure of Electron source code"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-plaintext",children:"Electron\n\u251C\u2500\u2500 build/ - Build configuration files needed to build with GN.\n\u251C\u2500\u2500 buildflags/ - Determines the set of features that can be conditionally built.\n\u251C\u2500\u2500 chromium_src/ - Source code 
1copied from Chromium that isn't part of the content layer.\n\u251C\u2500\u2500 default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n\u251C\u2500\u2500 docs/ - Electron's documentation.\n|   \u251C\u2500\u2500 api/ - Documentation for Electron's externally-facing modules and APIs.\n|   \u251C\u2500\u2500 development/ - Documentation to aid in developing for and with Electron.\n|   \u251C\u2500\u2500 fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   \u251C\u2500\u2500 images/ - Images used in documentation.\n|   \u2514\u2500\u2500 tutorial/ - Tutorial documents for various aspects of Electron.\n\u251C\u2500\u2500 lib/ - JavaScript/TypeScript source code.\n|   \u251C\u2500\u2500 browser/ - Main process initialization code.\n|   |   \u251C\u2500\u2500 api/ - API implementation for main process modules.\n|   \u251C\u2500\u2500 common/ - Relating to logic needed by both main and renderer processes.\n|   |   \u2514\u2500\u2500 api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   \u251C\u2500\u2500 isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   \u251C\u2500\u2500 node/ - Initialization code for Node.js in the main process.\n\u2502\xa0\xa0 \u251C\u2500\u2500 preload_realm/ - Initialization code for sandboxed renderer preload scripts.\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 api/ - API implementation for preload scripts.\n|   \u251C\u2500\u2500 renderer/ - Renderer process initialization code.\n|   |   \u251C\u2500\u2500 api/ - API implementation for renderer process modules.\n|   |   \u2514\u2500\u2500 web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   \u251C\u2500\u2500 sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   \u2514\u2500\u2500 api/ - API implementation for sandboxed renderer processes.\n\u2502\xa0\xa0 \u251C\u2500\u2500 utility/ - Utility process initialization code.\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 api/ - API implementation for utility process modules.\n|   \u2514\u2500\u2500 worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n\u251C\u2500\u2500 patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   \u251C\u2500\u2500 boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   \u251C\u2500\u2500 chromium/ - Patches applied to Chromium.\n|   \u251C\u2500\u2500 node/ - Patches applied on top of Node.js.\n|   \u2514\u2500\u2500 v8/ - Patches applied on top of Google's V8 engine.\n\u251C\u2500\u2500 shell/ - C++ source code.\n|   \u251C\u2500\u2500 app/ - System entry code.\n|   \u251C\u2500\u2500 browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\
1n|   |   \u251C\u2500\u2500 ui/ - Implementation of UI stuff for different platforms.\n|   |   |   \u251C\u2500\u2500 cocoa/ - Cocoa specific source code.\n|   |   |   \u251C\u2500\u2500 win/ - Windows GUI specific source code.\n|   |   |   \u2514\u2500\u2500 x/ - X11 specific source code.\n|   |   \u251C\u2500\u2500 api/ - The implementation of the main process APIs.\n|   |   \u251C\u2500\u2500 net/ - Network related code.\n|   |   \u251C\u2500\u2500 mac/ - Mac specific Objective-C source code.\n|   |   \u2514\u2500\u2500 resources/ - Icons, platform-dependent files, etc.\n|   \u251C\u2500\u2500 renderer/ - Code that runs in renderer process.\n|   |   \u2514\u2500\u2500 api/ - The implementation of renderer process APIs.\n|   \u251C\u2500\u2500 common/ - Code that used by both the main and renderer processes,\n|   |   |         including some helper functions and code to integrate node's\n|   |   |         message loop into Chromium's message loop.\n|   |   \u2514\u2500\u2500 api/ - The implementation of common APIs, and foundations of\n|   |              Electron's built-in modules.\n\u2502\xa0\xa0 \u251C\u2500\u2500 services/node/ - Provides a Node.js runtime to utility processes. \n\u2502\xa0\xa0 \u2514\u2500\u2500 utility - Code that runs in the utility process.\n\u251C\u2500\u2500 spec/ - Components of Electron's test suite run in the main process.\n\u251C\u2500\u2500 typings/ - Internal TypeScript types that aren't exported in electron.d.ts.\n\u2514\u2500\u2500 BUILD.gn - Building rules of Electron.\n"})}),"\n",(0,r.jsx)(n.h2,{id:"structure-of-other-electron-directories",children:"Structure of other Electron directories"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:".github"})," - GitHub-specific config files including issues templates, CI with GitHub Actions and CODEOWNERS."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"dist"})," - Temporary directory created by ",(0,r.jsx)(n.code,{children:"script/create-dist.py"})," script\nwhen creating a distribution."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"node_modules"})," - Third party node modules used for building."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"npm"})," - Logic for installation of Electron via npm."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"out"})," - Temporary output directory for ",(0,r.jsx)(n.code,{children:"siso"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"script"})," - Scripts used for development purpose like building, packaging,\ntesting, etc."]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-plaintext",children:"script/ - The set of all scripts Electron runs for a variety of purposes.\n\u251C\u2500\u2500 codesign/ - Fakes codesigning for Electron apps; used for testing.\n\u251C\u2500\u2500 lib/ - Miscellaneous python utility scripts.\n\u2514\u2500\u2500 release/ - Scripts run during Electron's release process.\n    \u251C\u2500\u2500 notes/ - Generates release notes for new Electron versions.\n    \u2514\u2500\u2500 uploaders/ - Uploads various release-related files during release.\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"typings"})," - TypeScript typings for Electron's internal code."]}),"\n"]})]})}function u(e={}){let{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},28453(e,n,t){t.d(n,{R:()=>i,x:()=>c});var o=t(96540);let r={},s=o.createContext(r);function i(e){let n=o.useContext(s);return o.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),o.createElement(s.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.