# cdmtn-dev/codemotion-ide architecture

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

- Interactive diagram: https://gitdiagram.com/cdmtn-dev/codemotion-ide
- Repository: https://github.com/cdmtn-dev/codemotion-ide

## Overview

CodeMotion IDE is an Electron desktop application, not a browser app. The architecture is split into a TypeScript-backed main process, a JavaScript renderer layer, and several auxiliary windows and sandboxes.

1. **Process boundaries**
   - `app/main/main.ts` is the main-process entry point.
   - `app/main/preload.ts` acts as the controlled bridge into renderer code.
   - The renderer layer is mostly plain JavaScript in `assets/js` plus window-specific entry files like `app/renderer.js`, `app/notifications/renderer.js`, and `app/splash/splash.js`.

2. **Window model**
   - The app is multi-window: main IDE, splash screen, login/register/recovery screens, notifications, and a debugger window.
   - HTML templates live in `html/`, while corresponding CSS/JS is split across `assets/css` and `assets/js`.
   - `app/splash`, `app/notifications`, and `helpers/debuggerWindow` are separate UI surfaces with their own scripts and preload layers.

3. **Editor core**
   - Ace Editor is vendored under `ace/` and is the central editing subsystem.
   - The repo includes many Ace modes, themes, snippets, workers, and extensions, which means syntax highlighting, autocomplete, lint-like background processing, and theming are treated as first-class editor capabilities.
   - Custom Ace integration lives in `app/main/helpers/ace` and `helpers/aceLanguageRegister`.

4. **Language intelligence**
   - The project extends editor behavior through custom language registration and syntax enhancements in `ace/plugins` and `helpers/aceLanguageRegister`.
   - JavaScript and TypeScript diagnostics are handled separately under `app/main/tools/javascript` and `app/main/tools/typescript`, each with AST and worker files.
   - Renderer-side context parsers in `assets/js/contextParsers` support language-aware UI features like menus, symbol handling, and contextual actions.

5. **Main-process service layer**
   - `app/main/ipc/` is the central command surface exposed to renderer windows.
   - The IPC modules are grouped by concern: API, bugs, file work, getters, organizations, setters, and updaters.
   - This is the main boundary where renderer requests become privileged operations such as filesystem access, state updates, or backend calls.

6. **System and OS integration**
   - `app/main/helpers/` contains OS, path, request, terminal, and Ace-related helpers.
   - This layer is where the IDE crosses from UI into platform capabilities: file paths, terminal spawning, external requests, and OS-specific behavior.
   - `app/auth.js` and `app/main/helpers/requests.js` suggest authentication and service communication are handled centrally rather than in the renderer.

7. **Sandbox and permissions**
   - `app/sandbox/` is a capability-based boundary for extension or user-supplied code.
   - Individual permission modules gate actions like timers, window control, CSS loading, notifications, command registration, editor event hooks, language registration, and requests.
   - This is the repo’s clearest security boundary: untrusted or semi-trusted code does not get full app access.

8. **Extensions and plugin surface**
   - `extension_modules/` contains published extension packages, showing the IDE is designed to load third-party or modular features.
   - The renderer-side extension handlers in `assets/js/extensionsHandler` coordinate extension events and lifecycle.
   - The sandbox permission files indicate extensions are expected to be constrained rather than run with unrestricted Node access.

9. **Runtime execution**
   - A bundled Python runtime exists under `app/main/runtime/python`, including executable binaries and supporting files.
   - `app/main/runtime/runtimeHandler.ts` and `assets/js/terminalRenderer/PyRuntimeHandler.js` are the main integration points for running Python-related tasks.
   - This means the app is not only an editor; it can execute or analyze code locally, especially Python.

10. **User and collaboration features**
   - Authentication flows are implemented in `assets/js/auth` and corresponding HTML pages in `html/`.
   - Organization and bug-reporting UI lives under `assets/js/userHandlers` and `assets/js/coopHandlers`, indicating collaboration-oriented product features.
   - The data flow here is: UI form in renderer → IPC or request helper → service/backend interaction → UI state update.

11. **Renderer UI composition**
   - The renderer is organized into feature handlers rather than large monoliths: explorer tree, tabs, context menus, bottom panels, terminal, themes, modals, top-window lists, and settings.
   - Shared UI primitives are in `assets/js/libClasses` and `assets/js/modalsHandler/components`.
   - `assets/js/global.js`, `assets/js/bus.js`, and `helpers/eventBus.js` indicate a shared event-driven pattern across UI modules.

12. **Static assets and theming**
   - Visual structure is centralized in `assets/css` with many component-specific styles and theme variants.
   - Fonts, icons, markers, and splash media are in `assets/media`.
   - Ace themes are duplicated both as static CSS and as runtime modules, showing theme switching is an explicit runtime feature.

13. **Localization**
   - `languages/en.json`, `languages/ru.json`, and `languages/uk.json` show the app has built-in internationalization rather than hardcoded English-only UI.
   - Language strings are likely consumed by shared renderer utilities and modal/UI components.

14. **Overall data flow**
   - The typical path is: HTML entrypoint loads renderer JS → renderer updates UI and editor state → privileged actions go through preload/IPCs → main process performs file/system/runtime work → results return to renderer for display.
   - The editor also feeds language parsers, diagnostics workers, and context menus locally, while execution and OS-level actions remain behind main-process or sandbox boundaries.

In short, the architecture is a desktop IDE built around Electron, Ace Editor, IPC-based privileged services, a restricted extension sandbox, and bundled runtime/analysis tooling for code-centric workflows.

Main entry points: [`app/main/main.ts`](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/main.ts) (Main entry), [`app/renderer.js`](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/renderer.js) (Renderer entry), [`app/main/preload.ts`](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/preload.ts) (Preload bridge), [`app/main/tools/diagnostics.ts`](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/tools/diagnostics.ts) (Diagnostics core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_main_process["Main Process"]
  node_main_entry["Main entry<br/>electron main<br/>[main.ts]"]
  node_preload_bridge["Preload bridge<br/>ipc bridge<br/>[preload.ts]"]
  node_ipc_surface["IPC surface<br/>command api"]
  node_system_helpers["System helpers<br/>os/files/net"]
  node_runtime_handler["Runtime handler<br/>exec runtime<br/>[runtimeHandler.ts]"]
  node_diagnostics_core["Diagnostics core<br/>analysis engine<br/>[diagnostics.ts]"]
  node_js_tools["JS tools<br/>javascript analysis"]
  node_ts_tools["TS tools<br/>typescript analysis"]
end

subgraph group_renderer_ui["Renderer UI"]
  node_renderer_entry["Renderer entry<br/>window shell<br/>[renderer.js]"]
  node_auth_windows["Auth screens<br/>auth ui"]
  node_ui_handlers["UI handlers<br/>ui composition"]
  node_explorer_layer["Explorer layer<br/>file tree ui"]
  node_modal_system["Modal system<br/>component engine"]
  node_global_bus["Shared bus<br/>event bus<br/>[bus.js]"]
end

subgraph group_editor_core["Editor Core"]
  node_ace_core["Ace core<br/>editor vendor<br/>[ace.js]"]
  node_ace_plugins["Ace plugins<br/>editor extension"]
  node_language_register["Language register<br/>ace integration"]
  node_context_parsers["Context parsers<br/>language ui"]
end

subgraph group_sandbox_runtime["Sandbox & Runtime"]
  node_sandbox_core["Sandbox core<br/>capability boundary<br/>[sandbox.js]"]
  node_permissions["Permissions<br/>capability gates"]
  node_extension_modules["Extensions<br/>packages"]
  node_python_runtime[("Python runtime<br/>bundled runtime")]
end

subgraph group_surfaces["Auxiliary Surfaces"]
  node_notifications_window["Notifications<br/>aux window<br/>[renderer.js]"]
  node_splash_window["Splash screen<br/>aux window<br/>[splash.js]"]
  node_debugger_window["Debugger window<br/>aux window<br/>[index.js]"]
end

node_main_entry -->|"loads"| node_preload_bridge
node_main_entry -->|"registers"| node_ipc_surface
node_main_entry -->|"uses"| node_system_helpers
node_main_entry -->|"starts"| node_runtime_handler
node_main_entry -->|"coordinates"| node_diagnostics_core
node_diagnostics_core -->|"includes"| node_js_tools
node_diagnostics_core -->|"includes"| node_ts_tools
node_renderer_entry -->|"subscribes"| node_global_bus
node_renderer_entry -->|"composes"| node_ui_handlers
node_renderer_entry -->|"renders"| node_explorer_layer
node_renderer_entry -->|"uses"| node_modal_system
node_auth_windows -->|"bridged by"| node_preload_bridge
node_auth_windows -->|"requests"| node_ipc_surface
node_ui_handlers -->|"uses"| node_context_parsers
node_ui_handlers -->|"embeds"| node_ace_core
node_ace_core -->|"extends"| node_ace_plugins
node_ace_plugins -->|"supports"| node_language_register
node_language_register -->|"feeds"| node_context_parsers
node_sandbox_core -->|"enforces"| node_permissions
node_sandbox_core -->|"loads"| node_extension_modules
node_permissions -->|"guards"| node_preload_bridge
node_runtime_handler -->|"executes"| node_python_runtime
node_notifications_window -->|"bridged by"| node_preload_bridge
node_splash_window -->|"loads"| node_renderer_entry
node_debugger_window -->|"bridged by"| node_preload_bridge

click node_main_entry "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/main.ts"
click node_preload_bridge "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/preload.ts"
click node_ipc_surface "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/ipc"
click node_system_helpers "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/helpers"
click node_runtime_handler "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/runtime/runtimeHandler.ts"
click node_diagnostics_core "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/tools/diagnostics.ts"
click node_js_tools "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/tools/javascript"
click node_ts_tools "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/tools/typescript"
click node_renderer_entry "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/renderer.js"
click node_auth_windows "https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/auth"
click node_ui_handlers "https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/handlers"
click node_explorer_layer "https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/explorerTree"
click node_modal_system "https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/modalsHandler"
click node_global_bus "https://github.com/cdmtn-dev/codemotion-ide/blob/main/assets/js/bus.js"
click node_ace_core "https://github.com/cdmtn-dev/codemotion-ide/blob/main/ace/src-noconflict/ace.js"
click node_ace_plugins "https://github.com/cdmtn-dev/codemotion-ide/tree/main/ace/plugins"
click node_language_register "https://github.com/cdmtn-dev/codemotion-ide/tree/main/helpers/aceLanguageRegister"
click node_context_parsers "https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/contextParsers"
click node_sandbox_core "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/sandbox/sandbox.js"
click node_permissions "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/sandbox/permissions"
click node_extension_modules "https://github.com/cdmtn-dev/codemotion-ide/tree/main/extension_modules"
click node_python_runtime "https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/runtime/python"
click node_notifications_window "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/notifications/renderer.js"
click node_splash_window "https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/splash/splash.js"
click node_debugger_window "https://github.com/cdmtn-dev/codemotion-ide/blob/main/helpers/debuggerWindow/index.js"

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_main_entry,node_preload_bridge,node_ipc_surface,node_system_helpers,node_runtime_handler,node_diagnostics_core,node_js_tools,node_ts_tools toneBlue
class node_renderer_entry,node_auth_windows,node_ui_handlers,node_explorer_layer,node_modal_system,node_global_bus toneAmber
class node_ace_core,node_ace_plugins,node_language_register,node_context_parsers toneMint
class node_sandbox_core,node_permissions,node_extension_modules,node_python_runtime toneRose
class node_notifications_window,node_splash_window,node_debugger_window toneIndigo
```

## Components

### Main Process

Electron main-process entry points, IPC surface, and privileged services.

- [Main entry](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/main.ts): electron main · Bootstraps the desktop app and coordinates process startup. · `app/main/main.ts`
- [Preload bridge](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/preload.ts): ipc bridge · Controlled bridge between renderer windows and privileged main-process APIs. · `app/main/preload.ts`
- [IPC surface](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/ipc): command api · Main-process command handlers grouped by concern for renderer requests. · `app/main/ipc`
- [System helpers](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/helpers): os/files/net · OS, paths, requests, terminal, and other platform-facing helpers. · `app/main/helpers`
- [Runtime handler](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/runtime/runtimeHandler.ts): exec runtime · Coordinates bundled runtime execution and task lifecycle. · `app/main/runtime/runtimeHandler.ts`
- [Diagnostics core](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/main/tools/diagnostics.ts): analysis engine · Shared entry for language diagnostics and editor-side analysis flows. · `app/main/tools/diagnostics.ts`
- [JS tools](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/tools/javascript): javascript analysis · JavaScript AST and diagnostics worker integration. · `app/main/tools/javascript`
- [TS tools](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/tools/typescript): typescript analysis · TypeScript AST and diagnostics worker integration. · `app/main/tools/typescript`

### Renderer UI

Window entrypoints and shared renderer-side UI composition.

- [Renderer entry](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/renderer.js): window shell · Primary renderer bootstrap for the main IDE window. · `app/renderer.js`
- [Auth screens](https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/auth): auth ui · Login, register, and recovery flows for account access. · `assets/js/auth`
- [UI handlers](https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/handlers): ui composition · Shared renderer handlers for tabs, panels, themes, context menus, and terminal UI. · `assets/js/handlers`
- [Explorer layer](https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/explorerTree): file tree ui · File explorer, folder open flow, and tab interaction for project navigation. · `assets/js/explorerTree`
- [Modal system](https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/modalsHandler): component engine · Reusable modal engine and component primitives for dialogs and settings. · `assets/js/modalsHandler`
- [Shared bus](https://github.com/cdmtn-dev/codemotion-ide/blob/main/assets/js/bus.js): event bus · Application-wide event coordination across renderer modules. · `assets/js/bus.js`

### Editor Core

Vendored Ace editor plus custom language and context integration.

- [Ace core](https://github.com/cdmtn-dev/codemotion-ide/blob/main/ace/src-noconflict/ace.js): editor vendor · Vendored Ace editor, modes, themes, snippets, workers, and extensions. · `ace/src-noconflict/ace.js`
- [Ace plugins](https://github.com/cdmtn-dev/codemotion-ide/tree/main/ace/plugins): editor extension · Custom Ace extensions for language tools and syntax enhancement. · `ace/plugins`
- [Language register](https://github.com/cdmtn-dev/codemotion-ide/tree/main/helpers/aceLanguageRegister): ace integration · Custom Ace language registration, autocomplete, highlighting, and bracket support. · `helpers/aceLanguageRegister`
- [Context parsers](https://github.com/cdmtn-dev/codemotion-ide/tree/main/assets/js/contextParsers): language ui · Renderer-side parsers that drive language-aware menus and symbol actions. · `assets/js/contextParsers`

### Sandbox & Runtime

Restricted extension capability layer and bundled execution/runtime tooling.

- [Sandbox core](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/sandbox/sandbox.js): capability boundary · Capability-based boundary for untrusted or semi-trusted extension code. · `app/sandbox/sandbox.js`
- [Permissions](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/sandbox/permissions): capability gates · Fine-grained permission modules for timers, window control, requests, editor hooks, and registrations. · `app/sandbox/permissions`
- [Extensions](https://github.com/cdmtn-dev/codemotion-ide/tree/main/extension_modules): packages · Published extension packages loaded through the IDE extension surface. · `extension_modules`
- [Python runtime](https://github.com/cdmtn-dev/codemotion-ide/tree/main/app/main/runtime/python): bundled runtime · Embedded Python runtime binaries and support files. · `app/main/runtime/python`

### Auxiliary Surfaces

Special-purpose windows and supporting UI surfaces.

- [Notifications](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/notifications/renderer.js): aux window · Dedicated notifications window with its own preload and renderer entry. · `app/notifications/renderer.js`
- [Splash screen](https://github.com/cdmtn-dev/codemotion-ide/blob/main/app/splash/splash.js): aux window · Startup splash window and renderer. · `app/splash/splash.js`
- [Debugger window](https://github.com/cdmtn-dev/codemotion-ide/blob/main/helpers/debuggerWindow/index.js): aux window · Separate debugger surface with HTML, CSS, JS, and preload support. · `helpers/debuggerWindow/index.js`

## Connections

- Main entry → Preload bridge: loads · Main process exposes a controlled bridge for renderer windows.
- Main entry → IPC surface: registers · Bootstraps the central IPC command surface.
- Main entry → System helpers: uses · Relies on OS, path, request, and terminal helpers.
- Main entry → Runtime handler: starts · Coordinates bundled runtime execution from the main process.
- Main entry → Diagnostics core: coordinates · Connects analysis services used by the editor.
- Diagnostics core → JS tools: includes · JavaScript diagnostics are handled by a dedicated toolchain.
- Diagnostics core → TS tools: includes · TypeScript diagnostics are handled by a dedicated toolchain.
- Renderer entry → Shared bus: subscribes · Renderer UI is coordinated through shared events.
- Renderer entry → UI handlers: composes · Primary window is assembled from feature handlers.
- Renderer entry → Explorer layer: renders · Main renderer includes project/file navigation.
- Renderer entry → Modal system: uses · Dialogs and settings are built with shared modal primitives.
- Auth screens → Preload bridge: bridged by · Authentication flows use the controlled preload boundary.
- Auth screens → IPC surface: requests · Auth flows likely invoke privileged operations through IPC.
- UI handlers → Context parsers: uses · UI features depend on language-aware context parsing.
- UI handlers → Ace core: embeds · The renderer’s editor UI is built on Ace.
- Ace core → Ace plugins: extends · Ace is augmented with custom language and editor plugins.
- Ace plugins → Language register: supports · Custom Ace integration registers languages and completion behavior.
- Language register → Context parsers: feeds · Language metadata informs contextual UI behavior.
- Sandbox core → Permissions: enforces · Sandboxed code is constrained by per-capability permissions.
- Sandbox core → Extensions: loads · Extension packages run through the sandbox boundary.
- Permissions → Preload bridge: guards · Privileged operations are gated before reaching renderer code.
- Runtime handler → Python runtime: executes · Embedded Python runtime is managed as a local execution target.
- Notifications → Preload bridge: bridged by · Notifications use a dedicated preload-controlled surface.
- Splash screen → Renderer entry: loads · Splash window is a separate renderer entrypoint.
- Debugger window → Preload bridge: bridged by · Debugger surface uses its own preload and main-process coordination.
