Skip to content

Railway CLI

488 stars
official open-source Has MCP Cross-platform macOS Windows Actively maintained

Railway's official command-line interface. Deploy services, manage environment variables, stream logs, and control your Railway infrastructure without leaving the terminal.

Railway CLI has both a CLI and an MCP server. See when to use each

Part of the Railway CLI tools for AI agents

What your agent can do

You built an app locally. Now you need to deploy it. AWS is complex. Heroku killed its free tier. Configuring Dockerfiles, environment variables, database provisioning, SSL, and custom domains takes hours for each new project. Your agent runs `railway up` and deploys the current directory to Railway. Scan, compress, upload, build, deploy. No Dockerfile required. Railpack auto-detects your stack.Your agent manages the entire deployment lifecycle in four commands. `railway link` connects to a project. `railway up` deploys. `railway logs` streams logs in real-time. `railway variables set KEY=value` manages environment variables. For multi-service setups (web app, worker, database, cache), `--service` targets specific services within a project.Environment variable management prevents "works on my machine" bugs. Your agent runs `railway run npm start` and injects all of the Railway service's environment variables into the local process. No copying secrets into `.env` files, no drift between local and deployed environments. `railway variables list --json` pipes structured data into scripts.Railway's project hierarchy (Project > Service > Environment) maps to multi-container setups. A project contains multiple services that share a private network. Your agent manages each service independently with the `--service` flag. Most tutorials only show single-service deploys, so this multi-service capability is underutilized.Railway's scale-to-zero means you don't pay for idle resources. Your agent deploys, configures, and manages costs. For the post-Heroku generation of indie developers looking for "just deploy my app" simplicity, Railway with an AI agent is the closest thing to a personal DevOps engineer.

Limitations

Railway-only. No cross-platform deployment support. For fine-grained infrastructure control (VPCs, IAM, load balancers), use AWS/GCP with Terraform. Railway abstracts these away by design. The CLI requires network connectivity for every operation. No official MCP server, though a community-built option exists at jason-tan-swe/railway-mcp.

Key Commands

railway up Deploy the current directory to your linked Railway service by uploading a gzipped tarball
railway run Run a local command with Railway environment variables injected into the process
railway logs Stream real-time deployment logs from a service, with optional filtering by deployment
railway link Link the current directory to a Railway project and service for subsequent commands
railway variables List, set, or delete environment variables for a service in the linked project
railway status Display the current project, environment, and service context for the linked directory
railway login Authenticate with Railway via the browser or a token for CI/CD environments

GitHub Stats

repo railwayapp/cli
stars 488
language Rust
license MIT
last commit Mar 13, 2026

Alternatives

tool description
Railway CLI current tool
Render CLI CLI for Render, a competing PaaS with similar deploy-from-repo workflows and managed databases.
Fly.io CLI (flyctl) CLI for Fly.io, a platform focused on running apps close to users with global edge deployments.
Heroku CLI CLI for Heroku, the original PaaS with a mature addon ecosystem and Git-based deploy model.

FAQ

Is the Railway CLI free?
Yes. The Railway CLI is free and open-source under the MIT license. Services you deploy are billed usage-based with a free trial tier. The CLI is the interface, not the billing boundary. Install and authenticate in under a minute.
How do you install the Railway CLI?
Fastest method is `npm install -g @railway/cli`. Also available via `brew install railway` (macOS), `cargo install railwayapp --locked` (Rust), `scoop install railway` (Windows), or `bash <(curl -fsSL cli.new)` (Linux/macOS one-liner). Run `railway login` to authenticate via browser.
What is the difference between railway up and Git-based deploys?
`railway up` uploads your local directory as a tarball directly to Railway. Git-based deploys trigger automatically when you push to a connected branch. Your agent uses `railway up` for manual deploys, hotfixes, and CI/CD pipelines. Git-based deploys work for continuous deployment tied to version control. Both produce the same result.
Can you use Railway CLI in CI/CD pipelines?
Yes. Set `RAILWAY_TOKEN` in your pipeline and use `--yes` to skip prompts. Your agent runs `railway up --yes` for automated deployments. Works in GitHub Actions, GitLab CI, CircleCI, and any environment with npm or a supported package manager.
Does Railway have an MCP server?
No official MCP server. A community-built option exists at github.com/jason-tan-swe/railway-mcp (~71 stars) for managing Railway infrastructure through agents. Railway also offers a one-click template for hosting your own MCP server gateways on their platform.

Last verified: Mar 14, 2026