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
When to use
Railway CLI is the command-line interface for the Railway platform, and it is essential if you manage Railway services as part of a development workflow. It connects your local project directory to Railway's infrastructure, letting you deploy code, pull environment variables, stream logs, and manage services without switching to the web dashboard.The fastest path to deploying on Railway is `railway up`. Point it at any directory and it uploads your code as a gzipped tarball, triggers a build on Railway's infrastructure, and returns a deployment URL. This is significantly faster than configuring a Git-based deploy pipeline when you need to test a quick change or ship a hotfix. For teams that want CI/CD integration without Railway's native Git deploys, the CLI works in GitHub Actions, GitLab CI, and any pipeline that supports shell commands — set `RAILWAY_TOKEN` and run `railway up` with the `--yes` flag.Environment variable management is where the CLI saves the most friction. `railway run` injects all of your Railway service's environment variables into any local process, so you can run your app locally with production or staging secrets without copying them into `.env` files. This eliminates the drift between local and deployed environments that causes "works on my machine" bugs. For automation, `railway variables list --json` pipes structured variable data into scripts.Log streaming via `railway logs` gives you real-time visibility into your deployments from the terminal. Combined with the `--service` and `--environment` flags, you can tail logs from specific services in specific environments without navigating the dashboard. This is particularly valuable during incident response when you need to correlate logs across multiple services quickly.The `railway link` command establishes a persistent connection between a local directory and a Railway project. Once linked, all subsequent commands operate against that project and environment, reducing command verbosity. For monorepos or multi-service setups, you can override the default service with the `--service` flag on any command.
When to skip
Skip the Railway CLI if you do not deploy to the Railway platform. This tool is purpose-built for Railway's infrastructure and has no utility outside that ecosystem. If you use Heroku, Render, Fly.io, Vercel, or AWS, their respective CLIs are what you need. The Railway CLI cannot deploy to other platforms.If your workflow is entirely Git-push-to-deploy through Railway's native GitHub or GitLab integration, the CLI may be unnecessary. Railway automatically builds and deploys when you push to connected branches. The CLI adds value when you need manual deployments, local environment variable injection via `railway run`, log streaming, or service management outside of Git triggers. For teams that never deploy outside their Git workflow and manage variables through the dashboard, the CLI is optional.The CLI requires network connectivity for every operation except `railway --help`. Deployments, log streaming, variable management, and status checks all call Railway's API. If you need an offline-first development tool, this is not it.For complex infrastructure-as-code requirements — such as defining VPCs, managing IAM policies, or configuring load balancers — Railway's abstraction layer handles these internally, and the CLI reflects that simplification. If your infrastructure needs demand fine-grained control over networking, custom buildpacks, or multi-region routing at the infrastructure level, a platform like AWS with Terraform or Pulumi gives you that control. Railway and its CLI are built for developers who want to skip that complexity.If you need to manage Railway resources through AI agents or LLM-based workflows, note that the CLI itself is not an MCP server. There is an unofficial community-built MCP server (jason-tan-swe/railway-mcp) for Railway API integration, but it is separate from this CLI tool.
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. You can install and use it without charge. However, the services and infrastructure you deploy are billed according to your Railway account plan — usage-based pricing with a free trial tier. The CLI is the interface to the platform, not the billing boundary.
- How do you install the Railway CLI?
- The fastest method is npm install -g @railway/cli. You can also use brew install railway on macOS, cargo install railwayapp --locked if you have Rust, scoop install railway on Windows, or the one-liner bash <(curl -fsSL cli.new) on Linux and macOS. After installing, run railway login to authenticate via the browser.
- What is the difference between railway up and Git-based deploys?
- railway up uploads your local directory as a tarball directly to Railway for building and deploying. Git-based deploys trigger automatically when you push to a connected GitHub or GitLab branch. Use railway up for quick manual deploys, hotfixes, or CI/CD pipelines where you want explicit control over what gets deployed and when. Git-based deploys are better for continuous deployment tied to your version control workflow.
- Can you use Railway CLI in CI/CD pipelines?
- Yes. Set the RAILWAY_TOKEN environment variable in your pipeline and use the --yes flag to skip interactive prompts. The CLI works in GitHub Actions, GitLab CI, CircleCI, and any environment with npm or a supported package manager. Use railway up --yes for automated deployments.
- Does Railway have an MCP server?
- Railway does not provide an official MCP server. There is an unofficial community-built MCP server at github.com/jason-tan-swe/railway-mcp with approximately 71 stars that enables managing Railway infrastructure through AI agents. Railway also offers a one-click template for hosting MCP server gateways on their platform.
Related tools in Cloud & Infra
AWS CLI official
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" && sudo installer -pkg AWSCLIV2.pkg -target /
category Cloud & Infra
Amazon's official command-line tool for managing AWS services. Control EC2, S3, Lambda, IAM, and 200+ services from the terminal.
16.8k
Vercel CLI official
npm i -g vercel
category Cloud & Infra
Vercel's official command-line interface. Deploy, preview, and manage web applications, serverless functions, and edge infrastructure from your terminal.
15.0k
Docker CLI official
brew install --cask docker
category Cloud & Infra
Docker's official command-line tool for building, running, and managing containers. Pull images, start services, inspect logs, and orchestrate multi-container apps from the terminal.
5.7k
Last verified: Mar 14, 2026