# Railway CLI
> Deploy and manage apps on Railway from the terminal

## Summary
CLI for the Railway deployment platform. Link local projects, deploy code, manage environment variables, provision databases, and view logs from the terminal.

## Capabilities
- Deploy applications to Railway with git push or CLI commands
- Manage environment variables and secrets per environment
- Provision and connect databases (Postgres, Redis, MySQL, MongoDB)
- View real-time logs from deployed services
- Link local projects to Railway services for development

## When to Use
- Deploying applications to the Railway platform
- Managing Railway environment variables and services from the terminal
- Need a quick deployment platform with database provisioning
- Running local development connected to Railway services

## When NOT to Use
- Not using Railway as your deployment platform
- Need fine-grained infrastructure control (use AWS/GCP CLIs)
- Deploying to Kubernetes or other container orchestration

## Key Flags
- `login`: Authenticate with Railway
- `link`: Link a local directory to a Railway project
- `up`: Deploy the current directory to Railway
- `run`: Run a command with Railway environment variables injected
- `logs`: View logs from the deployed service
- `variables`: View and manage environment variables

## Usage Patterns
### Deploy current project
```
railway up
```
Deploys the current directory to the linked Railway service

### Run a command with Railway env vars
```
railway run npm start
```
Executes the command with all Railway environment variables injected

### View deployment logs
```
railway logs
```
Streams real-time logs from the deployed service

## Input / Output
- **stdin**: Accepts interactive input for login and project selection
- **stdout**: Deployment status, logs, and environment variable listings
- **stderr**: Error messages and deployment warnings

## Installation
- **homebrew**: `brew install railway`
- **npm**: `npm i -g @railway/cli`

## Related Tools
- [render-cli](/tools/render-cli) (alternative): Render CLI is an alternative cloud platform CLI for deploying apps
- [docker](/tools/docker) (complementary): Railway can deploy Docker containers; Docker builds the images

---
Source: https://littlescripts.sh/tools/railway
