Awesome-omni-skill railway
Railway deployment and infrastructure management skill. This skill should be used when deploying applications to Railway, managing Railway services, checking deployment status, viewing logs, configuring environment variables, or troubleshooting Railway deployments.
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/devops/railway" ~/.claude/skills/diegosouzapw-awesome-omni-skill-railway-95b0ba && rm -rf "$T"
skills/devops/railway/SKILL.mdRailway Deployment Skill
This skill provides workflows and knowledge for deploying and managing applications on Railway.
Overview
Railway is a modern cloud platform for deploying applications. This skill integrates with the Railway MCP tools to provide deployment, monitoring, and management capabilities.
Prerequisites
Before using Railway MCP tools:
- Install Railway CLI: https://docs.railway.com/guides/cli
- Authenticate: Run
in terminalrailway login - Link project: Run
in the project directoryrailway link
Available MCP Tools
| Tool | Purpose |
|---|---|
| Verify CLI is installed and authenticated |
| List all Railway projects for the account |
| List services in the linked project |
| List deployments with status and metadata |
| Show environment variables for a service |
| Set environment variables |
| Get build or deployment logs |
| Upload and deploy from local directory |
| Generate a Railway domain for the service |
| Link to a specific Railway service |
| Link to a specific Railway environment |
| Create a new Railway environment |
| Create and link a new Railway project |
| Search and deploy Railway templates |
Deployment Workflow
First-Time Setup
-
Verify CLI authentication:
Use check-railway-status to confirm Railway CLI is logged in -
Link project (if not linked):
- User runs
in terminalrailway login - User runs
in the project directoryrailway link - Or use
for new projectscreate-project-and-link
- User runs
-
Configure root directory (for monorepos):
- If app is in a subdirectory (e.g.,
,web/
,app/
), configure in Railway Dashboard:frontend/ - Service → Settings → Source → Root Directory
- If app is in a subdirectory (e.g.,
Deployment Process
-
Check current status:
list-deployments with json=true to see recent deployment statuses -
If deployment failed, check logs:
get-logs with logType="build" and the failed deploymentId -
Common build failures:
- Missing root directory configuration (monorepos)
- Syntax errors in code
- Missing dependencies
- Invalid environment variables
-
Deploy changes:
- Push to GitHub (auto-deploy if connected)
- Or use
tool for manual deploymentdeploy
Environment Variables
-
View current variables:
list-variables with json=true -
Set new variables:
set-variables with variables array like ["KEY=value", "KEY2=value2"] -
Common patterns:
- Next.js client-safe public variablesNEXT_PUBLIC_*
- Database connection stringDATABASE_URL
- API keys (server-side only)*_API_KEY
Domain Configuration
-
Generate Railway domain:
generate-domain to get a *.up.railway.app domain -
Custom domains:
- Configure in Railway Dashboard: Service → Settings → Public Networking
- Add CNAME record at DNS provider pointing to Railway domain
Framework-Specific Configuration
Next.js
railway.toml (place in app root):
[build] builder = "nixpacks" [deploy] startCommand = "npm run start" healthcheckPath = "/" healthcheckTimeout = 300 restartPolicyType = "ON_FAILURE" restartPolicyMaxRetries = 10
NestJS + Prisma
railway.toml:
[build] builder = "nixpacks" buildCommand = "npx prisma generate && npx prisma migrate deploy && npm run build" [deploy] startCommand = "node dist/main.js" healthcheckPath = "/health" healthcheckTimeout = 300 restartPolicyType = "ON_FAILURE" restartPolicyMaxRetries = 10
Node.js/Express
railway.toml:
[build] builder = "nixpacks" [deploy] startCommand = "node server.js" healthcheckPath = "/health"
Python/FastAPI
railway.toml:
[build] builder = "nixpacks" [deploy] startCommand = "uvicorn main:app --host 0.0.0.0 --port $PORT" healthcheckPath = "/health"
Python/Django
railway.toml:
[build] builder = "nixpacks" buildCommand = "python manage.py collectstatic --noinput" [deploy] startCommand = "gunicorn myproject.wsgi --bind 0.0.0.0:$PORT" healthcheckPath = "/health"
Troubleshooting
"Railpack could not determine how to build"
Cause: Root directory not set for monorepo structures.
Fix: Set Root Directory in Railway Dashboard → Service → Settings → Source.
Build Syntax Errors
Cause: Code pushed with syntax errors.
Fix:
- Check build logs:
withget-logslogType="build" - Fix the error locally
- Push the fix to trigger new deployment
Missing Environment Variables
Cause: Required environment variables not set.
Fix:
- Check current vars:
list-variables - Set missing vars:
set-variables
Domain Not Working
Cause: DNS not configured or not propagated.
Fix:
- Verify CNAME record points to Railway domain
- Wait for DNS propagation (up to 72 hours)
- Check Railway Dashboard for verification status
Port Configuration
Railway automatically provides a
PORT environment variable. Ensure your application listens on 0.0.0.0:$PORT.
Node.js:
const port = process.env.PORT || 3000; app.listen(port, '0.0.0.0', () => console.log(`Listening on ${port}`));
Python:
import os port = int(os.environ.get("PORT", 8000))
Custom Domain Setup by Provider
Cloudflare (Recommended)
- Add CNAME record:
→ Railway domain@ - Enable Cloudflare proxy (orange cloud)
- Set SSL/TLS to "Full" (not Full Strict)
- Enable Universal SSL
GoDaddy / Providers Without CNAME Flattening
GoDaddy and some providers don't support CNAME flattening for root domains. Options:
- Use subdomain:
orwww.domain.com
with CNAME recordapp.domain.com - Migrate DNS to Cloudflare: Change nameservers in registrar
- Use forwarding: Forward root to www subdomain
Standard CNAME Setup
For subdomains on any provider:
- In Railway: Add custom domain (e.g.,
)app.yourdomain.com - Copy the CNAME target (e.g.,
)abc123.up.railway.app - In DNS: Add CNAME record pointing subdomain to Railway target
- Wait for verification in Railway Dashboard
Multi-Service Projects (Full Stack)
For projects with frontend + backend + database:
Architecture
Railway Project ├── Frontend Service (Next.js) → goteammate/nextjs-template ├── Backend Service (NestJS) → goteammate/nestjs-template └── PostgreSQL Database → Railway Postgres template
Setup via MCP Tools
— Create the Railway projectcreate-project-and-link
with "PostgreSQL" — Add databasedeploy-template- Connect GitHub repos for frontend and backend services
— Wireset-variables
,DATABASE_URL
,NEXT_PUBLIC_API_URLFRONTEND_URL
— Create domains for each servicegenerate-domain
Auto-Wired Variables
| Variable | Service | Source |
|---|---|---|
| Backend | Railway Postgres reference |
| Both | Railway auto-provides |
| Backend | Frontend Railway domain |
| Frontend | Backend Railway domain |
| Frontend | Frontend Railway domain |
Bootstrap Shortcut
Use the
new-project skill in teammate-ops to automate the entire multi-service setup from a single conversation.
Project Configuration Template
After importing this skill, add project-specific details to your local skill copy:
## Project Configuration - **Project Name:** [Your Project] - **Project ID:** [from Railway Dashboard] - **Environment ID:** [from Railway Dashboard] - **Service ID:** [from Railway Dashboard] - **Root Directory:** [e.g., web/, app/, or /] - **Custom Domain:** [if configured] - **Dashboard URL:** https://railway.com/project/[project-id] ### Required Environment Variables | Variable | Description | |----------|-------------| | ... | ... |