deploy-railway
Deploy to Railway
Why Railway?
- Zero config deployments
- Automatic HTTPS
- Built-in databases
- Environment management
- Preview environments
Quick Start
# Install CLI
npm install -g @railway/cli
# Login
railway login
# Initialize project
railway init
# Deploy
railway up
Configuration
railway.json
{
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "npm start",
"healthcheckPath": "/health",
"restartPolicyType": "ON_FAILURE"
}
}
Environment Variables
# Set variable
railway variables set DATABASE_URL=postgres://...
# Set from file
railway variables set < .env.production
Database Setup
# Add PostgreSQL
railway add --database postgres
# Get connection URL
railway variables get DATABASE_URL
Deployment Workflow
1. Connect Repo
railway link
2. Configure Build
Railway auto-detects most frameworks. Override with:
# Nixpacks (default)
railway up
# Dockerfile
railway up --dockerfile
3. Set Domain
railway domain
Best Practices
- Use Preview Environments: Test PRs before merge
- Separate Databases: Different DB per environment
- Use Variables: Never hardcode secrets
- Health Checks: Enable for reliability
- Logs: Use
railway logsfor debugging
Common Commands
# View logs
railway logs
# Open dashboard
railway open
# Run command in environment
railway run npm run migrate
# List services
railway status
More from nguyenhuuca/assessment
compliance
Ensure regulatory compliance. Use when implementing GDPR, HIPAA, PCI-DSS, or SOC2 requirements. Covers compliance frameworks and controls.
18requirements-analysis
Analyze and refine product requirements. Use when clarifying scope, identifying gaps, or validating requirements. Covers requirement types and analysis techniques.
16security-review
Conduct security code reviews. Use when reviewing code for vulnerabilities, assessing security posture, or auditing applications. Covers security review checklist.
13identity-access
Implement identity and access management. Use when designing authentication, authorization, or user management. Covers OAuth2, OIDC, and RBAC.
12execution-roadmaps
Create execution roadmaps for projects. Use when planning multi-phase projects or feature rollouts. Covers phased delivery and milestone planning.
12cloud-native-patterns
Apply cloud-native architecture patterns. Use when designing for scalability, resilience, or cloud deployment. Covers microservices, containers, and distributed systems.
12