OpenCode on Railway
Open-source AI coding agent with a browser UI and password login, running always-on on Railway.
OpenCode is an open-source AI coding agent. It plans work, edits files and runs commands in a project, with the model provider of your choice. It is usually run in a terminal, and it also has a server mode with a web UI.
Running it as a server on Railway gives you an always-on coding agent you can check from any browser or phone: hand it a refactor or bug hunt, review the diffs and approve commands. It is comparable to other terminal coding agents such as Claude Code, with the difference that it is not tied to one model provider.
OpenCode is MIT licensed.
What OpenCode can do
- Agent that plans, edits files and runs commands
- Browser UI served by opencode serve
- Works with many model providers
- git, GitHub CLI, Node.js, Python 3 and uv available to the agent
- Projects and sessions kept on a volume
- Optional repository clone on start
What people use it for
- Handing a refactor or bug hunt to the agent and checking progress from any browser
- Reviewing diffs and approving commands from a phone
- A shared coding sandbox next to your other Railway services
- Trying several model providers with one setup
Videos
Running OpenCode on Railway
The template runs OpenCode 1.19.3 as a server behind Caddy. The container refuses to start without a generated password. A volume at /data keeps projects, sessions, provider logins, git config and SSH keys. You can set a model key such as ANTHROPIC_API_KEY, log in through the web UI, or use OpenCode's free models when offered. Cost is the CPU and memory of the one service; model usage is billed by the provider.
OpenCode templates on Railway
Tracklayer templates are listed first. Other OpenCode templates follow, ordered by total deployments on Railway. How this works.
Deployment numbers as of 2026-11-20.
Questions about OpenCode
How do I log in?
Copy OPENCODE_SERVER_PASSWORD from the service Variables tab, open the public URL and sign in as user opencode (or your OPENCODE_SERVER_USERNAME).
Do I need a model provider?
Optional. Add a key variable, log in through the web UI, or use OpenCode's free models when offered. The free lineup is set by OpenCode and changes. Provider usage is billed separately.
What persists across redeploys?
Everything under /data. Packages installed with sudo apt are lost, and a redeploy stops a running agent turn.
Is it safe to leave running?
The agent can run shell commands and spend your model credits, and its user has passwordless sudo, which AGENT_SUDO=false removes. Keep the password private and review the permission settings first.
How do I upgrade?
Within OpenCode 1.x, change PIN_OPENCODE and its SHA-256 values in the service Dockerfile and redeploy. OpenCode 2 is not part of this template.
Guides
Similar apps
Tracklayer maintains the templates marked as such; OpenCode is a trademark of its owners and this site is not affiliated with them.