agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/devops/railway/SKILL.md

railway

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Railway cloud platform assistance covering Nixpacks buildpacks, instant deployments, PostgreSQL/Redis plugins, and environment variables. Use when deploying full-stack web applications without infrastructure overhead.

  • Reads credentials

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analytics-metrics, aws-account-management and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hoodiniSkill

    analytics-metrics

    Build data visualization and analytics dashboards. Use when creating charts, KPI displays, metrics dashboards, or data visualization components. Triggers on analytics, dashboard, charts, metrics, KPI, data visualization, Recharts.

    Also in 3 projects that use this

  • hoodiniSkill

    aws-account-management

    Manage AWS accounts, organizations, IAM, and billing. Use when setting up AWS Organizations, managing IAM policies, controlling costs, or implementing multi-account strategies. Triggers on AWS Organizations, AWS IAM, AWS billing, Cost Explorer, SCPs, multi-account, AWS SSO, Identity Center.

    Also in 3 projects that use this

  • +7 more from hoodini

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Railway Private Networking (*.railway.internal) for service-to-service communication.

    line 105
  2. Very specific:

    Commit .env files; use Railway's encrypted environment variables dashboard or CLI.

    line 113

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Railway

Railway is a modern PaaS that offers "Infrastructure from Code". It introspects your repo and deploys it. Can also deploy Databases (Postgres, Redis, Mongo).

When to Use

  • Frictionless Full-Stack Cloud Hosting: Deploying databases, microservices, and frontends with instant Git synchronization.
  • Private Mesh Networking: Communicating between services over secure private IPv6 addresses without internet traversal.
  • Managed Production Databases: One-click provisioning of PostgreSQL, Redis, MySQL, and MongoDB with automated backups.
  • Ephemeral PR Preview Environments: Creating isolated staging environments automatically for every pull request.

Quick Start

railway login
railway init
railway up

Core Concepts

Declarative Service Configuration (railway.json)

Defining build commands, health checks, and restart policies:

{
  "$schema": "https://railway.app/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "buildCommand": "npm run build"
  },
  "deploy": {
    "startCommand": "npm start",
    "healthcheckPath": "/healthz",
    "healthcheckTimeout": 100,
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 5
  }
}

Private Networking Across Microservices

Connecting internal services securely using Railway private domains:

// Using internal private networking domain (zero public exposure)
const databaseUrl =
  process.env.DATABASE_PRIVATE_URL ||
  "postgresql://postgres:secret@postgres.railway.internal:5432/railway";

const redisUrl =
  process.env.REDIS_PRIVATE_URL ||
  "redis://default:secret@redis.railway.internal:6379";

Railway CLI Workflow

Managing environments and deploying from terminal:

# Log in to Railway account
railway login

# Link local directory to Railway project
railway link

# Run command locally with remote environment variables injected
railway run npm run migrate

# Trigger deployment from local branch
railway up

Common Patterns

Nixpacks Configuration with Custom System Packages

Problem: Applications requiring system packages (e.g. ffmpeg, graphicsmagick) fail to build on standard container buildpacks.

Solution: Specify custom runtime packages in nixpacks.toml:

[phases.setup]
nixPkgs = ["nodejs-20_x", "ffmpeg", "openssl"]

[phases.build]
cmds = ["npm run build"]

[start]
cmd = "npm start"

Best Practices

Do:

  • Use Railway Private Networking (*.railway.internal) for service-to-service communication.
  • Define an explicit healthcheckPath in railway.json to enable zero-downtime rolling deployments.
  • Enable PR environments to test database migrations and frontend changes in isolated stacks.
  • Utilize Nixpacks for automatic dependency and runtime version detection.

Don't:

  • Expose databases publicly when microservices reside within the same Railway project.
  • Commit .env files; use Railway's encrypted environment variables dashboard or CLI.
  • Store persistent file uploads on the service container filesystem; use S3, R2, or Railway Volume mounts.

Troubleshooting

ErrorCauseSolution
Deploy failed: Process did not listen on $PORTWeb service hardcoding port instead of dynamic Railway $PORT.Bind web server to dynamic port: process.env.PORT || 3000.
Database connection timeout in productionService connecting using public database proxy URL inside the same Railway project.Use private internal DNS host provided by Railway for zero latency and free egress.
Railway CLI: UnauthorizedProject token or user token missing.Run railway login or export RAILWAY_TOKEN.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.