Sim is a self-hostable AI workflow automation platform that enables users to build, execute, and deploy multi-agent workflows through a visual interface. The platform provides a canvas-based editor for designing directed acyclic graph (DAG) workflows, integrates with 13+ LLM providers, offers 700+ pre-built tool integrations, and supports real-time collaborative editing.
This page provides a high-level architectural overview of the platform. For detailed information about specific subsystems, see:
Users construct workflows by placing blocks (nodes) on a canvas and connecting them with edges. Each block represents an operation—API calls, agent execution, data transformation, conditional logic, loops, or parallel branches. The canvas uses ReactFlow for rendering and interaction.
The platform executes LLM-powered agents that can invoke tools, maintain conversation memory, and stream responses. Agents support tool calling across 700+ integrations with automatic model capability detection (vision, tools, streaming) and cost tracking.
Unified abstraction layer for 13+ providers including OpenAI, Anthropic, Google (Gemini/Vertex), Azure OpenAI, AWS Bedrock, Groq, Cerebras, DeepSeek, xAI, Mistral, Perplexity, and Together.ai. Supports BYOK (Bring Your Own Keys) at workspace level with automatic load balancing.
Multiple users can simultaneously edit workflows through Socket.IO-based synchronization. Changes propagate via an operation queue with optimistic updates, retry logic, and conflict resolution.
Workflows can be deployed as:
Sources: README.md1-199 package.json1-56 apps/sim/package.json1-217
The platform follows a layered architecture with clear separation between presentation (Next.js), real-time synchronization (Socket.IO), execution (DAG engine), and persistence (PostgreSQL).
Sources: README.md175-188 docker-compose.prod.yml1-97 apps/sim/next.config.ts1-381
Sources: apps/sim/app/layout.tsx1-251 apps/sim/next.config.ts199-218
The codebase is organized as a Bun workspace managed by Turborepo:
| Package | Location | Purpose |
|---|---|---|
| sim | apps/sim/ | Main Next.js application (port 3000) |
| docs | apps/docs/ | Fumadocs documentation site (port 3001) |
| @sim/db | packages/db/ | Drizzle ORM schema and migrations |
| @sim/logger | packages/logger/ | Logging utilities |
| @sim/testing | packages/testing/ | Testing helpers |
| @sim/tsconfig | packages/tsconfig/ | Shared TypeScript configs |
| simstudio (CLI) | packages/cli/ | NPX installation tool |
| simstudio-ts-sdk | packages/ts-sdk/ | TypeScript SDK for API access |
The main application at apps/sim/ contains:
apps/sim/
├── app/ # Next.js App Router pages
│ ├── (auth)/ # Authentication pages (login, signup, verify)
│ ├── (landing)/ # Marketing pages
│ ├── workspace/ # Workspace navigation and workflow listing
│ └── w/ # Workflow editor UI
├── components/ # React components
│ ├── canvas/ # ReactFlow workflow canvas
│ ├── panel/ # Right panel (Copilot, Editor, Toolbar)
│ └── sidebar/ # Left sidebar (workspace navigation)
├── lib/ # Core business logic
│ ├── executor/ # Workflow execution engine
│ ├── blocks/ # Block definitions and handlers
│ ├── tools/ # Tool registry (700+ integrations)
│ ├── providers/ # LLM provider implementations
│ ├── auth/ # better-auth configuration
│ └── copilot/ # Copilot orchestration
├── socket/ # Socket.IO real-time server
├── stores/ # Zustand state management
└── trigger/ # Trigger.dev background jobs
Sources: package.json1-56 apps/sim/package.json1-217 README.md175-188
Sources: package.json1-56 apps/sim/package.json25-210 bun.lock1-330
The platform deploys as four Docker containers:
simstudio (8 GB memory limit) - Main Next.js application
realtime (1 GB memory limit) - Socket.IO server
db - PostgreSQL 17 with pgvector
migrations - One-shot migration runner
| Variable | Required | Purpose |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
BETTER_AUTH_SECRET | Yes | Authentication secret (32+ chars) |
BETTER_AUTH_URL | Yes | Application URL |
NEXT_PUBLIC_APP_URL | Yes | Public application URL |
ENCRYPTION_KEY | Yes | Environment variable encryption |
API_ENCRYPTION_KEY | Yes | API key encryption |
INTERNAL_API_SECRET | Yes | Internal service authentication |
COPILOT_API_KEY | No | Sim-managed Copilot API access |
OLLAMA_URL | No | Local LLM server URL |
Docker Compose - Single-server deployment with docker-compose.prod.yml:
Ollama Integration - Local AI models with docker-compose.ollama.yml:
Kubernetes/Helm - Production-grade deployment with helm/sim/ charts supporting:
NPX CLI - Automated local setup:
Sources: docker-compose.prod.yml1-97 docker-compose.ollama.yml1-182 README.md41-152
The database uses a normalized design with the workflow decomposed into separate tables for efficient collaborative updates:
| Table | Purpose |
|---|---|
workflow | Metadata (name, description, workspaceId) |
workflowBlocks | Individual block configurations |
workflowEdges | Connections between blocks |
workflowLoops | Loop construct metadata |
workflowParallels | Parallel branch metadata |
workflowVariables | Workflow-level variables |
workflowExecutionLogs | Execution history |
workflowExecutionSnapshots | Point-in-time workflow state |
workflowDeploymentVersion | Immutable deployment snapshots |
Multi-tenancy hierarchy:
user → member → organization → workspace → workflow
The @sim/db package defines the schema using Drizzle ORM and includes pgvector column definitions for embedding storage:
Sources: docker-compose.prod.yml79-96 package.json1-56
The platform implements route-specific CSP policies:
/workspace/*, /w/*) - Permissive COEP/COOP for Google Drive Picker and OAuth flows/api/workflows/:id/execute) - Restricted CSP with unsafe-none COEP/form/*) - Iframe-embeddable with origin-agnostic CSP/_next/*, /_vercel/*) - Standard headers@better-auth/ssoemailOtp.verifyEmail() if enabled/api/webhooks/*, /api/form/*) accept API keysINTERNAL_API_SECRET headermember table rolesSources: apps/sim/next.config.ts1-381 apps/sim/app/(auth)/login/login-form.tsx1-615 apps/sim/app/(auth)/signup/signup-form.tsx1-633
The DAGExecutor class processes workflows by:
workflowExecutionLogs tableSee Workflow Execution Engine for details.
lib/blocks/registry.ts) - 100+ block type definitionslib/tools/registry.ts) - 700+ integration functionsSee Blocks & Tools for implementation details.
lib/providers/) - 13+ LLM implementationsexecuteProviderRequest() dispatcherSee AI Provider Integration for architecture.
apps/sim/socket/index.ts) - Port 3002apps/sim/socket/database/operations.ts) - Atomic updatesSee Real-time Collaboration System for synchronization protocol.
lib/copilot/orchestrator.ts) - Manages agent loop@mention expansion for workflows, logs, docsedit_workflow, run_workflow, deploy_api, search_docsSee Copilot AI Assistant for implementation.
Sources: apps/sim/package.json1-217 README.md175-188
This overview establishes the foundational architecture. Subsequent sections provide detailed documentation of individual subsystems, APIs, and operational procedures.
Refresh this wiki
This wiki was recently refreshed. Please wait 4 days to refresh again.