Skip to content
managing-railway logo

Railway CLI Skill

managing-railway

Railway platform CLI for service deployment, infrastructure management, and debugging. Use for creating services, managing deployments, configuring networking, and reviewing logs.

SKILL.md

Full skill instructions

Railway CLI Skill

Fast reference for Railway CLI operations. See REFERENCE.md for comprehensive documentation.


Overview

What is Railway: Modern PaaS for instant deployments with zero configuration. Supports any language/​framework via Nixpacks or Dockerfile. Includes managed databases, private networking, and automatic SSL.

When to Use: Deploying apps, managing services/​databases, debugging (logs, SSH), configuring domains, managing environment variables, CI/​CD integration.

Auto-Detection: railway.json, railway.toml, RAILWAY_TOKEN in .env, or user mentions Railway.


Table of Contents

  1. Overview
  2. Critical: Avoiding Interactive Mode
  3. Prerequisites
  4. Authentication
  5. CLI Decision Tree
  6. Command Quick Reference
  7. Static Reference Data
  8. Common Workflows
  9. Private Networking
  10. Error Handling
  11. Framework Quick Start
  12. JSON Output Mode
  13. Quick Reference Card

Critical: Avoiding Interactive Mode

Railway CLI can enter interactive mode which will hang Claude Code. Always use flags:

CommandWRONGCORRECT
Link projectrailway linkrailway link -p <project> -e <env>
Create projectrailway initrailway init -n <name>
Switch envrailway environmentrailway environment <name>
Remove deployrailway downrailway down -y
Redeployrailway redeployrailway redeploy -y
Deployrailway uprailway up --detach
SSHrailway sshrailway ssh -- <command>

Required flags: -y (skip prompts), --detach (background), explicit names, --json (parsing), -- <cmd> (SSH).

Never use: railway login, railway connect (without service), railway shell, commands without explicit params.


Prerequisites

# Verify installation
railway --version  # Expects: 3.x.x+

# Install options
npm i -g @railway/​cli          # npm
brew install railway           # Homebrew
bash <(curl -fsSL cli.new)     # Shell script

Authentication

Token Types

Token TypeEnv VariableScope
Project TokenRAILWAY_TOKENSingle environment (for logs, up)
Account TokenRAILWAY_API_TOKENAll projects (for init, link)

Critical: railway logs requires a Project Token, not an account token.

Quick Setup

# Set token for session
export RAILWAY_TOKEN="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

# Or inline from .env
RAILWAY_TOKEN=$(grep RAILWAY_TOKEN .env | cut -d= -f2) railway logs

# Verify authentication
railway whoami

Discovering Tokens

grep -i railway .env
grep -E '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' .env

See REFERENCE.md for token creation and storage best practices.


CLI Decision Tree

Project Operations

├── Create project      → railway init -n <name>
├── Link to project     → railway link -p <project> -e <env>
├── List projects       → railway list
├── View status         → railway status
└── Open dashboard      → railway open

Deployment

├── Deploy (background) → railway up --detach
├── Redeploy            → railway redeploy -y
├── Remove deployment   → railway down -y
└── Deploy template     → railway deploy -t <template>

Services & Databases

├── Add PostgreSQL      → railway add -d postgres
├── Add Redis           → railway add -d redis
├── Add from repo       → railway add -r owner/​repo
├── Run with vars       → railway run <command>
└── Link to service     → railway service <name>

Debugging

├── View logs           → railway logs
├── Build logs          → railway logs -b
├── SSH command         → railway ssh -- <command>
└── Check status        → railway status

Environment & Variables

├── Switch environment  → railway environment <name>
├── Create environment  → railway environment new -d <source>
├── Delete environment  → railway environment delete <name> -y
├── View variables      → railway variables
└── Set variable        → railway variables --set KEY=value

See REFERENCE.md for all commands with full flag details.


Command Quick Reference

Project Management

CommandExample
railway initrailway init -n myapp
railway linkrailway link -p myproject -e production
railway listrailway list
railway statusrailway status
railway unlinkrailway unlink

Deployment

CommandExample
railway uprailway up --detach
railway redeployrailway redeploy -y
railway downrailway down -y
railway logsrailway logs -d <id>

Services

CommandExample
railway addrailway add -d postgres
railway servicerailway service api
railway runrailway run npm start

Debugging

CommandExample
railway logsrailway logs
railway logs -brailway logs -b
railway ssh -- cmdrailway ssh -- ls -la

Static Reference Data

Regions

CodeLocation
us-west2California, USA
us-east4-eqdc4aVirginia, USA
europe-west4-drams3aAmsterdam, Netherlands
asia-southeast1-eqsg3aSingapore

Database Types

TypeFlagShell
PostgreSQL-d postgrespsql
MySQL-d mysqlmysql
Redis-d redisredis-cli
MongoDB-d mongomongosh

Railway-Provided Variables

VariableDescription
RAILWAY_PUBLIC_DOMAINPublic domain
RAILWAY_PRIVATE_DOMAINPrivate domain (.railway.internal)
PORTPort to listen on
RAILWAY_ENVIRONMENTEnvironment name

Common Workflows

1. Deploy Application

railway init -n myapp                    # Create project
railway up --detach                      # Deploy (background)
railway logs                             # Check logs

2. Add Database

railway add -d postgres                  # Add PostgreSQL
railway run npm run migrate              # Run migrations

3. Configure Domain

railway domain                           # Generate Railway domain
railway domain api.myapp.com -p 3000     # Custom domain

4. Debug Failing Deployment

railway status                           # Check status
railway logs                             # View runtime logs
railway logs -b                          # View build logs
railway ssh -- ps aux                    # SSH command

5. CI/​CD Deployment

export RAILWAY_TOKEN=${{ secrets.RAILWAY_TOKEN }}
railway up --detach -s api

See REFERENCE.md for GitHub Actions, GitLab CI, and CircleCI examples.


Private Networking

Services communicate via: <service-name>.railway.internal

Example: http://api.railway.internal:3000

Port Binding (Required)

Apps must listen on :: for IPv4/​IPv6:

// Node.js
app.listen(process.env.PORT, '::', () => console.log('Running'));
# Python
gunicorn --bind "[::]:${PORT:-8000}" app:app

See REFERENCE.md for library configurations and TCP proxy.


Error Handling

Common Errors

ErrorResolution
command not found: railwayInstall via npm/​brew
Not logged inSet RAILWAY_TOKEN
No project linkedRun railway link
UnauthorizedCheck token, re-authenticate
Deployment failedCheck railway logs -b

502 Error Debugging

# 1. Get PROJECT token (not account token)
grep -i railway .env

# 2. Set token and verify
export RAILWAY_TOKEN="<uuid>"
railway whoami

# 3. Check logs
railway logs

Common 502 causes: Missing dependencies, port binding issues, startup crashes.

See REFERENCE.md for comprehensive troubleshooting.


Framework Quick Start

Node.js

app.listen(process.env.PORT, '::', () => console.log('Running'));

Python

# Procfile
web: gunicorn --bind "[::]:${PORT:-8000}" app:app

Rails

// railway.json
{
  "deploy": {
    "startCommand": "bundle exec rails server -b :: -p $PORT"
  }
}

See REFERENCE.md for complete configuration options.


JSON Output Mode

railway status --json | jq '.services[].name'
railway logs --json | jq -r 'select(.level == "error") | .message'

Quick Reference Card

# Authentication
export RAILWAY_TOKEN="xxx"

# Project
railway init -n myapp
railway link -p myproject -e production
railway status

# Deploy
railway up --detach
railway redeploy -y
railway down -y

# Services
railway add -d postgres
railway run npm run migrate

# Debug
railway logs
railway logs -b
railway ssh -- ps aux

# Environment
railway environment staging
railway variables --set KEY=value

# Domain
railway domain api.example.com -p 3000

See REFERENCE.md for: Complete command documentation, advanced deployment patterns, volume management, environment variable strategies, networking deep dive, CI/​CD integration, security best practices, troubleshooting, and config-as-code.

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View