Skip to main content
GitHub Desktop uses Electron’s multi-process architecture to separate system-level operations from the UI rendering layer.

Process Architecture

Main Process

Node.js environment managing windows, menus, and system integration

Renderer Process

Chromium-based browser environment running the React UI
The main process acts as the “backend” while renderer processes are “frontends”. Communication happens via IPC (Inter-Process Communication).

Main Process

Located in app/src/main-process/, the main process handles:

Entry Point: main.ts

File: app/src/main-process/main.ts The main entry point initializes the application:

Key Responsibilities

  1. Application Lifecycle
    • App initialization and shutdown
    • Single instance enforcement
    • Update checking and installation
  2. Window Management (app-window.ts)
    • Creating and managing BrowserWindow instances
    • Window state persistence (size, position)
    • Zoom level management
  3. Menu System (menu/)
    • Application menu construction
    • Context menus
    • Keyboard shortcuts
  4. System Integration
    • Shell operations
    • File system access
    • Notification permissions

AppWindow Class

File: app/src/main-process/app-window.ts
The AppWindow class encapsulates all window-related logic, including state persistence, event handling, and lifecycle management.

Main Process Modules

IPC Communication

File: app/src/main-process/ipc-main.ts Handles communication from renderer to main:
Directory: app/src/main-process/menu/ Dynamic menu construction based on application state:

Exception Handling

File: app/src/main-process/exception-reporting.ts Centralized error reporting:

Crash Window

File: app/src/main-process/crash-window.ts Displays a crash dialog when unhandled exceptions occur:

Renderer Process

Located in app/src/ui/, the renderer process runs the React application.

Entry Point: index.tsx

File: app/src/ui/index.tsx

Main App Component

File: app/src/ui/app.tsx (excerpt)
The renderer process has access to Node.js APIs because nodeIntegration: true is enabled. This allows direct file system access and Git operations.

IPC Communication Patterns

Main → Renderer (Push)

Use case: Sending menu events to renderer

Renderer → Main (Request/Response)

Use case: Opening file dialogs

Main Process Proxy

File: app/src/ui/main-process-proxy.ts Provides type-safe wrapper around IPC:

Web Request Filtering

File: app/src/main-process/ordered-webrequest.ts Intercepts and modifies network requests:

Security Considerations

Node Integration

Enabled for Git operations but restricted to trusted code

Content Security

Web request filtering prevents unauthorized requests

Certificate Pinning

Custom certificate trust dialog for Git over HTTPS

Sandboxed Markdown

User-generated content rendered in isolated context

Platform-Specific Code

macOS

Windows

Debugging

Main Process

Renderer Process

Performance Monitoring

File: app/src/main-process/now.ts High-resolution timing for performance metrics:

UI Components

Learn about the React component structure

State Management

Understand how state flows through the app