# sidenai/sidex architecture

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

- Interactive diagram: https://gitdiagram.com/sidenai/sidex
- Repository: https://github.com/sidenai/sidex

## Overview

1. **Top-level shape**
SideX is a desktop IDE built as a **Tauri 2 shell around a TypeScript port of VS Code’s workbench**. The UI runs inside the OS-native webview, while the privileged work lives in the Rust backend. The repo is a monorepo with two main halves: `src/` for the frontend workbench and `src-tauri/` plus supporting Rust crates for backend services.

2. **Process / boundary model**
The key architectural boundary is between:
- the **renderer/webview**: Monaco editor, workbench shell, panels, menus, and contributions
- the **Rust backend**: file I/O, terminal PTY, search, Git, storage, watching, process management
Communication is Tauri-style `invoke()`/events rather than Electron IPC. The README explicitly maps VS Code’s Electron main process to the Tauri backend.

3. **Workbench frontend**
`src/vs/` is largely VS Code’s workbench code, organized into `base`, `platform`, `editor`, and `workbench`. This layer owns the IDE shell, editor panes, sidebar/panel layout, commands, keybindings, notifications, settings UI, and contribution registration. SideX-specific integration is concentrated in `src/vs/platform/sidex/` and `src/vs/workbench/api/tauri/`.

4. **Frontend service architecture**
The frontend uses VS Code’s service/DI model heavily. `src/vs/platform/*` provides reusable services for configuration, commands, menus, keybindings, storage, theme, URI handling, webviews, workspace, etc. The `sidex` platform services adapt these abstractions to Tauri-backed implementations, so higher-level workbench code can stay close to upstream VS Code patterns.

5. **Backend command surface**
`src-tauri/src/commands/` is the Rust command API exposed to the frontend. This is the main backend integration layer and contains modules for `fs`, `git`, `terminal`, `search`, `settings`, `watch`, `window`, `process`, `lsp`, `tasks`, `syntax`, `theme`, `debug`, `extensions`, and more. `src-tauri/src/lib.rs` wires these commands into Tauri; `main.rs` is the entrypoint.

6. **Filesystem, workspace, and persistence**
File access is split between frontend workspace logic and backend providers. The workspace UI and file explorer live in `src/vs/workbench/contrib/files` and `src/vs/workbench/services/workspaces`, while Tauri-backed file system providers are in `src/vs/platform/files/browser/`. Persistent state is handled by the Rust-side data crates, especially `sidex-db` for SQLite-backed storage and state/history/recent-window tracking, plus settings/profile services in `sidex-settings` and `sidex-profiles`.

7. **Editor, text model, and language intelligence**
The editing stack centers on **Monaco Editor** with VS Code’s text model and view model layers. Syntax highlighting and language metadata are provided by `sidex-syntax`, `sidex-textmate`, and `sidex-theme`, which cover TextMate grammars, theme resolution, bracket/folding/highlight logic, and token colorization. The repo also includes `src-wasm/*` helpers and `public/onig.wasm`, indicating WASM-backed text/syntax utilities in the rendering path.

8. **Terminal subsystem**
The terminal is a two-part pipeline: the frontend uses xterm.js-based UI in `src/vs/workbench/contrib/terminal`, while the backend owns the real PTY and shell process lifecycle. The Rust crate `sidex-terminal` contains PTY, shell integration, ANSI parsing, selection, renderer support, and link detection. Shell integration scripts are shipped under `src-tauri/shell-integration` and `src/vs/workbench/contrib/terminal/common/scripts`.

9. **Git and source control**
Git integration is backend-backed via `sidex-git`, which provides repo discovery and operations such as status, diff, log, blame, branch, stash, push/pull/fetch, and reset. The workbench SCM UI in `src/vs/workbench/contrib/scm` consumes that service to render repository state, diffs, history, and file decorations.

10. **Extensions and extension host**
Extensions are a major subsystem with several layers:
- `sidex-extension-api` defines the host-facing API and WIT world
- `sidex-extensions` handles manifests, registry, marketplace/install flow, activation, VSIX parsing, tree views, webviews, and contribution routing
- `src-tauri/extension-host/` contains the sidecar Node-compatible host bootstrap and polyfills
- `src/vs/workbench/api/*` and `src/vs/workbench/services/extensions/*` implement the VS Code extension host/workbench protocol
Extension installation targets **Open VSX**, and `infrastructure/marketplace-proxy` is a Cloudflare Worker that adapts marketplace/gallery requests.

11. **LSP, debug, tasks, and testing**
Language services are split into dedicated crates and workbench consumers. `sidex-lsp` implements protocol/client logic for completion, hover, rename, code actions, diagnostics, document sync, folding, formatting, and navigation. `sidex-dap` handles debug adapter protocol transport/session/client state. `sidex-tasks` supports task providers and problem matchers. On the workbench side, the corresponding editors, panels, and contribution points live under `src/vs/workbench/contrib/{debug,tasks,testing,search}`.

12. **Remote and environment integration**
`sidex-remote` covers remote workspace modes such as SSH, containers, tunnels, Codespaces, WSL, and port forwarding. This is a separate boundary because it mediates how the IDE reaches files/processes outside the local machine. Related services in the workbench (`src/vs/workbench/services/remote`, `src/vs/platform/remote`, and `src/vs/platform/tunnel`) abstract those connection types.

13. **Build, tooling, and deployment**
The frontend is built with **Vite + TypeScript**, while the backend is **Rust/Tauri**. GitHub Actions cover build, test, lint, format, audit, and release. `src-tauri` has multiple Tauri configs and capability manifests, and `.devcontainer` supports reproducible development. There are also small WASM crates (`hash`, `scroll`, `tfidf`) used by browser-side performance-critical helpers.

14. **Useful diagram boundaries**
If you draw the architecture, the most important boxes are:
- **Webview UI / VS Code workbench**
- **Tauri Rust backend**
- **Extension host sidecar**
- **Remote/environment adapters**
- **External services**: filesystem/OS, terminal shell, Git, Open VSX, remote providers
The main arrows are UI actions and model updates flowing from the workbench to backend commands, with backend events/results flowing back into the workbench services and UI state.

Main entry points: [`src-tauri/src/commands`](https://github.com/sidenai/sidex/tree/main/src-tauri/src/commands) (Command API), [`src/vs/workbench/contrib`](https://github.com/sidenai/sidex/tree/main/src/vs/workbench/contrib) (Workbench Features), [`crates/sidex-extensions`](https://github.com/sidenai/sidex/tree/main/crates/sidex-extensions) (Extensions Runtime), [`src/vs/workbench/workbench.web.main.ts`](https://github.com/sidenai/sidex/blob/main/src/vs/workbench/workbench.web.main.ts) (Workbench Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Webview UI"]
  node_webview_shell["Workbench Shell<br/>ts workbench"]
  node_workbench_parts["Workbench Parts<br/>ui layout"]
  node_service_layer["Platform Services<br/>di services"]
  node_sidex_platform["Sidex Adapters<br/>tauri bridges"]
  node_editor_stack["Editor Stack<br/>monaco editor"]
  node_workbench_contrib["Workbench Features<br/>contrib modules"]
end

subgraph group_backend["Rust Backend"]
  node_tauri_main["Tauri Entry<br/>rust app<br/>[main.rs]"]
  node_tauri_lib["Tauri Bridge<br/>rust wiring<br/>[lib.rs]"]
  node_tauri_commands["Command API<br/>rust commands"]
  node_db_crate[("State DB<br/>sqlite storage")]
  node_settings_crate["Settings Store<br/>config profiles"]
  node_workspace_crate["Workspace Core<br/>workspace model"]
  node_git_crate["Git Service<br/>git backend"]
  node_terminal_crate["Terminal Engine<br/>pty backend"]
  node_lsp_crate["LSP Service<br/>language server"]
  node_dap_crate["Debug Protocol<br/>debug adapter"]
end

subgraph group_extensions["Extensions"]
  node_extensions_crate["Extensions Runtime<br/>extensions backend"]
  node_ext_api_crate["Ext API<br/>host api"]
  node_ext_host["Host Sidecar<br/>node host<br/>[host.cjs]"]
end

subgraph group_support["Support"]
  node_marketplace_proxy["Marketplace Proxy<br/>edge worker<br/>[worker.ts]"]
  node_build_tooling["Build Tooling<br/>vite rust CI<br/>[vite.config.ts]"]
end

node_webview_shell -->|"renders"| node_workbench_parts
node_webview_shell -->|"uses"| node_service_layer
node_webview_shell -->|"adapts"| node_sidex_platform
node_workbench_parts -->|"hosts"| node_editor_stack
node_workbench_parts -->|"hosts"| node_workbench_contrib
node_service_layer -.->|"invokes"| node_tauri_commands
node_sidex_platform -.->|"bridges"| node_tauri_commands
node_editor_stack -.->|"requests"| node_lsp_crate
node_workbench_contrib -.->|"consumes"| node_git_crate
node_workbench_contrib -.->|"drives"| node_terminal_crate
node_workbench_contrib -.->|"drives"| node_dap_crate
node_workbench_contrib -.->|"observes"| node_workspace_crate
node_tauri_main -->|"loads"| node_tauri_lib
node_tauri_lib -->|"registers"| node_tauri_commands
node_tauri_commands -->|"persists"| node_db_crate
node_tauri_commands -->|"reads/writes"| node_settings_crate
node_tauri_commands -->|"services"| node_workspace_crate
node_tauri_commands -->|"services"| node_git_crate
node_tauri_commands -->|"services"| node_terminal_crate
node_tauri_commands -->|"services"| node_lsp_crate
node_tauri_commands -->|"services"| node_extensions_crate
node_extensions_crate -->|"implements"| node_ext_api_crate
node_extensions_crate -->|"launches"| node_ext_host
node_extensions_crate -.->|"queries"| node_marketplace_proxy
node_build_tooling -->|"builds"| node_webview_shell
node_build_tooling -->|"packages"| node_tauri_main

click node_webview_shell "https://github.com/sidenai/sidex/blob/main/src/vs/workbench/workbench.web.main.ts"
click node_workbench_parts "https://github.com/sidenai/sidex/tree/main/src/vs/workbench/browser/parts"
click node_service_layer "https://github.com/sidenai/sidex/tree/main/src/vs/platform"
click node_sidex_platform "https://github.com/sidenai/sidex/tree/main/src/vs/platform/sidex"
click node_editor_stack "https://github.com/sidenai/sidex/tree/main/src/vs/editor"
click node_workbench_contrib "https://github.com/sidenai/sidex/tree/main/src/vs/workbench/contrib"
click node_tauri_main "https://github.com/sidenai/sidex/blob/main/src-tauri/src/main.rs"
click node_tauri_lib "https://github.com/sidenai/sidex/blob/main/src-tauri/src/lib.rs"
click node_tauri_commands "https://github.com/sidenai/sidex/tree/main/src-tauri/src/commands"
click node_db_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-db"
click node_settings_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-settings"
click node_workspace_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-workspace"
click node_git_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-git"
click node_terminal_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-terminal"
click node_lsp_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-lsp"
click node_dap_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-dap"
click node_extensions_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-extensions"
click node_ext_api_crate "https://github.com/sidenai/sidex/tree/main/crates/sidex-extension-api"
click node_ext_host "https://github.com/sidenai/sidex/blob/main/src-tauri/extension-host/host.cjs"
click node_marketplace_proxy "https://github.com/sidenai/sidex/blob/main/infrastructure/marketplace-proxy/src/worker.ts"
click node_build_tooling "https://github.com/sidenai/sidex/blob/main/vite.config.ts"

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_webview_shell,node_workbench_parts,node_service_layer,node_sidex_platform,node_editor_stack,node_workbench_contrib toneBlue
class node_tauri_main,node_tauri_lib,node_tauri_commands,node_db_crate,node_settings_crate,node_workspace_crate,node_git_crate,node_terminal_crate,node_lsp_crate,node_dap_crate toneAmber
class node_extensions_crate,node_ext_api_crate,node_ext_host toneMint
class node_marketplace_proxy,node_build_tooling toneRose
```

## Components

### Webview UI

TypeScript workbench and renderer-side IDE shell

- [Workbench Shell](https://github.com/sidenai/sidex/blob/main/src/vs/workbench/workbench.web.main.ts): ts workbench · Top-level renderer entrypoints and app boot for the VS Code-style IDE UI · `src/vs/workbench/workbench.web.main.ts`
- [Workbench Parts](https://github.com/sidenai/sidex/tree/main/src/vs/workbench/browser/parts): ui layout · Editor, sidebar, panel, status bar, title bar, notifications, and other shell regions · `src/vs/workbench/browser/parts`
- [Platform Services](https://github.com/sidenai/sidex/tree/main/src/vs/platform): di services · Core browser/platform service abstractions for commands, config, storage, theme, keybindings, files, workspace, remote, and more · `src/vs/platform`
- [Sidex Adapters](https://github.com/sidenai/sidex/tree/main/src/vs/platform/sidex): tauri bridges · Sidex-specific frontend services that adapt VS Code abstractions to Tauri-backed implementations · `src/vs/platform/sidex`
- [Editor Stack](https://github.com/sidenai/sidex/tree/main/src/vs/editor): monaco editor · Monaco editor, text model, view model, diffing, tokenization, and editor contributions · `src/vs/editor`
- [Workbench Features](https://github.com/sidenai/sidex/tree/main/src/vs/workbench/contrib): contrib modules · Major user-facing workbench features such as files, search, SCM, terminal, debug, settings, tasks, testing, and views · `src/vs/workbench/contrib`

### Rust Backend

Tauri commands and Rust services that own privileged work

- [Tauri Entry](https://github.com/sidenai/sidex/blob/main/src-tauri/src/main.rs): rust app · Native application entrypoint and Tauri bootstrap · `src-tauri/src/main.rs`
- [Tauri Bridge](https://github.com/sidenai/sidex/blob/main/src-tauri/src/lib.rs): rust wiring · Backend wiring that registers commands, state, and app services with Tauri · `src-tauri/src/lib.rs`
- [Command API](https://github.com/sidenai/sidex/tree/main/src-tauri/src/commands): rust commands · Backend command surface invoked from the webview for filesystem, process, search, git, terminal, settings, remote, and related operations · `src-tauri/src/commands`
- [State DB](https://github.com/sidenai/sidex/tree/main/crates/sidex-db): sqlite storage · Persistent storage for history, recent windows, window state, and related app data · `crates/sidex-db`
- [Settings Store](https://github.com/sidenai/sidex/tree/main/crates/sidex-settings): config profiles · User settings, profiles, migrations, schema, and sync support · `crates/sidex-settings`
- [Workspace Core](https://github.com/sidenai/sidex/tree/main/crates/sidex-workspace): workspace model · Workspace, file tree, watcher, search, trust, decorations, and file operation logic · `crates/sidex-workspace`
- [Git Service](https://github.com/sidenai/sidex/tree/main/crates/sidex-git): git backend · Repository discovery and source control operations such as status, diff, log, blame, branches, stash, and reset · `crates/sidex-git`
- [Terminal Engine](https://github.com/sidenai/sidex/tree/main/crates/sidex-terminal): pty backend · PTY, shell integration, ANSI handling, rendering support, selection, links, and terminal lifecycle · `crates/sidex-terminal`
- [LSP Service](https://github.com/sidenai/sidex/tree/main/crates/sidex-lsp): language server · Language protocol client and feature support for completion, hover, rename, diagnostics, formatting, and navigation · `crates/sidex-lsp`
- [Debug Protocol](https://github.com/sidenai/sidex/tree/main/crates/sidex-dap): debug adapter · Debug adapter transport, client, session, and launch config support · `crates/sidex-dap`

### Extensions

Extension host, API, and packaging surface

- [Extensions Runtime](https://github.com/sidenai/sidex/tree/main/crates/sidex-extensions): extensions backend · Extension manifests, registry, marketplace/install flow, activation, VSIX handling, tree views, and webviews · `crates/sidex-extensions`
- [Ext API](https://github.com/sidenai/sidex/tree/main/crates/sidex-extension-api): host api · Host-facing extension API and WIT world definitions · `crates/sidex-extension-api`
- [Host Sidecar](https://github.com/sidenai/sidex/blob/main/src-tauri/extension-host/host.cjs): node host · Node-compatible extension host bootstrap and polyfills · `src-tauri/extension-host/host.cjs`

### Support

Build, tooling, and deployment support

- [Marketplace Proxy](https://github.com/sidenai/sidex/blob/main/infrastructure/marketplace-proxy/src/worker.ts): edge worker · Cloudflare Worker that adapts Open VSX marketplace and gallery requests · `infrastructure/marketplace-proxy/src/worker.ts`
- [Build Tooling](https://github.com/sidenai/sidex/blob/main/vite.config.ts): vite rust CI · Frontend build, Rust/Tauri packaging, WASM helpers, scripts, and CI workflows · `vite.config.ts`

## Connections

- Workbench Shell → Workbench Parts: renders · Workbench bootstraps the IDE shell regions
- Workbench Shell → Platform Services: uses · Shell composes platform services through DI
- Workbench Shell → Sidex Adapters: adapts · Sidex-specific frontend bindings plug into the workbench
- Workbench Parts → Editor Stack: hosts · Editor UI is embedded in the workbench layout
- Workbench Parts → Workbench Features: hosts · Shell regions surface workbench feature contributions
- Platform Services → Command API: invokes · Frontend services call backend commands for privileged work
- Sidex Adapters → Command API: bridges · Sidex adapters map VS Code services to Tauri commands and events
- Editor Stack → LSP Service: requests · Editor language features are backed by language protocol services
- Workbench Features → Git Service: consumes · SCM views and diffs consume backend Git operations
- Workbench Features → Terminal Engine: drives · Terminal panel drives PTY sessions and shell integration
- Workbench Features → Debug Protocol: drives · Debug views and actions consume debug sessions
- Workbench Features → Workspace Core: observes · Files, search, and workspace UI reflect workspace state and watchers
- Tauri Entry → Tauri Bridge: loads · Native entrypoint hands off to backend wiring
- Tauri Bridge → Command API: registers · Backend wiring exposes command handlers to the frontend
- Command API → State DB: persists · Commands read and write application state and history
- Command API → Settings Store: reads/writes · Commands manage configuration, profiles, and sync data
- Command API → Workspace Core: services · Command handlers delegate workspace, file, and watcher logic
- Command API → Git Service: services · Command handlers delegate Git operations
- Command API → Terminal Engine: services · Command handlers manage terminal and PTY lifecycle
- Command API → LSP Service: services · Command handlers expose language-server operations
- Command API → Extensions Runtime: services · Command handlers expose extension install and runtime operations
- Extensions Runtime → Ext API: implements · Extension runtime is built around the host-facing API
- Extensions Runtime → Host Sidecar: launches · Extension runtime bootstraps the sidecar host process
- Extensions Runtime → Marketplace Proxy: queries · Extension discovery and install flows can route through the marketplace proxy
- Build Tooling → Workbench Shell: builds · Vite/TypeScript tooling builds the frontend workbench
- Build Tooling → Tauri Entry: packages · Rust/Tauri tooling packages the native backend
