Railway.app deployment patterns, environment management, and production best practices. Applied automatically when working with Railway deployments.
Provides Railway deployment patterns, environment variables, and Dockerfile best practices. Automatically applied when you configure Railway deployments or troubleshoot app hosting.
/plugin marketplace add LeanEntropy/civax-cc-agents/plugin install railway-deployer@civax-cc-agentsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
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 |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.