# hotovo/aider-desk architecture

> Architecture diagram of the GitHub repository hotovo/aider-desk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hotovo/aider-desk
- Repository: https://github.com/hotovo/aider-desk

## Overview

##### Project type and purpose
- AiderDesk is an Electron-based desktop application with a React/TypeScript frontend (the “renderer”), a Node.js/Electron backend (the “main” process), and auxiliary Python components.
- It wraps the Aider CLI and a Vercel AI-SDK agent in a GUI, manages multiple projects, sessions, context files, and exposes both a REST API and an MCP server for integration with external IDE plugins and tools.

##### File structure
- Top-level build & config: electron-builder.yml, tsconfig.*.json, postcss.config.js, tailwind.config.js, etc.
- src/renderer: React UI (App.tsx, components/, pages/, styles)
- src/preload: secure IPC bindings between renderer and main
- src/main: Electron main process
– startup (start-up.ts), auto-updater, IPC handlers, REST API controller, project/session/file-system managers, connector manager, logger, local store (store.ts + migrations)
– agent subfolder: agent orchestration via Vercel AI SDK, tool plugins, MCP client integration
– web-scrapper, utilities
- src/mcp-server: built-in MCP server entrypoint
- resources/connector: Python script used by IDE connector plugins (IntelliJ, VSCode)
- shared code: src/common (types, utils, locales)
- package.json & lock: dependency definitions
- docs/images, CHANGELOG.md, CONVENTIONS.md: documentation

##### README for additional insights
- Confirms the multi-project, session, context management, LLM provider abstraction, REST API endpoints on port 24337, built-in MCP server capabilities, and Python connector for IDE integration.
- Shows features: autonomous agent mode, tool-driven architecture via MCP, integrated diff viewer, cost tracking, etc.

a. Main components
– User Interface (Electron renderer / React)
– Preload layer (IPC bridge)
– Electron Main Process
- Startup & auto-update
- IPC handlers
- REST API Controller
- Project Manager & Session Manager
- File System Manager & Context Files Service
- Local Store (persistent sessions & settings)
- Agent Engine (Vercel AI SDK) with Tool Manager (MCP client)
- Connector Manager (launch Python connector for IDE plugins)
– Built-in MCP Server (src/mcp-server)
– Python Connector (resources/connector/connector.py)
– External LLM Providers (OpenAI, Anthropic, Gemini, Bedrock, etc.)
– External MCP Servers & Tools (web scrapper, doc lookup)
b. Relationships & data flows
– UI ↔ Preload ↔ Main via IPC
– Main ↔ Local Store (read/write sessions, settings)
– Main ↔ File System (project files, context files)
– Main ↔ Agent Engine → LLM Providers & MCP Tools
– Main ↔ REST API clients (external scripts or services)
– External IDE Plugins ↔ Python Connector ↔ Main’s REST API
– External MCP Clients ↔ Built-in MCP Server ↔ Main’s API
c. Architectural patterns & design principles
– Layered architecture: UI → IPC → Controllers & Services → Persistence
– Modular “agent” subsystem supporting multiple LLM providers via abstraction
– Extensibility via MCP: decoupling tool definitions from core logic
– Secure boundary between untrusted UI code and privileged main process via preload
– Local data migrations ensure backward compatibility in store
d. Key technologies & libraries
– Electron (main + renderer processes)
– React + TypeScript + Tailwind CSS (renderer)
– Vercel AI SDK for agent implementation
– Node.js for main, REST API, MCP server
– Python 3.9+ for IDE connector
– SQLite or file-based JSON store (via main/store)
– Model Context Protocol (MCP) for tool integration

##### Essential details without over-fragmenting
- Do not split every single .ts file—group by logical subsystems (UI, IPC, controllers, services, store, agent).
- Major feature (session management, context files, agent/mcp integration, REST API, connector) appears as a distinct node.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Renderer Layer
    subgraph "Renderer Layer"
        Renderer["Renderer (React UI)"]:::ui
    end

    %% Preload Layer
    subgraph "Preload Layer"
        Preload["Preload (IPC Bridge)"]:::ui
    end

    %% Main Process
    subgraph "Main Process"
        Entry["Main Entrypoint (src/main/index.ts)"]:::core
        Startup["Startup & Auto-Updater"]:::core
        IPC["IPC Handlers"]:::core
        API["REST API Controller"]:::core
        PM["Project Manager"]:::core
        SM["Session Manager"]:::core
        FSM["File System Manager & Context Service"]:::core
        CM["Connector Manager"]:::core
        WS["Web Scrapper"]:::core
        LOG["Logger"]:::core
        CONST["Constants"]:::core
        UTIL["General Utilities"]:::core

        subgraph "Agent Engine"
            AgentCore["Agent Engine"]:::core
            LLP["LLM Provider Abstraction"]:::core
            MCPClient["MCP Client (Tool Manager)"]:::core
            Prompts["Agent Prompts"]:::core
            Tools["Agent Tools"]:::core
        end
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        Store["Local Store"]:::persistence
        Migs["Migrations"]:::persistence
    end

    %% Built-in MCP Server
    subgraph "Built-in MCP Server"
        MCPServ["MCP Server"]:::core
    end

    %% External Components
    subgraph "External Services"
        LLMs["LLM Providers"]:::external
        MCPClients["External MCP Clients"]:::external
        IDEPlugins["External IDE Plugins"]:::external
        PyConnector["Python Connector"]:::external
    end

    %% Connections
    Renderer -->|IPC Calls| Preload
    Preload -->|Secure IPC| Entry
    Entry --> Startup
    Startup --> IPC
    IPC --> API
    IPC --> PM
    IPC --> SM
    IPC --> FSM
    IPC --> CM
    IPC --> AgentCore
    API -->|Read/Write| Store
    API -->|File Ops| FSM
    PM --> Store
    SM --> Store
    FSM -->|Filesystem| Store
    AgentCore --> LLP
    AgentCore --> MCPClient
    AgentCore --> Prompts
    AgentCore --> Tools
    LLP --> LLMs
    MCPClient -->|Tool Protocol| MCPClients
    CM --> PyConnector
    MCPServ --> API
    IDEPlugins --> PyConnector
    IDEPlugins -->|REST Calls| API
    MCPClients -->|MCP Protocol| MCPServ
    WS -->|External Data| API

    %% Click Events
    click Renderer "https://github.com/hotovo/aider-desk/tree/main/src/renderer/src"
    click Preload "https://github.com/hotovo/aider-desk/blob/main/src/preload/index.ts"
    click Entry "https://github.com/hotovo/aider-desk/blob/main/src/main/index.ts"
    click Startup "https://github.com/hotovo/aider-desk/blob/main/src/main/start-up.ts"
    click Startup "https://github.com/hotovo/aider-desk/blob/main/src/main/auto-updater.ts"
    click IPC "https://github.com/hotovo/aider-desk/blob/main/src/main/ipc-handlers.ts"
    click API "https://github.com/hotovo/aider-desk/blob/main/src/main/rest-api-controller.ts"
    click PM "https://github.com/hotovo/aider-desk/blob/main/src/main/project-manager.ts"
    click SM "https://github.com/hotovo/aider-desk/blob/main/src/main/session-manager.ts"
    click FSM "https://github.com/hotovo/aider-desk/blob/main/src/main/file-system.ts"
    click Store "https://github.com/hotovo/aider-desk/blob/main/src/main/store/store.ts"
    click Migs "https://github.com/hotovo/aider-desk/tree/main/src/main/store/migrations"
    click AgentCore "https://github.com/hotovo/aider-desk/blob/main/src/main/agent/index.ts"
    click LLP "https://github.com/hotovo/aider-desk/blob/main/src/main/agent/llm-provider.ts"
    click MCPClient "https://github.com/hotovo/aider-desk/blob/main/src/main/agent/mcp-client.ts"
    click Prompts "https://github.com/hotovo/aider-desk/blob/main/src/main/agent/prompts.ts"
    click Tools "https://github.com/hotovo/aider-desk/tree/main/src/main/agent/tools"
    click CM "https://github.com/hotovo/aider-desk/blob/main/src/main/connector-manager.ts"
    click MCPServ "https://github.com/hotovo/aider-desk/blob/main/src/mcp-server/aider-desk-mcp-server.ts"
    click PyConnector "https://github.com/hotovo/aider-desk/blob/main/resources/connector/connector.py"

    %% Styles
    classDef ui fill:#CFE2FF,stroke:#000
    classDef core fill:#D1E7DD,stroke:#000
    classDef persistence fill:#F2F2F2,stroke:#000
    classDef external fill:#FFE7BA,stroke:#000
```
