The complete autonomous AI infrastructure stack. Deploy OpenClaw + n8n to Railway with Tailscale encrypted mesh networking, on-demand Modal GPU compute, and 500+ SaaS integrations — all pre-wired and ready from a single browser-based setup wizard. One click. Zero SSH. 90%+ LLM cost savings out of the box.
The standard OpenClaw Railway template gives you a gateway. This gives you the full stack.
| Bare OpenClaw | This Template | |
|---|---|---|
| n8n workflow automation | ✗ | ✓ |
| Tailscale mesh access | ✗ | ✓ |
| Modal GPU compute | ✗ | ✓ |
| 500+ SaaS integrations | ✗ | ✓ |
| LLM cost optimization | Manual | Auto (90%+ savings) |
| Setup | CLI | Browser wizard |
One click deploys the full stack. All companion services are pre-wired via Railway reference variables — no manual secret sharing or internal URL configuration required.
| Service | Source | Purpose |
|---|---|---|
| OpenClaw | This repo (Dockerfile) | AI gateway with setup wizard, Tailscale mesh, and 4-platform compute routing |
| Service | Image | Purpose | Depends On |
|---|---|---|---|
| n8n Primary | n8nio/n8n |
Workflow automation engine with AI agent nodes | Postgres, Redis |
| n8n Worker | n8nio/n8n |
Background workflow execution (queue mode) | n8n Primary, Postgres, Redis |
| Postgres | postgres-ssl:17 |
Persistent storage for n8n, Postiz, and Temporal | — |
| Redis | redis:8.2.1 |
Queue/cache backend for n8n and Postiz | — |
| Postiz | postiz-app |
Social media scheduling and automation | Postgres, Redis |
| Temporal | temporalio/auto-setup |
Distributed workflow orchestration | Postgres |
- Tailscale encrypted mesh networking (embedded in OpenClaw container — no extra service)
- 39 skills, 3 CLI tools, and 500+ SaaS integrations via Composio out of the box
- OpenTelemetry tracing with Langfuse (LLM evals) and PostHog (product analytics)
- Cost-optimized defaults that reduce API spend by 90%+
- Browser-based setup wizard at
/setup— no terminal required
You need: Railway account (2 min), Tailscale auth key (3 min), one LLM API key (already have). Total setup: under 10 minutes.
- Railway account — railway.app
- Tailscale account — tailscale.com (free for personal use)
- Tailscale auth key — Generate at Tailscale Admin > Keys
- Enable Reusable and Ephemeral (recommended)
- Pre-approve the key to skip manual device approval
- LLM API key — Anthropic, OpenAI, Google, OpenRouter, DeepSeek, Grok, or Kimi
Click the deploy button above, or:
- Fork this repo to your GitHub account
- Create a new project in Railway
- Select "Deploy from GitHub repo" and pick your fork
- Add a Volume mounted at
/data(persists config and workspace across deploys)
The template auto-generates secrets and wires all cross-service connections. You only need to fill in three values:
| Variable | Required | Description |
|---|---|---|
SETUP_PASSWORD |
Yes | Password to access the /setup wizard |
TAILSCALE_AUTHKEY |
Yes | Tailscale auth key (reusable + ephemeral) |
ANTHROPIC_API_KEY |
Recommended | Set here or enter during the setup wizard |
Everything else is pre-configured with sensible defaults. See .env.example for the full variable list.
Once deployed, open your Railway service URL and navigate to /setup. Enter your SETUP_PASSWORD and follow the wizard:
- Choose your model provider (Anthropic, OpenAI, Google, etc.)
- Enter your API key
- Optionally configure Telegram, Discord, or Slack channels
- Click Run setup
The wizard applies cost-optimized defaults, copies 39 skills to your workspace, and starts the gateway automatically.
With Tailscale installed on your Mac/PC, your Railway instance appears on your tailnet:
# Verify the instance is visible
tailscale status | grep openclaw
# The OpenClaw gateway is accessible at:
# https://openclaw-railway.<tailnet>.ts.netYour local OpenClaw CLI connects to the remote gateway over Tailscale — no SSH, no exposed ports.
After deploying, delete any companion services you don't need from the Railway dashboard to reduce cost.
| Configuration | Keep | Delete |
|---|---|---|
| OpenClaw only | OpenClaw | n8n, Postgres, Redis, Postiz, Temporal |
| OpenClaw + n8n | OpenClaw, n8n Primary, n8n Worker, Postgres, Redis | Postiz, Temporal |
| Full stack | Everything | — |
Internet → Railway :8080 → Express (server.js)
│
┌─────────────────┴──────────────────┐
│ │
/setup/* routes All other routes
(setup wizard) (proxy to gateway)
│ │
▼ ▼
Setup UI Gateway :18789
(browser) (OpenClaw core)
│
┌───────────────┼───────────────┐
│ │ │
LLM Skills n8n
(API) (tools) (webhooks)
- Express listens on port 8080 (Railway's public domain)
/setup/*routes serve the setup wizard UI (protected bySETUP_PASSWORD)- All other routes proxy to the OpenClaw gateway on
127.0.0.1:18789 - The gateway only binds to loopback — never directly exposed to the internet
- Tailscale provides end-to-end encrypted access from your local machine
The template routes workloads across 4 platforms automatically:
| Platform | Best For | Cost |
|---|---|---|
| Railway (this container) | Gateway, web server, cron, lightweight CLI tasks | ~$5–20/mo fixed |
| Modal (serverless) | ML inference, image/video gen, batch processing | Pay-per-second |
| n8n (orchestration) | Multi-step workflows, scheduled jobs, webhook chains | Included in Railway plan |
| Composio (SaaS bridge) | Direct SaaS actions (email, Slack, GitHub, CRM) | Free tier available |
Examples:
"Fix the auth bug in middleware.ts" → Railway local + Claude Opus
"Generate 100 product thumbnails" → Modal A10G GPU + vision model
"Every morning, email a sales report" → n8n scheduled workflow
"Post a message to Slack" → Composio Rube MCP
This template applies cost-optimized defaults on first setup that reduce LLM API spend by 90%+:
| Setting | Value | Why |
|---|---|---|
| Heartbeat model | Free-tier via OpenRouter | Background checks use the cheapest compatible model |
| Active hours | 06:00–23:00 UTC | Skip heartbeats while nobody's awake |
| Context pruning | cache-ttl with 6h TTL |
Reduce token bloat automatically |
| Memory compaction | Flush at 40k tokens | Distill sessions into daily memory files |
| Concurrency limits | 4 agents, 8 subagents max | Prevent runaway token consumption |
Set multiple API keys in Railway Variables — every available provider is detected and registered automatically at boot:
| Variable | Provider | Models |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic | Opus 4.6, Sonnet 4.6, Haiku 4.5 |
OPENAI_API_KEY |
OpenAI | GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano |
DEEPSEEK_API_KEY |
DeepSeek | DeepSeek Chat (V3), DeepSeek Reasoner (R1) |
GROK_API_KEY |
xAI | Grok 3, Grok 3 Mini |
KIMI_API_KEY |
Moonshot | Kimi K2 |
Free-tier models via OpenRouter with automatic failover:
nvidia/nemotron-3-nano-30b-a3b:free— primary (256K context)stepfun/step-3.5-flash:free— fallback (256K context)upstage/solar-pro-3:free— fallback (128K context)arcee-ai/trinity-mini:free— fallback (131K context)
39 skills and 3 CLI tools ship with this template — your instance is productive from first boot.
Railway (7 skills) — deploy, status, environment, service, database, domain, projects
n8n (8 skills) — workflow patterns, JavaScript/Python code nodes, node configuration, expression syntax, MCP tools, validation, full knowledge base (545 node docs, 20 templates)
Development & DevOps (4 skills) — coding agent (Claude Code, Codex CLI), PR creator, TDD workflow, implementation planning
Communication & Productivity (4 skills) — Google Workspace CLI, email (IMAP/SMTP), WhatsApp CLI, Jira
Research & Analytics (5 skills) — last 30 days research (Reddit, X, YouTube, web), data storytelling, visualization, project planning, strategy advisory
Content & Creative (3 skills) — changelog social announcements, scientific slides, viral generator builder
| Tool | Purpose |
|---|---|
Rube MCP (@composio/rube-mcp) |
500+ SaaS integrations (Gmail, Slack, Notion, GitHub, and more) |
| yt-dlp | YouTube video metadata and transcript extraction |
| Modal | Serverless GPU/compute — deploy functions, run batch jobs on A10G/A100/H100 |
| Homebrew | Install additional CLI tools at runtime |
Built-in OpenTelemetry instrumentation — all tracing is opt-in and degrades gracefully if no keys are set.
| Backend | Purpose | Required Variables |
|---|---|---|
| Langfuse | LLM tracing, evals, cost tracking | LANGFUSE_PUBLIC_KEY + LANGFUSE_SECRET_KEY |
| PostHog | Product analytics (setup and gateway events) | POSTHOG_API_KEY |
| OTLP | Generic APM (Grafana, Jaeger, etc.) | OTEL_EXPORTER_OTLP_ENDPOINT |
- Status — Gateway health, version, links to the OpenClaw UI
- Debug console — Run safe diagnostics without SSH
- Config editor — Edit
openclaw.jsonwith backup - Backup/restore — Download and upload
.tar.gzarchives of/data - Device pairing — Approve Telegram/Discord DM pairing requests
Live update (no restart): Open /setup → Debug console → openclaw.update → enter a ref:
--stable # Latest release tag
--beta # Latest pre-release
--canary # Latest main branch commit
v2026.3.1 # Pin to a specific versionBoot-time update (no rebuild): Set OPENCLAW_UPDATE_REF in Railway Variables.
Full Docker rebuild: Redeploy from Railway dashboard (~10 min). Pin a version with build arg OPENCLAW_GIT_REF=v2026.2.19.
To restart only OpenClaw without touching companion services:
scripts/safe-restart-openclaw.sh --yesscripts/connect-mac-to-railway-gateway.shVerifies Tailscale, fetches the gateway token from Railway, and configures your local OpenClaw CLI against the remote gateway automatically.
| Symptom | Cause | Fix |
|---|---|---|
ECONNREFUSED 127.0.0.1:18789 |
Gateway not started | Check /setup/api/debug, verify API key is set |
Gateway did not become ready in time |
Timeout | Increase healthcheckTimeout in railway.toml |
No model providers configured |
Missing API key | Set ANTHROPIC_API_KEY or another LLM key in Railway Variables |
n8n relation does not exist |
DB not connected | Check DB_POSTGRESDB_HOST spelling, redeploy n8n |
| Tailscale not connecting | Expired or unapproved key | Verify TAILSCALE_AUTHKEY is reusable + ephemeral + pre-approved |
| No traces in Langfuse | Missing keys | Set LANGFUSE_PUBLIC_KEY + LANGFUSE_SECRET_KEY |
For full troubleshooting details, visit /setup/api/debug for live diagnostics or open the Debug console at /setup and run openclaw doctor.
- Setup wizard protected by
SETUP_PASSWORDvia HTTP Basic auth - OpenClaw gateway binds to `127.0.