Railway CLI
$ railway Official Med RiskRailway CLI (railway) links local repositories to Railway projects and environments, offering --json on status, variables, logs, and domain commands, --detach deployments, and project-scoped RAILWAY_TOKEN authentication.
brew install railway railway works well for up --detach, logs --json, and variables --json, while Railway's official MCP or GraphQL API helps manage unlinked workspaces.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
status, variables, logs, and domain support --json, though link and init rely heavily on interactive pickers when unlinked.
- Supports
--jsonon read subcommands and--detachonup
Project-scoped RAILWAY_TOKEN limits blast radius to one environment, though railway variables --json exposes plaintext secrets.
- Environment-scoped
RAILWAY_TOKENsupport
Fast Rust binary distributed via Homebrew, npm, and GitHub releases.
- Rust binary via
brew install railwayand@railway/cli
Very smooth once a repo is linked, though less expressive for multi-project orchestration.
- Directory-linked workflow with
railway runenv injection
Official railwayapp/cli repository actively maintained under MIT.
- Official
railwayapp/clirepository
Clear CLI reference docs, though some flag behaviors change quickly across releases.
- Official docs at docs.railway.com
Security, Auth & Guardrails
Stores user auth and directory-to-project links in ~/.railway/config.json, or reads RAILWAY_TOKEN / RAILWAY_API_TOKEN.
CLI is free (MIT); Railway usage is billed per compute/memory/egress.
# Railway CLI Agent Rules - Always verify `railway status --json` before deploying or editing variables. - Never echo raw `railway variables --json` secrets into public transcripts. - Pass `--detach` on `railway up` so the command does not tail build logs indefinitely.
Agent-Ready Command Recipes
Safe Read-Only Queries
railway status --json
Displays the linked Railway project, environment, and services in JSON.
railway variables --json
Fetches environment variables for the linked service (avoid printing raw secrets to logs).
Controlled Writes & Previews
railway up --detach --ci
Uploads and triggers a build while exiting cleanly once queued.
Strengths for Agents
- + Fast Rust binary with
--jsononstatus,variables, andlogs. - + Project/environment-scoped
RAILWAY_TOKENsupports clean CI/agent isolation. - +
railway up --detachavoids blocking on long build streams.
Caveats & Pitfalls
- ! Unlinked directories trigger interactive prompts on
railway linkunless project/service flags are provided. - !
railway variables --jsonoutputs secret values in plaintext—agents must redact before logging.