Help us improve
Share bugs, ideas, or general feedback.
From railway-deployer
Railway.app deployment patterns, environment management, and production best practices. Applied automatically when working with Railway deployments.
npx claudepluginhub joshuarweaver/cascade-code-devops-misc-2 --plugin leanentropy-civax-cc-agentsHow this skill is triggered — by the user, by Claude, or both
Slash command
/railway-deployer:skills/railway-deploymentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Railway is a modern PaaS that deploys applications from Git repositories with automatic builds and deployments.
Manages Railway PaaS deployments via CLI for creating services, infrastructure, networking config, environment variables, logs, and SSH debugging.
Validates and deploys Node.js, Python, or Docker apps to Railway with environment variables, custom domains, and monitoring.
Operates Railway infrastructure: create projects, provision services and databases, manage object storage buckets, deploy code, configure environments and variables, manage domains, and troubleshoot failures via the Railway CLI.
Share bugs, ideas, or general feedback.
Railway is a modern PaaS that deploys applications from Git repositories with automatic builds and deployments.
Railway automatically deploys when you push to configured branches:
| Branch | Environment | Trigger |
|---|---|---|
develop | Staging | Push to develop |
main | Production | Push to main |
project/
├── frontend/
│ ├── Dockerfile
│ └── package.json
├── backend/
│ ├── Dockerfile
│ └── requirements.txt
└── railway.json
project/
├── Dockerfile (or detected runtime)
├── package.json / requirements.txt
└── railway.json (optional)
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "Dockerfile"
},
"deploy": {
"numReplicas": 1,
"healthcheckPath": "/health",
"healthcheckTimeout": 300,
"restartPolicyType": "ON_FAILURE"
}
}
# Multi-stage build for smaller images
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/index.js"]
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
RAILWAY_ENVIRONMENT=production
RAILWAY_SERVICE_NAME=backend
RAILWAY_PROJECT_ID=xxx
PORT=<assigned port>
ENVIRONMENT=production
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
API_KEY=xxx
CORS_ORIGINS=https://myapp.com
Railway performs health checks to ensure your app is running:
# FastAPI example
@app.get("/health")
async def health_check():
return {"status": "healthy"}
// Express example
app.get('/health', (req, res) => {
res.json({ status: 'healthy' });
});
Services within the same project can communicate via internal DNS:
http://backend.railway.internal:8000
*.up.railway.app domains# Via CLI
railway logs
railway logs --environment production
railway logs -n 100 # Last 100 lines
# Via Dashboard
Project → Service → Logs tab
import logging
import json
logging.basicConfig(
format='%(message)s',
level=logging.INFO
)
def log_json(level, message, **kwargs):
log_entry = {"message": message, **kwargs}
getattr(logging, level)(json.dumps(log_entry))
// railway.json
{
"deploy": {
"numReplicas": 3
}
}
Configure in Railway Dashboard:
For production, use connection pooling:
# SQLAlchemy with pool
engine = create_engine(
DATABASE_URL,
pool_size=5,
max_overflow=10,
pool_pre_ping=True
)
Configure alerts in Railway Dashboard for:
git revert HEAD
git push origin main
# Railway auto-deploys reverted code
| Symptom | Check |
|---|---|
| Build fails | Dockerfile syntax, dependencies |
| Deploy hangs | Health check endpoint, startup time |
| 502 errors | App not binding to PORT env var |
| Slow performance | Resource limits, database queries |
| Missing env vars | Railway Dashboard → Variables |