---
title: "Deploy Factory on Rails"
description: "Self-hosted coding agents that turn tasks into pull requests"
category: "AI/ML"
url: https://railway.com/deploy/factory-on-rails
---

# Deploy Factory on Rails

Self-hosted coding agents that turn tasks into pull requests

**[Deploy Factory on Rails on Railway](https://railway.com/template/factory-on-rails)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/factory-on-rails/manifest.json

- **Creator:** shixzie's Projects
- **Category:** AI/ML

## Template content

### web

- **Source:** https://github.com/shixzie/factory-on-rails
- **Start command:** `cd apps/web && node node_modules/next/dist/bin/next start --hostname 0.0.0.0`
- **Health check:** /healthz
- **Public domain:** Yes

### runner

- **Source:** https://github.com/shixzie/factory-on-rails
- **Start command:** `node apps/runner/dist/index.js`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### harness

- **Source:** https://github.com/shixzie/factory-on-rails
- **Start command:** `node apps/harness/dist/index.js`
- **Health check:** /healthz

## Documentation

# Deploy and Host Factory on Rails on Railway

Factory on Rails is a self-hosted software factory. Sign in with GitHub, pick a repository, describe a change, and a coding agent (Claude Code or Codex) does the work in its own Railway sandbox and opens a pull request. Follow it live, answer its questions, and keep the conversation going.

## About Hosting Factory on Rails

The template deploys four services wired over Railway's private network: the web UI (the only public service), an API and auth service, a runner that drives one sandbox per run, and Postgres. Encryption and signing keys are generated for you. Railway asks for one value, your GitHub username. On first visit, a setup page creates the GitHub App from a manifest (no credentials to copy) and, with a Railway token you paste once, creates the separate `agents` environment the sandboxes run in. Each user brings their own model credential; sandbox usage is billed to your Railway workspace.

## Common Use Cases

- Hand well-defined changes to a coding agent and review them as pull requests
- Run several agents in parallel, each isolated in its own sandbox, with CI fixed automatically when checks fail
- Give a team one place to queue agent work against its repositories, with their own MCP tools

## Dependencies for Factory on Rails Hosting

- A GitHub account (the setup page creates the GitHub App used for sign-in and pushes)
- A model credential per user: a Claude subscription token, an Anthropic API key, a ChatGPT sign-in, or an OpenAI API key
- Railway Sandboxes, in the same workspace

### Deployment Dependencies

- Source: https://github.com/shixzie/factory-on-rails
- Railway Sandboxes: https://docs.railway.com/sandboxes

### Implementation Details

After deploying, open the `web` service's URL. It takes you to `/setup`, which walks you through three steps:

1. Create the GitHub App and install it on your repositories.
2. Sign in with GitHub.
3. Paste a Railway account or workspace token so the factory can create its sandbox environment. The token is used once and never stored.

Previews of apps running in sandboxes are optional and need a wildcard domain; see the repository README.

## Why Deploy Factory on Rails 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 Factory on Rails on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## 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/factory-on-rails
