# smol-ai/godmode architecture

> Architecture diagram of the GitHub repository smol-ai/godmode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smol-ai/godmode
- Repository: https://github.com/smol-ai/godmode

## Overview

1. **Overall shape**
   - This is an **Electron desktop app**: a native shell with a React-based renderer, packaged for macOS/Windows/Linux.
   - The app’s core product idea is a **secondary chat browser**: it does not call LLM APIs directly for most providers; it embeds the providers’ **full web apps** in webviews.

2. **Main process boundary**
   - `src/main/*` is the Electron main process.
   - It owns app lifecycle, window creation, native menu, global shortcut behavior, and any IPC-facing desktop concerns.
   - `main.ts`, `menu.ts`, `preload.ts`, and `util.ts` are the key bridge points between the OS and the UI.

3. **Renderer/UI boundary**
   - `src/renderer/*` is the primary user interface built with React.
   - This side contains the visible chrome: title bar, layout, sidebars, settings UI, prompt critic UI, and the browser-pane container.
   - The renderer is where user actions like typing prompts, resizing panes, reordering panes, and toggling modes happen.

4. **Webview/pane model**
   - The central interaction model is **multiple browser panes** shown side by side.
   - Each pane is effectively an embedded provider web app, allowing independent navigation after the shared prompt is sent.
   - `browserPane.tsx`, `components/pane.tsx`, and `components/sidebar.tsx` suggest the layout is pane-driven rather than a single chat transcript.

5. **Provider layer**
   - `src/providers/*` is the provider abstraction layer.
   - Each file represents a specific chat service or model host: ChatGPT/OpenAI, Claude, Bing, Bard, Perplexity, Poe, HuggingChat, Vercel, OpenRouter, local Oobabooga, etc.
   - This is the main domain boundary: each provider encapsulates provider-specific URLs, page behavior, and any special handling required to make the web app usable inside the shell.

6. **Prompt distribution flow**
   - The user enters a prompt in the renderer.
   - That prompt is then propagated to the selected/enabled provider panes, which submit it into each embedded web app.
   - The app’s distinguishing feature is that the same input can be sent to **multiple providers simultaneously**, while still allowing each pane to diverge afterward.

7. **State and settings**
   - Settings are split out into `src/settings/*`, implying a distinct settings experience or window.
   - The app persists user preferences such as enabled providers, hotkeys, startup behavior, theme, and pane arrangement.
   - `src/lib/constants.ts`, `types.ts`, and `utils.ts` provide shared configuration and type definitions used across main and renderer code.

8. **PromptCritic feature**
   - `src/renderer/promptCritic.tsx` is a specialized feature for improving prompts.
   - Architecturally, this is a side feature layered into the renderer, not a separate service.
   - It likely interacts with one of the provider panes or a model-backed workflow, but it remains UI-driven inside the Electron app.

9. **Desktop integration**
   - The README and file layout indicate native desktop behaviors are important: global shortcut open/dismiss, always-on-top pinning, zoom controls, and start-on-login.
   - Those behaviors are typically owned by the main process and surfaced to the renderer via IPC/preload.
   - The preload boundary (`src/main/preload.ts`) is important because it safely exposes desktop capabilities to the browser-like UI.

10. **Build and packaging pipeline**
   - The project uses an Electron/Webpack toolchain under `scripts/configs/*` and `scripts/scripts/*`.
   - There are separate build targets for main, preload, and renderer, which matches the app’s process separation.
   - `release/app/*` indicates packaging/release logic is isolated from source, supporting distributable binaries rather than a pure dev server model.

11. **Assets and platform-specific resources**
   - `assets/*` and `src/images/*` hold app icons, entitlements, and platform packaging resources.
   - These matter because the app is distributed as native installers/binaries, especially for macOS signing/notarization and cross-platform builds.

12. **Tests and quality gates**
   - There is at least a renderer test (`src/__tests__/App.test.tsx`) and GitHub Actions formatting workflow.
   - This suggests the highest-risk logic is in the UI and process coordination rather than in a large backend.

13. **Key architectural takeaway**
   - The repo is best diagrammed as: **Electron shell + React renderer + provider-specific webview adapters**.
   - The main process handles OS integration, the renderer handles the multi-pane chat UI, and the provider modules define how each external AI web app is embedded and controlled.

Main entry points: [`src/providers/provider.js`](https://github.com/smol-ai/godmode/blob/main/src/providers/provider.js) (Provider base), [`src/main/main.ts`](https://github.com/smol-ai/godmode/blob/main/src/main/main.ts) (Main process), [`src/renderer/layout.tsx`](https://github.com/smol-ai/godmode/blob/main/src/renderer/layout.tsx) (Layout), [`scripts/configs/webpack.config.base.ts`](https://github.com/smol-ai/godmode/blob/main/scripts/configs/webpack.config.base.ts) (Webpack configs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_main["Electron main"]
  node_node_main["Main process<br/>electron main<br/>[main.ts]"]
  node_node_menu["Menu<br/>[menu.ts]"]
  node_node_preload["Preload bridge<br/>IPC bridge<br/>[preload.ts]"]
  node_node_util["Main utils<br/>desktop helpers<br/>[util.ts]"]
  node_node_apify["Apify hooks<br/>integration<br/>[apify.ts]"]
end

subgraph group_group_renderer["Renderer UI"]
  node_node_app["App shell<br/>react root<br/>[App.tsx]"]
  node_node_layout["Layout<br/>[layout.tsx]"]
  node_node_titlebar["Title bar<br/>chrome ui<br/>[TitleBar.tsx]"]
  node_node_browserpane["Browser panes<br/>webview manager<br/>[browserPane.tsx]"]
  node_node_pane["Pane component<br/>pane ui<br/>[pane.tsx]"]
  node_node_sidebar["Sidebar<br/>navigation ui<br/>[sidebar.tsx]"]
  node_node_settings["Settings UI<br/>preferences<br/>[settings.tsx]"]
  node_node_promptcritic["PromptCritic<br/>prompt tool<br/>[promptCritic.tsx]"]
end

subgraph group_group_providers["Provider adapters"]
  node_node_provider_base["Provider base<br/>adapter base<br/>[provider.js]"]
  node_node_provider_openai["OpenAI<br/>provider adapter<br/>[openai.js]"]
  node_node_provider_claude["Claude<br/>provider adapter<br/>[claude.js]"]
  node_node_provider_bard["Bard<br/>provider adapter<br/>[bard.js]"]
  node_node_provider_bing["Bing<br/>provider adapter<br/>[bing.js]"]
  node_node_provider_others["Other providers<br/>provider adapters"]
end

subgraph group_group_build["Build & release"]
  node_node_scripts["Build scripts<br/>tooling<br/>[check-node-env.js]"]
  node_node_webpack["Webpack configs<br/>bundler config"]
  node_node_release["Release app<br/>packaging<br/>[package.json]"]
  node_node_assets["Assets<br/>icons & signing<br/>[icon.icns]"]
end

node_node_main -->|"uses"| node_node_menu
node_node_main -->|"injects"| node_node_preload
node_node_main -->|"shares helpers"| node_node_util
node_node_main -->|"integrates"| node_node_apify
node_node_preload -->|"exposes IPC"| node_node_app
node_node_app -->|"composes"| node_node_layout
node_node_layout -->|"includes"| node_node_titlebar
node_node_layout -->|"includes"| node_node_sidebar
node_node_layout -->|"hosts"| node_node_browserpane
node_node_browserpane -->|"renders"| node_node_pane
node_node_sidebar -->|"opens"| node_node_settings
node_node_app -->|"includes"| node_node_promptcritic
node_node_browserpane -->|"adapts"| node_node_provider_base
node_node_provider_base -->|"specializes"| node_node_provider_openai
node_node_provider_base -->|"specializes"| node_node_provider_claude
node_node_provider_base -->|"specializes"| node_node_provider_bard
node_node_provider_base -->|"specializes"| node_node_provider_bing
node_node_provider_base -->|"specializes"| node_node_provider_others
node_node_scripts -->|"drives"| node_node_webpack
node_node_webpack -->|"builds"| node_node_main
node_node_webpack -->|"builds"| node_node_preload
node_node_webpack -->|"builds"| node_node_app
node_node_release -->|"packages"| node_node_assets
node_node_release -->|"uses"| node_node_scripts

click node_node_main "https://github.com/smol-ai/godmode/blob/main/src/main/main.ts"
click node_node_menu "https://github.com/smol-ai/godmode/blob/main/src/main/menu.ts"
click node_node_preload "https://github.com/smol-ai/godmode/blob/main/src/main/preload.ts"
click node_node_util "https://github.com/smol-ai/godmode/blob/main/src/main/util.ts"
click node_node_apify "https://github.com/smol-ai/godmode/blob/main/src/main/apify.ts"
click node_node_app "https://github.com/smol-ai/godmode/blob/main/src/renderer/App.tsx"
click node_node_layout "https://github.com/smol-ai/godmode/blob/main/src/renderer/layout.tsx"
click node_node_titlebar "https://github.com/smol-ai/godmode/blob/main/src/renderer/TitleBar.tsx"
click node_node_browserpane "https://github.com/smol-ai/godmode/blob/main/src/renderer/browserPane.tsx"
click node_node_pane "https://github.com/smol-ai/godmode/blob/main/src/components/pane.tsx"
click node_node_sidebar "https://github.com/smol-ai/godmode/blob/main/src/components/sidebar.tsx"
click node_node_settings "https://github.com/smol-ai/godmode/blob/main/src/settings/settings.tsx"
click node_node_promptcritic "https://github.com/smol-ai/godmode/blob/main/src/renderer/promptCritic.tsx"
click node_node_provider_base "https://github.com/smol-ai/godmode/blob/main/src/providers/provider.js"
click node_node_provider_openai "https://github.com/smol-ai/godmode/blob/main/src/providers/openai.js"
click node_node_provider_claude "https://github.com/smol-ai/godmode/blob/main/src/providers/claude.js"
click node_node_provider_bard "https://github.com/smol-ai/godmode/blob/main/src/providers/bard.js"
click node_node_provider_bing "https://github.com/smol-ai/godmode/blob/main/src/providers/bing.js"
click node_node_scripts "https://github.com/smol-ai/godmode/blob/main/scripts/scripts/check-node-env.js"
click node_node_webpack "https://github.com/smol-ai/godmode/blob/main/scripts/configs/webpack.config.base.ts"
click node_node_release "https://github.com/smol-ai/godmode/blob/main/release/app/package.json"
click node_node_assets "https://github.com/smol-ai/godmode/blob/main/assets/icon.icns"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_menu,node_node_preload,node_node_util,node_node_apify toneBlue
class node_node_app,node_node_layout,node_node_titlebar,node_node_browserpane,node_node_pane,node_node_sidebar,node_node_settings,node_node_promptcritic toneAmber
class node_node_provider_base,node_node_provider_openai,node_node_provider_claude,node_node_provider_bard,node_node_provider_bing,node_node_provider_others toneMint
class node_node_scripts,node_node_webpack,node_node_release,node_node_assets toneRose
```

## Components

### Electron main

OS integration, app lifecycle, and IPC bridge.

- [Main process](https://github.com/smol-ai/godmode/blob/main/src/main/main.ts): electron main · Owns lifecycle, windows, menu, shortcuts, and desktop integration. · `src/main/main.ts`
- [Menu](https://github.com/smol-ai/godmode/blob/main/src/main/menu.ts): desktop menu · Builds native application menus and related actions. · `src/main/menu.ts`
- [Preload bridge](https://github.com/smol-ai/godmode/blob/main/src/main/preload.ts): IPC bridge · Safely exposes desktop capabilities to the renderer. · `src/main/preload.ts`
- [Main utils](https://github.com/smol-ai/godmode/blob/main/src/main/util.ts): desktop helpers · Shared main-process helpers used across OS-facing code. · `src/main/util.ts`
- [Apify hooks](https://github.com/smol-ai/godmode/blob/main/src/main/apify.ts): integration · Auxiliary integration used by the main process. · `src/main/apify.ts`

### Renderer UI

React interface for the multi-pane browser workflow.

- [App shell](https://github.com/smol-ai/godmode/blob/main/src/renderer/App.tsx): react root · Top-level renderer entry and application composition. · `src/renderer/App.tsx`
- [Layout](https://github.com/smol-ai/godmode/blob/main/src/renderer/layout.tsx): ui layout · Coordinates the overall pane/sidebar arrangement. · `src/renderer/layout.tsx`
- [Title bar](https://github.com/smol-ai/godmode/blob/main/src/renderer/TitleBar.tsx): chrome ui · Native-feeling window chrome and top controls. · `src/renderer/TitleBar.tsx`
- [Browser panes](https://github.com/smol-ai/godmode/blob/main/src/renderer/browserPane.tsx): webview manager · Hosts the embedded provider panes and shared prompt distribution. · `src/renderer/browserPane.tsx`
- [Pane component](https://github.com/smol-ai/godmode/blob/main/src/components/pane.tsx): pane ui · Individual pane container and its local interactions. · `src/components/pane.tsx`
- [Sidebar](https://github.com/smol-ai/godmode/blob/main/src/components/sidebar.tsx): navigation ui · Provider selection, pane controls, and app navigation. · `src/components/sidebar.tsx`
- [Settings UI](https://github.com/smol-ai/godmode/blob/main/src/settings/settings.tsx): preferences · Settings experience for hotkeys, startup, theme, and providers. · `src/settings/settings.tsx`
- [PromptCritic](https://github.com/smol-ai/godmode/blob/main/src/renderer/promptCritic.tsx): prompt tool · Renderer-side prompt improvement feature layered into the app. · `src/renderer/promptCritic.tsx`

### Provider adapters

Provider-specific web app control and embed behavior.

- [Provider base](https://github.com/smol-ai/godmode/blob/main/src/providers/provider.js): adapter base · Common provider abstraction shared by the service-specific adapters. · `src/providers/provider.js`
- [OpenAI](https://github.com/smol-ai/godmode/blob/main/src/providers/openai.js): provider adapter · Provider-specific control for ChatGPT/OpenAI web flows. · `src/providers/openai.js`
- [Claude](https://github.com/smol-ai/godmode/blob/main/src/providers/claude.js): provider adapter · Provider-specific control for Claude web flows. · `src/providers/claude.js`
- [Bard](https://github.com/smol-ai/godmode/blob/main/src/providers/bard.js): provider adapter · Provider-specific control for Google Bard flows. · `src/providers/bard.js`
- [Bing](https://github.com/smol-ai/godmode/blob/main/src/providers/bing.js): provider adapter · Provider-specific control for Bing chat flows. · `src/providers/bing.js`
- **Other providers**: provider adapters · Remaining provider integrations such as Perplexity, Poe, HuggingChat, OpenRouter, Vercel, and local models.

### Build & release

Webpack, scripts, packaging, and release tooling.

- [Build scripts](https://github.com/smol-ai/godmode/blob/main/scripts/scripts/check-node-env.js): tooling · Repo scripts for environment checks, packaging, rebuilds, and release prep. · `scripts/scripts/check-node-env.js`
- [Webpack configs](https://github.com/smol-ai/godmode/blob/main/scripts/configs/webpack.config.base.ts): bundler config · Separate build pipelines for main, preload, and renderer targets. · `scripts/configs/webpack.config.base.ts`
- [Release app](https://github.com/smol-ai/godmode/blob/main/release/app/package.json): packaging · Isolated release packaging configuration and metadata. · `release/app/package.json`
- [Assets](https://github.com/smol-ai/godmode/blob/main/assets/icon.icns): icons & signing · App icons, entitlements, and platform packaging resources. · `assets/icon.icns`

## Connections

- Main process → Menu: uses · Main process builds and reacts to native menu actions.
- Main process → Preload bridge: injects · Main process loads the preload bridge into renderer windows.
- Main process → Main utils: shares helpers · Main lifecycle and window logic use common desktop helpers.
- Main process → Apify hooks: integrates · Main process includes auxiliary external integration.
- Preload bridge → App shell: exposes IPC · Preload exposes desktop capabilities to the React UI.
- App shell → Layout: composes · App shell assembles the main layout.
- Layout → Title bar: includes · Layout places the window chrome.
- Layout → Sidebar: includes · Layout places navigation and pane controls.
- Layout → Browser panes: hosts · Layout centers the multi-pane browser surface.
- Browser panes → Pane component: renders · Browser surface is made of individual panes.
- Sidebar → Settings UI: opens · Sidebar provides access to preferences and configuration.
- App shell → PromptCritic: includes · PromptCritic is part of the renderer feature set.
- Browser panes → Provider base: adapts · Pane orchestration is driven by provider abstraction.
- Provider base → OpenAI: specializes · OpenAI is one of the provider-specific adapters.
- Provider base → Claude: specializes · Claude is one of the provider-specific adapters.
- Provider base → Bard: specializes · Bard is one of the provider-specific adapters.
- Provider base → Bing: specializes · Bing is one of the provider-specific adapters.
- Provider base → Other providers: specializes · Additional providers follow the same adapter pattern.
- Build scripts → Webpack configs: drives · Scripts orchestrate the separate Electron build pipelines.
- Webpack configs → Main process: builds · Bundler config targets the main process.
- Webpack configs → Preload bridge: builds · Bundler config targets the preload bridge.
- Webpack configs → App shell: builds · Bundler config targets the renderer app.
- Release app → Assets: packages · Release packaging bundles platform assets and signing resources.
- Release app → Build scripts: uses · Release packaging is supported by repo scripts.
