Deploy OpenCode
Open-source AI coding agent in your browser, password-protected.
OpenCode
Just deployed
/data
Deploy and Host OpenCode on Railway
OpenCode is an open-source AI coding agent. It reads and edits code, runs commands and works across whole repositories, using models from Anthropic, OpenAI, OpenRouter and many other providers. This template runs OpenCode's web interface, so you can use it from any browser.
About Hosting OpenCode
This template runs the official OpenCode image (ghcr.io/anomalyco/opencode) with its web interface, protected by a password generated at deploy time. Log in with the username opencode and the password from the OPENCODE_SERVER_PASSWORD variable. On startup it installs git, SSH, bash and curl so the agent can clone and work on repositories. A volume at /data keeps your sessions, settings, provider logins and the /data/workspace folder across restarts and redeploys. Add an AI provider key as a variable when deploying, or connect providers from the web interface afterwards.
Common Use Cases
- Use a coding agent from any computer without installing anything locally
- Clone a repository and have the agent fix bugs, build features or refactor code while you're away from your machine
- Keep a long-running agent workspace whose sessions and history survive restarts
Dependencies for OpenCode Hosting
- An API key for at least one AI model provider (for example Anthropic, OpenAI or OpenRouter), or a provider connected from the web interface
- A volume for persistent storage (included in this template)
Implementation Details
- Login: HTTP Basic Auth with the username
opencodeand the password fromOPENCODE_SERVER_PASSWORD. Anyone with the password can run commands in the container, so keep it private. - Storage: OpenCode's data, config, state and cache directories (the
XDG_*variables) all live on the/datavolume. Clone repositories into/data/workspaceso they persist. - Private repositories: clone over HTTPS with a personal access token.
Why Deploy OpenCode 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 OpenCode 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.
Template Content

