# simstudioai/sim architecture

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

- Interactive diagram: https://gitdiagram.com/simstudioai/sim
- Repository: https://github.com/simstudioai/sim

## Overview

Sim is a workspace for building, deploying, and managing AI agents and workflows, with browser and desktop surfaces. The main user journey is to author an agent or workflow, connect it to integrations and workspace data, execute it, then inspect runs and activity. The README also identifies tables, files, knowledge bases, chat, and desktop as first-class capabilities. The graph combines these documented capabilities with sampled runtime modules; unsampled feature links use README evidence rather than inferred source calls.

Main entry points: [`apps/sim/app/workspace`](https://github.com/simstudioai/sim/tree/main/apps/sim/app/workspace) (Workspace UI), [`apps/sim/executor/execution/engine.ts`](https://github.com/simstudioai/sim/blob/main/apps/sim/executor/execution/engine.ts) (Execution engine), [`apps/sim/lib/workflows/editing`](https://github.com/simstudioai/sim/tree/main/apps/sim/lib/workflows/editing) (Workflow editing), [`apps/sim/lib/knowledge/connectors/member-sync-engine.ts`](https://github.com/simstudioai/sim/blob/main/apps/sim/lib/knowledge/connectors/member-sync-engine.ts) (Knowledge sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Build and interact"]
  node_workspace_ui["Workspace UI"]
  node_agent_chat["Agent chat"]
  node_resume_execution["Resume execution"]
  node_workflow_editing["Workflow editing"]
end

subgraph group_runtime["Execution and integrations"]
  node_execution_engine["Execution engine<br/>[engine.ts]"]
  node_integration_actions["Integration actions"]
  node_notion_query["Notion query tool<br/>[query_database.ts]"]
  node_workflow_runs["Run monitoring"]
end

subgraph group_workspace_data["Workspace data"]
  node_tables[("Structured tables<br/>[tables.ts]")]
  node_files[("Workspace files<br/>[storage-service.ts]")]
  node_file_preview["File preview"]
  node_knowledge_sync["Knowledge sync"]
end

subgraph group_platform["Platform services"]
  node_realtime["Realtime collaboration<br/>[redis-manager.ts]"]
  node_database[("PostgreSQL database")]
  node_deployment{{"Sim deployment"}}
end

subgraph group_clients["Client tools"]
  node_desktop["Sim Desktop"]
  node_cli["Sim CLI<br/>[program.ts]"]
  node_cli_commands["CLI commands<br/>[index.ts]"]
  node_cli_http["CLI API client<br/>[client.ts]"]
end

node_user(("Workspace user"))

node_user -->|"authors in"| node_workspace_ui
node_user -->|"uses chat"| node_agent_chat
node_workspace_ui -->|"builds workflows"| node_workflow_editing
node_workflow_editing -->|"defines runs"| node_execution_engine
node_execution_engine -->|"uses integrations"| node_integration_actions
node_execution_engine -->|"invokes tools"| node_notion_query
node_execution_engine -->|"records activity"| node_workflow_runs
node_user -->|"resumes run"| node_resume_execution
node_workspace_ui -->|"manages tables"| node_tables
node_workspace_ui -->|"manages files"| node_files
node_workspace_ui -->|"syncs knowledge"| node_knowledge_sync
node_file_preview -->|"previews files"| node_files
node_realtime -->|"broadcasts updates"| node_deployment
node_user -->|"uses desktop"| node_desktop
node_desktop -->|"connects to"| node_deployment
node_user -->|"runs commands"| node_cli
node_cli -->|"registers commands"| node_cli_commands
node_cli_commands -->|"sends requests"| node_cli_http
node_cli_http -->|"calls API"| node_deployment
node_knowledge_sync -->|"reads and writes"| node_database

click node_workspace_ui "https://github.com/simstudioai/sim/tree/main/apps/sim/app/workspace"
click node_agent_chat "https://github.com/simstudioai/sim/tree/main/apps/sim/app/(interfaces)/chat"
click node_resume_execution "https://github.com/simstudioai/sim/blob/main/apps/sim/app/(interfaces)/resume/%5BworkflowId%5D/%5BexecutionId%5D/resume-page-client.tsx"
click node_workflow_editing "https://github.com/simstudioai/sim/tree/main/apps/sim/lib/workflows/editing"
click node_execution_engine "https://github.com/simstudioai/sim/blob/main/apps/sim/executor/execution/engine.ts"
click node_integration_actions "https://github.com/simstudioai/sim/tree/main/apps/sim/blocks/blocks"
click node_notion_query "https://github.com/simstudioai/sim/blob/main/apps/sim/tools/notion/query_database.ts"
click node_workflow_runs "https://github.com/simstudioai/sim/tree/main/apps/sim/lib/workflows"
click node_tables "https://github.com/simstudioai/sim/blob/main/apps/realtime/src/handlers/tables.ts"
click node_files "https://github.com/simstudioai/sim/blob/main/apps/sim/lib/uploads/core/storage-service.ts"
click node_file_preview "https://github.com/simstudioai/sim/blob/main/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/preview/use-file-preview-controller.ts"
click node_knowledge_sync "https://github.com/simstudioai/sim/blob/main/apps/sim/lib/knowledge/connectors/member-sync-engine.ts"
click node_realtime "https://github.com/simstudioai/sim/blob/main/apps/realtime/src/rooms/redis-manager.ts"
click node_database "https://github.com/simstudioai/sim/tree/main/packages/db"
click node_desktop "https://github.com/simstudioai/sim/tree/main/apps/desktop/src/main"
click node_cli "https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/program.ts"
click node_cli_commands "https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/commands/protocol/index.ts"
click node_cli_http "https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/http/client.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_workspace_ui,node_agent_chat,node_resume_execution,node_workflow_editing,node_user toneBlue
class node_execution_engine,node_integration_actions,node_notion_query,node_workflow_runs toneAmber
class node_tables,node_files,node_file_preview,node_knowledge_sync toneMint
class node_realtime,node_database,node_deployment toneRose
class node_desktop,node_cli,node_cli_commands,node_cli_http toneIndigo
```

## Components

### Build and interact

- [Workspace UI](https://github.com/simstudioai/sim/tree/main/apps/sim/app/workspace): `apps/sim/app/workspace`
- [Agent chat](https://github.com/simstudioai/sim/tree/main/apps/sim/app/(interfaces)/chat): `apps/sim/app/(interfaces)/chat`
- [Resume execution](https://github.com/simstudioai/sim/blob/main/apps/sim/app/(interfaces)/resume/%5BworkflowId%5D/%5BexecutionId%5D/resume-page-client.tsx): `apps/sim/app/(interfaces)/resume/[workflowId]/[executionId]/resume-page-client.tsx`
- [Workflow editing](https://github.com/simstudioai/sim/tree/main/apps/sim/lib/workflows/editing): `apps/sim/lib/workflows/editing`

### Execution and integrations

- [Execution engine](https://github.com/simstudioai/sim/blob/main/apps/sim/executor/execution/engine.ts): `apps/sim/executor/execution/engine.ts`
- [Integration actions](https://github.com/simstudioai/sim/tree/main/apps/sim/blocks/blocks): `apps/sim/blocks/blocks`
- [Notion query tool](https://github.com/simstudioai/sim/blob/main/apps/sim/tools/notion/query_database.ts): `apps/sim/tools/notion/query_database.ts`
- [Run monitoring](https://github.com/simstudioai/sim/tree/main/apps/sim/lib/workflows): `apps/sim/lib/workflows`

### Workspace data

- [Structured tables](https://github.com/simstudioai/sim/blob/main/apps/realtime/src/handlers/tables.ts): `apps/realtime/src/handlers/tables.ts`
- [Workspace files](https://github.com/simstudioai/sim/blob/main/apps/sim/lib/uploads/core/storage-service.ts): `apps/sim/lib/uploads/core/storage-service.ts`
- [File preview](https://github.com/simstudioai/sim/blob/main/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/preview/use-file-preview-controller.ts): `apps/sim/app/workspace/[workspaceId]/home/hooks/preview/use-file-preview-controller.ts`
- [Knowledge sync](https://github.com/simstudioai/sim/blob/main/apps/sim/lib/knowledge/connectors/member-sync-engine.ts): `apps/sim/lib/knowledge/connectors/member-sync-engine.ts`

### Platform services

- [Realtime collaboration](https://github.com/simstudioai/sim/blob/main/apps/realtime/src/rooms/redis-manager.ts): `apps/realtime/src/rooms/redis-manager.ts`
- [PostgreSQL database](https://github.com/simstudioai/sim/tree/main/packages/db): `packages/db`
- **Sim deployment**

### Client tools

- [Sim Desktop](https://github.com/simstudioai/sim/tree/main/apps/desktop/src/main): `apps/desktop/src/main`
- [Sim CLI](https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/program.ts): `packages/sim-cli/src/program.ts`
- [CLI commands](https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/commands/protocol/index.ts): `packages/sim-cli/src/commands/protocol/index.ts`
- [CLI API client](https://github.com/simstudioai/sim/blob/main/packages/sim-cli/src/http/client.ts): `packages/sim-cli/src/http/client.ts`

### Other components

- **Workspace user**

## Connections

- Workspace user → Workspace UI: authors in (evidence: `README.md`)
- Workspace user → Agent chat: uses chat (evidence: `README.md`)
- Workspace UI → Workflow editing: builds workflows (evidence: `README.md`)
- Workflow editing → Execution engine: defines runs (evidence: `README.md`)
- Execution engine → Integration actions: uses integrations (evidence: `README.md`)
- Execution engine → Notion query tool: invokes tools (evidence: `apps/sim/tools/notion/query_database.ts`)
- Execution engine → Run monitoring: records activity (evidence: `README.md`)
- Workspace user → Resume execution: resumes run (evidence: `README.md`)
- Workspace UI → Structured tables: manages tables (evidence: `README.md`)
- Workspace UI → Workspace files: manages files (evidence: `README.md`)
- Workspace UI → Knowledge sync: syncs knowledge (evidence: `README.md`)
- File preview → Workspace files: previews files (evidence: `apps/sim/app/workspace/[workspaceId]/home/hooks/preview/use-file-preview-controller.ts`)
- Realtime collaboration → Sim deployment: broadcasts updates (evidence: `apps/realtime/src/rooms/redis-manager.ts`)
- Workspace user → Sim Desktop: uses desktop (evidence: `README.md`)
- Sim Desktop → Sim deployment: connects to (evidence: `README.md`)
- Workspace user → Sim CLI: runs commands (evidence: `packages/sim-cli/src/program.ts`)
- Sim CLI → CLI commands: registers commands (evidence: `packages/sim-cli/src/program.ts`)
- CLI commands → CLI API client: sends requests
- CLI API client → Sim deployment: calls API (evidence: `packages/sim-cli/src/http/client.ts`)
- Knowledge sync → PostgreSQL database: reads and writes (evidence: `apps/sim/lib/knowledge/connectors/member-sync-engine.ts`)
