DEV Community

Alex Spinov
Alex Spinov

Posted on

Railway Has Free App Deployment — Here's Why Developers Are Choosing It Over Heroku

Heroku killed its free tier. Railway gives you $5/month free — enough to run a hobby project 24/7.

What is Railway?

Railway is a cloud platform that deploys your apps from a Git repo. Push code, Railway builds and deploys. Add databases with one click.

Free Tier

  • $5 free credit/month
  • 512 MB RAM
  • Shared vCPU
  • 1 GB disk
  • Execution time-based billing

Quick Start

# Install CLI
npm install -g @railway/cli

# Login
railway login

# Initialize project
railway init

# Deploy
railway up
Enter fullscreen mode Exit fullscreen mode

Or connect a GitHub repo — Railway auto-deploys on every push.

Add a Database (One Click)

# PostgreSQL
railway add --plugin postgresql

# Redis
railway add --plugin redis

# MySQL
railway add --plugin mysql

# MongoDB
railway add --plugin mongodb
Enter fullscreen mode Exit fullscreen mode

Railway automatically sets DATABASE_URL in your environment.

Deploy Any Framework

Railway auto-detects your framework:

# Node.js / Express / Fastify
# Just push — Railway reads package.json

# Python / Django / Flask
# Railway reads requirements.txt or Pipfile

# Go
# Railway detects go.mod

# Rust
# Railway detects Cargo.toml

# Docker
# Railway reads Dockerfile
Enter fullscreen mode Exit fullscreen mode

Environment Variables

# Set variables
railway variables set NODE_ENV=production
railway variables set API_KEY=secret123

# Reference other services
# ${{ Postgres.DATABASE_URL }} — auto-injected
Enter fullscreen mode Exit fullscreen mode

Custom Domains

railway domain
# Generates: my-app.up.railway.app

# Or add custom domain in dashboard
# CNAME your-app.com → your-project.up.railway.app
Enter fullscreen mode Exit fullscreen mode

Monorepo Support

# railway.toml
[build]
builder = "NIXPACKS"
buildCommand = "cd apps/api && npm install && npm run build"

[deploy]
startCommand = "cd apps/api && npm start"
healthcheckPath = "/health"
restartPolicyType = "ON_FAILURE"
Enter fullscreen mode Exit fullscreen mode

Cron Jobs

# railway.toml
[deploy]
cronSchedule = "0 */6 * * *"  # Every 6 hours
Enter fullscreen mode Exit fullscreen mode

Railway vs Alternatives

Feature Railway Render Fly.io Vercel
Free Credit $5/mo Free tier Free VMs Free (frontend)
Databases 1-click 1-click CLI No (use Neon)
Docker Yes Yes Yes No
Auto-deploy Git push Git push CLI Git push
Monorepo Yes Partial Manual Yes
Sleep No (always on) Spins down Stops N/A

Need to deploy scraping infrastructure? Check out my Apify actors — deployed and managed for you. For custom solutions, email spinov001@gmail.com.

Top comments (0)