---
title: "Deploy Sim — Self-Hosted Visual AI Agent Builder"
description: "Self-host Sim: visual AI agent builder. 1,000+ integrations, BYO LLM."
category: "AI/ML"
url: https://railway.com/deploy/sim-ai-agent-builder
---

# Deploy Sim — Self-Hosted Visual AI Agent Builder

Self-host Sim: visual AI agent builder. 1,000+ integrations, BYO LLM.

**[Deploy Sim — Self-Hosted Visual AI Agent Builder on Railway](https://railway.com/template/sim-ai-agent-builder)**

- **Creator:** SilverBanana
- **Category:** AI/ML

## Template content

### realtime

- **Image:** simstudioai/realtime:latest

### Simstudio AI

- **Image:** simstudioai/simstudio:latest

### Migrations

- **Image:** simstudioai/migrations:latest

### PG Vector https://devicons.railway.com/i/postgresql.svg

- **Image:** pgvector/pgvector:pg17

## Documentation

# Deploy and Host Sim on Railway

Sim (formerly Sim Studio) is the open-source AI workspace for building, deploying, and
orchestrating AI agents — a Figma-like visual canvas for agent workflows, backed by Y Combinator
and ~28.8k GitHub stars. Drag-and-drop blocks to wire LLMs, tools, and data into production
agents; connect 1,000+ integrations (Slack, Notion, Gmail, GitHub, Salesforce) and 15+ model
providers out of the box; and keep workflows, tables, knowledge bases, and files in one shared
workspace so your agents share memory and context.

Sim sits between n8n (more AI-native than) and LangChain/CrewAI (more visual than) — a workspace,
not just a workflow tool. Self-host on Railway for ~$10–15/month with your agents, data, and keys
on infrastructure you own, under Apache-2.0 with no per-run fees and BYO-LLM at base pricing.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Sim** | The AI workspace — visual workflow builder, agent runtime, tables, knowledge bases, and REST API, on port `3000` |
| **PostgreSQL 17 + pgvector** | Stores workflows, tables, users, and vector embeddings for knowledge-base semantic search |

Both services connect over Railway's private network. Sim is built on Next.js + Bun with
PostgreSQL and pgvector (required for knowledge bases). Bring your own LLM keys — OpenAI,
Anthropic, Gemini, Groq, or local Ollama/vLLM — at base provider pricing with no markup.

---

## About Hosting Sim

Orchestrating multi-agent workflows in raw code turns into a mess fast — sequential, parallel, and
loop patterns are hard to maintain and impossible to see. Sim gives you a visual canvas to wire the
whole flow, then deploy it as an API or chat endpoint instead of it staying a pretty diagram.
Self-hosting keeps your workflows, data, and keys off a vendor's cloud and free from per-run pricing.

Running it needs Next.js/Bun, PostgreSQL with pgvector, and HTTPS. Railway wires the app and
database over private networking with automatic HTTPS — set your public URL and LLM keys, and
you're building agents in minutes.

> **Two things to know:** Sim's AI-assist features — Copilot and the Mothership natural-language
> control plane — are a Sim-managed cloud service; to use them self-hosted you generate a
> `COPILOT_API_KEY` at sim.ai. The visual builder, agent runtime, and integrations all work fully
> self-hosted without it. Separately, enterprise features (SSO, access control) are under a
> separate license requiring a subscription for production use.

Typical cost: **~$10–15/month** on Railway for Sim and PostgreSQL, plus your own LLM token usage
(BYOK, no markup). The managed Sim cloud is credit-based; self-hosting removes per-run credits and
keeps your data in your own database.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — Sim and PostgreSQL (pgvector) build automatically (~4–5 minutes)
2. Database credentials are wired automatically via Railway reference variables
3. Set `NEXT_PUBLIC_APP_URL` and `BETTER_AUTH_URL` to your Railway public domain
4. Set `BETTER_AUTH_SECRET` and `ENCRYPTION_KEY` (generate with `openssl rand -hex 32`)
5. Open your Railway URL, create your account, and build your first workflow on the canvas

Add your LLM API keys in settings, or point Sim at a self-hosted Ollama for API-free inference.

---

## Common Use Cases

- **Visual AI agent builder without code** — wire LLMs, tools, and logic on a drag-and-drop canvas;
  see the whole multi-agent flow instead of untangling it in code
- **Self-hosted alternative to commercial agent platforms** — own your workflows and data under
  Apache-2.0 instead of being locked into a cloud platform's pricing and terms
- **AI chatbots and assistants** — conversational agents that search the web, manage calendars,
  send email, and act on your business systems via 1,000+ integrations
- **RAG and knowledge-base agents** — upload documents to pgvector-backed knowledge bases and
  ground agent responses in your own content with semantic search
- **Pairs with your self-hosted AI stack** — point Sim at a Railway Ollama for local inference, a
  Qdrant instance for vectors, or a LiteLLM gateway for multi-provider routing

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `DATABASE_URL` | ✅ Auto-injected | PostgreSQL (pgvector) connection string via Railway reference variable |
| `NEXT_PUBLIC_APP_URL` | ✅ Required | Your Railway public domain — the app's public URL |
| `BETTER_AUTH_URL` | ✅ Required | Same as your public domain — required for authentication |
| `BETTER_AUTH_SECRET` | ✅ Required | Auth signing secret — `openssl rand -hex 32` |
| `ENCRYPTION_KEY` | ✅ Required | Encrypts stored credentials — `openssl rand -hex 32` |
| `COPILOT_API_KEY` | Optional | From sim.ai — enables the managed Copilot/Mothership AI-assist |
| `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` | Optional | LLM provider keys (BYOK, base pricing) |
| `OLLAMA_URL` | Optional | Point at a self-hosted Ollama for API-free local inference |
| `PORT` | Pre-set | `3000` — the app port |

> Set `NEXT_PUBLIC_APP_URL` and `BETTER_AUTH_URL` to your Railway domain, or auth and links break.
> Generate `BETTER_AUTH_SECRET` and `ENCRYPTION_KEY` fresh. The Copilot AI-assist needs a sim.ai
> key; everything else runs fully self-hosted with your own LLM keys.

---

## Sim vs. AI Workflow Tools

| | Sim (Railway) | n8n | LangChain/CrewAI | Commercial agent SaaS |
|---|---|---|---|---|
| **Visual canvas** | ✅ Figma-like | ✅ Node-based | ❌ Code-only | ✅ Varies |
| **AI-native design** | ✅ Agent-first | ⚠️ Automation-first | ✅ Code framework | ✅ Yes |
| **Self-hosted / own data** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ Cloud |
| **1,000+ integrations** | ✅ Yes | ✅ Yes | ⚠️ DIY | ⚠️ Varies |
| **BYO LLM (no markup)** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ Bundled |
| **Knowledge base (pgvector)** | ✅ Built-in | ⚠️ Add-on | ⚠️ DIY | ✅ Varies |
| **Per-run fees** | ✅ None (self-host) | ✅ None | ✅ None | ❌ Usually |
| **Open source** | ✅ Apache-2.0 | Fair-code | ✅ Yes | ❌ No |

---

## Dependencies for Sim Hosting

- Railway account — allocate RAM for Next.js + PostgreSQL (~$10–15/month)
- LLM provider API keys (OpenAI, Anthropic, etc.) or a self-hosted Ollama/vLLM endpoint
- Optional: a sim.ai account for the managed Copilot/Mothership AI-assist

### Deployment Dependencies

- [Sim GitHub Repository](https://github.com/simstudioai/sim) — source and releases
- [Sim Documentation](https://docs.sim.ai) — self-hosting, blocks, and integrations
- [Sim Environment Variables](https://docs.sim.ai) — full config reference
- [pgvector](https://github.com/pgvector/pgvector) — the vector extension Sim requires

### Implementation Details

This template deploys Sim (Next.js + Bun) with PostgreSQL 17 + pgvector over Railway's private
network. pgvector is required — it powers knowledge-base semantic search. Set `NEXT_PUBLIC_APP_URL`
and `BETTER_AUTH_URL` to your Railway domain so auth and links resolve, and generate
`BETTER_AUTH_SECRET` and `ENCRYPTION_KEY` before first use.

Sim supports 15+ LLM providers plus local Ollama/vLLM with BYOK at base pricing. The visual builder,
agent runtime, tables, knowledge bases, and integrations all run fully self-hosted; only the
Copilot/Mothership AI-assist calls the managed sim.ai service via `COPILOT_API_KEY`. Data persists
in PostgreSQL across redeploys.

---

## Frequently Asked Questions

**What is Sim, and how is it different from n8n or LangChain?**
Sim is an open-source AI workspace for building agent workflows on a visual canvas. It's more
AI-native than n8n (which is automation-first) and more visual than code-first frameworks like
LangChain or CrewAI. You wire LLMs, tools, and data as blocks, then deploy as an API or chat
endpoint — with workflows, tables, and knowledge bases sharing one workspace.

**Do I need a sim.ai account to self-host?**
Only for the AI-assist features. The visual builder, agent runtime, 1,000+ integrations, and
knowledge bases all work fully self-hosted with your own LLM keys. Copilot and the Mothership
natural-language control plane are a managed service — generate a `COPILOT_API_KEY` at sim.ai if
you want them; skip it and everything else still works.

**Which LLMs can I use?**
15+ providers — OpenAI, Anthropic, Gemini, Groq, Cerebras, DeepSeek, Mistral, xAI, OpenRouter —
plus local models via Ollama or vLLM at no API cost. Bring-Your-Own-Key means you pay base
provider pricing with no platform markup.

**Do I lose my workflows if Railway redeploys?**
No. Workflows, tables, knowledge bases, users, and vector embeddings live in the Railway-managed
PostgreSQL database. Redeploys and updates don't affect your data.

**Can I connect it to my self-hosted AI stack?**
Yes. Point Sim at a self-hosted Ollama for local inference, use Qdrant or pgvector for vectors, or
route through a LiteLLM gateway for multi-provider access — Sim pairs naturally with a self-hosted
AI stack on Railway.

**Are all features free and open source?**
The core is Apache-2.0 and fully self-hostable. Enterprise features (SSO, access control) are under
a separate license that requires a subscription for production use. For most builders and small
teams, the open-source core covers the full agent-building workflow.

---

## Why Deploy and Host Sim on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your
infrastructure so you don't have to deal with configuration, while allowing you to vertically and
horizontally scale it.

By deploying Sim on Railway, you get an open-source AI agent workspace — visual workflow builder,
1,000+ integrations, knowledge bases, and BYO-LLM — backed by PostgreSQL and pgvector at
~$10–15/month flat, with no per-run fees and full ownership of your agents and data.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/sim-ai-agent-builder
