* v0 * Fix ppt load * Fixes * Fixes * Fix lint * Fix wid * Download image * Update tools * Fix lint * Fix error msg * Tool fixes * Reenable subagent stream * Subagent stream * Fix edit workflow hydration * Throw func execute error on error * Sandbox PPTX generation in subprocess with vm.createContext AI-generated PptxGenJS code was executed via new Function() in both the server (full Node.js access) and browser (XSS risk). Replace with a dedicated Node.js subprocess (pptx-worker.cjs) that runs user code inside vm.createContext with a null-prototype sandbox — no access to process, require, Buffer, or any Node.js globals. Process-level isolation ensures a vm escape cannot reach the main process or DB. File access is brokered via IPC so the subprocess never touches the database directly, mirroring the isolated-vm worker pattern. Compilation happens lazily at serve time (compilePptxIfNeeded) rather than on write, matching industry practice for source-stored PPTX pipelines. - Add pptx-worker.cjs: sandboxed subprocess worker - Add pptx-vm.ts: orchestration, IPC bridge, file brokering - Add /api/workspaces/[id]/pptx/preview: REST-correct preview endpoint - Update serve route: compile pptxgenjs source to binary on demand - Update workspace-file.ts: remove unsafe new Function(), store source only - Update next.config.ts: include pptxgenjs in outputFileTracingIncludes - Update trigger.config.ts: add pptx-worker.cjs and pptxgenjs to build * upgrade deps, file viewer * Fix auth bypass, SSRF, and wrong size limit comment - Add 'patch' to workspace_file WRITE_ACTIONS — patch operation was missing, letting read-only users modify file content - Add download_to_workspace_file to WRITE_ACTIONS with '*' wildcard — tool was completely ungated, letting read-only users write workspace files - Update isActionAllowed to handle '*' (always-write tools) and undefined action (tools with no operation/action field) - Block private/internal URLs in download_to_workspace_file to prevent SSRF against RFC 1918 ranges, loopback, and cloud metadata endpoints - Fix file-reader.ts image size limit comment and error message (was 20MB, actual constant is 5MB) * Fix Buffer not assignable to BodyInit in preview route Wrap Buffer in Uint8Array for NextResponse body — Buffer is not directly assignable to BodyInit in strict TypeScript mode. * Fix SSRF bypass, IPv6 coverage, download size cap, and missing deps - Validate post-redirect URL to block SSRF via open redirectors - Expand IPv6 private range blocking: fe80::/10, fc00::/7, ::ffff: mapped - Add 50 MB download cap (Content-Length pre-check + post-buffer check) - Add refetchOnWindowFocus: 'always' to useWorkspaceFileBinary - Add workspaceId to PptxPreview useEffect dependency array * Replace hand-rolled SSRF guard with secureFetchWithValidation The previous implementation hand-rolled private-IP detection with regex, missing edge cases (octal IPs, hex IPs, full IPv6 coverage). The codebase already has secureFetchWithValidation which uses ipaddr.js, handles DNS rebinding via IP pinning, validates each redirect target, and enforces a streaming size cap — removing the need for isPrivateUrl, isPrivateIPv4, the manual pre/post-redirect checks, and the Content-Length + post-buffer size checks. * Fix streaming preview cache ordering and patch ambiguity - PptxPreview: move streaming content check before cache check so live AI-generated previews are never blocked by a warm cache from a prior file view - workspace_file patch: reject edits where the search string matches more than one location, preventing silent wrong-location patches - workspace_file patch: remove redundant Record<string, unknown> cast; args is already Zod-validated with the correct field types * Fix subprocess env leak, unbounded preview spawning, and dead code - pptx-vm: pass minimal env to worker subprocess so it cannot inherit DB URLs, API keys, or other secrets from the Next.js process on a vm.createContext escape - PptxPreview: add AbortController so in-flight preview fetch is cancelled when the effect re-runs (e.g. next SSE update), preventing unbounded concurrent subprocesses; add 500ms debounce on streaming renders to reduce subprocess churn during rapid AI generation - file-reader: remove dead code — the `if (!isReadableType)` guard on line 110 was always true (all readable types returned earlier at line 76), making the subsequent `return null` unreachable * Wire abort signal through to subprocess and correct security comment - generatePptxFromCode now accepts an optional AbortSignal; when the signal fires (e.g. client disconnects mid-stream), done() is called which clears timers and kills the subprocess immediately rather than waiting for the 60s timeout - preview route passes req.signal so client-side AbortController.abort() (from the streaming debounce cleanup) propagates all the way to the worker process - Correct misleading comment in pptx-worker.cjs and pptx-vm.ts: vm.createContext is NOT a sandbox when non-primitives are in scope; the real security boundary is the subprocess + minimal env * Remove implementation-specific comments from pptx worker files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix pre-aborted signal, pptx-worker tracing, and binary fetch cache * Lazy worker path resolution, code size cap, unused param prefix * Add cache-busting timestamp to binary file fetch * Fix PPTX cache key stability and attribute-order-independent dimension parsing * ran lint --------- Co-authored-by: waleed <walif6@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
The open-source platform to build AI agents and run your agentic workforce. Connect 1,000+ integrations and LLMs to orchestrate agentic workflows.
Build Workflows with Ease
Design agent workflows visually on a canvas—connect agents, tools, and blocks, then run them instantly.
Supercharge with Copilot
Leverage Copilot to generate nodes, fix errors, and iterate on flows directly from natural language.
Integrate Vector Databases
Upload documents to a vector store and let agents answer questions grounded in your specific content.
Quickstart
Cloud-hosted: sim.ai
Self-hosted: NPM Package
npx simstudio
Note
Docker must be installed and running on your machine.
Options
| Flag | Description |
|---|---|
-p, --port <port> |
Port to run Sim on (default 3000) |
--no-pull |
Skip pulling latest Docker images |
Self-hosted: Docker Compose
git clone https://github.com/simstudioai/sim.git && cd sim
docker compose -f docker-compose.prod.yml up -d
Using Local Models with Ollama
Run Sim with local AI models using Ollama - no external APIs required:
# Start with GPU support (automatically downloads gemma3:4b model)
docker compose -f docker-compose.ollama.yml --profile setup up -d
# For CPU-only systems:
docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d
Wait for the model to download, then visit http://localhost:3000. Add more models with:
docker compose -f docker-compose.ollama.yml exec ollama ollama pull llama3.1:8b
Using an External Ollama Instance
If Ollama is running on your host machine, use host.docker.internal instead of localhost:
OLLAMA_URL=http://host.docker.internal:11434 docker compose -f docker-compose.prod.yml up -d
On Linux, use your host's IP address or add extra_hosts: ["host.docker.internal:host-gateway"] to the compose file.
Using vLLM
Sim supports vLLM for self-hosted models. Set VLLM_BASE_URL and optionally VLLM_API_KEY in your environment.
Self-hosted: Dev Containers
- Open VS Code with the Remote - Containers extension
- Open the project and click "Reopen in Container" when prompted
- Run
bun run dev:fullin the terminal or use thesim-startalias- This starts both the main application and the realtime socket server
Self-hosted: Manual Setup
Requirements: Bun, Node.js v20+, PostgreSQL 12+ with pgvector
- Clone and install:
git clone https://github.com/simstudioai/sim.git
cd sim
bun install
- Set up PostgreSQL with pgvector:
docker run --name simstudio-db -e POSTGRES_PASSWORD=your_password -e POSTGRES_DB=simstudio -p 5432:5432 -d pgvector/pgvector:pg17
Or install manually via the pgvector guide.
- Configure environment:
cp apps/sim/.env.example apps/sim/.env
cp packages/db/.env.example packages/db/.env
# Edit both .env files to set DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio"
- Run migrations:
cd packages/db && bunx drizzle-kit migrate --config=./drizzle.config.ts
- Start development servers:
bun run dev:full # Starts both Next.js app and realtime socket server
Or run separately: bun run dev (Next.js) and cd apps/sim && bun run dev:sockets (realtime).
Copilot API Keys
Copilot is a Sim-managed service. To use Copilot on a self-hosted instance:
- Go to https://sim.ai → Settings → Copilot and generate a Copilot API key
- Set
COPILOT_API_KEYenvironment variable in your self-hosted apps/sim/.env file to that value
Environment Variables
Key environment variables for self-hosted deployments. See .env.example for defaults or env.ts for the full list.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string with pgvector |
BETTER_AUTH_SECRET |
Yes | Auth secret (openssl rand -hex 32) |
BETTER_AUTH_URL |
Yes | Your app URL (e.g., http://localhost:3000) |
NEXT_PUBLIC_APP_URL |
Yes | Public app URL (same as above) |
ENCRYPTION_KEY |
Yes | Encrypts environment variables (openssl rand -hex 32) |
INTERNAL_API_SECRET |
Yes | Encrypts internal API routes (openssl rand -hex 32) |
API_ENCRYPTION_KEY |
Yes | Encrypts API keys (openssl rand -hex 32) |
COPILOT_API_KEY |
No | API key from sim.ai for Copilot features |
Tech Stack
- Framework: Next.js (App Router)
- Runtime: Bun
- Database: PostgreSQL with Drizzle ORM
- Authentication: Better Auth
- UI: Shadcn, Tailwind CSS
- State Management: Zustand
- Flow Editor: ReactFlow
- Docs: Fumadocs
- Monorepo: Turborepo
- Realtime: Socket.io
- Background Jobs: Trigger.dev
- Remote Code Execution: E2B
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Made with ❤️ by the Sim Team


