Railway / Render / Fly.io Deployment
Expert in deploying to indie-friendly PaaS platforms with optimal cost, autoscaling, and developer experience.
Activation Triggers
Activate on: "Railway deploy", "Render setup", "Fly.io", "indie hosting", "affordable cloud", "PaaS deployment", "side project hosting", "hobby project", "scale to zero"
NOT for: Enterprise K8s → kubernetes-manifest-generator | AWS/GCP IaC → terraform-module-builder | Cloudflare Pages → cloudflare-pages-cicd
Quick Start
- Choose platform — Railway for simplicity, Fly.io for edge compute, Render for free tier services
- Connect repo — Git push deploys with automatic build detection
- Add services — database, Redis, cron jobs from platform marketplace
- Configure scaling — scale-to-zero for cost, autoscale for traffic
- Set custom domain — CNAME to platform, automatic TLS
Core Capabilities
| Domain |
Technologies |
| Railway |
Nixpacks builds, volumes, cron, TCP/HTTP services, templates |
| Render |
Native runtimes, Blueprints (IaC), disk storage, free tier |
| Fly.io |
fly.toml, Machines API, volumes, edge regions, Litefs (SQLite) |
| Databases |
Railway Postgres/MySQL/Redis, Render managed Postgres, Fly Postgres |
| Cost |
Scale-to-zero, usage-based billing, spend alerts |
Architecture Patterns
Platform Decision Matrix
┌──────────────┬────────────┬────────────┬────────────┐
│ Criteria │ Railway │ Render │ Fly.io │
├──────────────┼────────────┼────────────┼────────────┤
│ Ease of use │ Best │ Great │ Good │
│ Free tier │ $5 trial │ Yes (750h) │ Yes (3 VMs)│
│ Scale-to-0 │ Yes │ No (paid) │ Yes │
│ Edge regions │ No │ No │ Yes (35+) │
│ Databases │ Built-in │ Managed PG │ Fly PG │
│ Docker │ Nixpacks │ Dockerfile │ Dockerfile │
│ SQLite │ Volumes │ Disk │ LiteFS │
│ Best for │ Full-stack │ Static+API │ Edge apps │
└──────────────┴────────────┴────────────┴────────────┘
Fly.io Multi-Region with LiteFS
# fly.toml
app = "my-app"
primary_region = "iad"
[build]
dockerfile = "Dockerfile"
[http_service]
internal_port = 3000
auto_stop_machines = "stop" # Scale to zero
auto_start_machines = true
min_machines_running = 0
[mounts]
source = "data"
destination = "/data"
[[vm]]
size = "shared-cpu-1x"
memory = "256mb"
Railway Service Composition
┌─────────────────────────────────────────┐
│ Railway Project │
├─────────────┬────────────┬──────────────┤
│ Web API │ Worker │ Cron │
│ (Node.js) │ (Python) │ (Go binary) │
│ Port 3000 │ No port │ Schedule │
├─────────────┴────────────┴──────────────┤
│ PostgreSQL │ Redis │ S3 (R2) │
│ (Plugin) │ (Plugin) │ (External) │
└─────────────────────────────────────────┘
All services share internal networking.
Environment variables auto-injected for database URLs.
Deploy via `railway up` or Git push.
Anti-Patterns
- Running databases on Fly.io without backups — Fly Postgres is unmanaged. Set up
pg_dump cron or use managed databases (Supabase, Neon) instead.
- Not enabling scale-to-zero — paying for idle compute. Configure
auto_stop_machines on Fly.io or Railway's scale-to-zero for low-traffic services.
- Storing state in ephemeral containers — containers restart and lose local data. Use volumes (persistent disk) or external storage (S3/R2, managed DB).
- Ignoring egress costs — data transfer out can be expensive. Fly.io includes 100GB; Railway meters it. Cache aggressively and compress responses.
- Over-provisioning for hobby projects — starting with 2GB RAM instances for a blog. Start with the smallest tier and scale up based on actual metrics.
Quality Checklist
[ ] Git-push deploy configured and tested
[ ] Health check endpoint defined
[ ] Scale-to-zero enabled for non-critical services
[ ] Database has automated backups (managed or cron pg_dump)
[ ] Custom domain with automatic TLS
[ ] Environment variables set (not hardcoded)
[ ] Spend alerts configured at budget threshold
[ ] Dockerfile optimized (multi-stage, minimal final image)
[ ] Persistent storage on volumes, not ephemeral filesystem
[ ] Preview environments for PRs (Railway/Render)
[ ] Monitoring via platform dashboard or external (Sentry, Axiom)
[ ] Migration strategy documented for platform lock-in escape
1---2name: railway-render-deployment3description: Indie-friendly cloud deployment on Railway, Render, and Fly.io with autoscaling and cost optimization. Activate on: Railway deployment, Render deploy, Fly.io setup, indie hosting, affordable cloud, PaaS deployment, hobby project hosting, side project infrastructure. NOT for: enterprise Kubernetes (use kubernetes-manifest-generator), AWS/GCP infrastructure (use terraform-module-builder), Cloudflare Pages (use cloudflare-pages-cicd).4license: Apache-2.05---6
7# Railway / Render / Fly.io Deployment
8
9Expert in deploying to indie-friendly PaaS platforms with optimal cost, autoscaling, and developer experience.
10
11## Activation Triggers
12
13**Activate on:** "Railway deploy", "Render setup", "Fly.io", "indie hosting", "affordable cloud", "PaaS deployment", "side project hosting", "hobby project", "scale to zero"
14
15**NOT for:** Enterprise K8s → `kubernetes-manifest-generator` | AWS/GCP IaC → `terraform-module-builder` | Cloudflare Pages → `cloudflare-pages-cicd`
16
17## Quick Start
18
191. **Choose platform** — Railway for simplicity, Fly.io for edge compute, Render for free tier services
202. **Connect repo** — Git push deploys with automatic build detection
213. **Add services** — database, Redis, cron jobs from platform marketplace
224. **Configure scaling** — scale-to-zero for cost, autoscale for traffic
235. **Set custom domain** — CNAME to platform, automatic TLS
24
25## Core Capabilities
26
27| Domain | Technologies |
28|--------|-------------|
29| **Railway** | Nixpacks builds, volumes, cron, TCP/HTTP services, templates |
30| **Render** | Native runtimes, Blueprints (IaC), disk storage, free tier |
31| **Fly.io** | fly.toml, Machines API, volumes, edge regions, Litefs (SQLite) |
32| **Databases** | Railway Postgres/MySQL/Redis, Render managed Postgres, Fly Postgres |
33| **Cost** | Scale-to-zero, usage-based billing, spend alerts |
34
35## Architecture Patterns
36
37### Platform Decision Matrix
38
39```
40┌──────────────┬────────────┬────────────┬────────────┐
41│ Criteria │ Railway │ Render │ Fly.io │
42├──────────────┼────────────┼────────────┼────────────┤
43│ Ease of use │ Best │ Great │ Good │
44│ Free tier │ $5 trial │ Yes (750h) │ Yes (3 VMs)│
45│ Scale-to-0 │ Yes │ No (paid) │ Yes │
46│ Edge regions │ No │ No │ Yes (35+) │
47│ Databases │ Built-in │ Managed PG │ Fly PG │
48│ Docker │ Nixpacks │ Dockerfile │ Dockerfile │
49│ SQLite │ Volumes │ Disk │ LiteFS │
50│ Best for │ Full-stack │ Static+API │ Edge apps │
51└──────────────┴────────────┴────────────┴────────────┘
52```
53
54### Fly.io Multi-Region with LiteFS
55
56```toml
57# fly.toml
58app = "my-app"
59primary_region = "iad"
60
61[build]
62 dockerfile = "Dockerfile"
63
64[http_service]
65 internal_port = 3000
66 auto_stop_machines = "stop" # Scale to zero
67 auto_start_machines = true
68 min_machines_running = 0
69
70[mounts]
71 source = "data"
72 destination = "/data"
73
74[[vm]]
75 size = "shared-cpu-1x"
76 memory = "256mb"
77```
78
79### Railway Service Composition
80
81```
82┌─────────────────────────────────────────┐
83│ Railway Project │
84├─────────────┬────────────┬──────────────┤
85│ Web API │ Worker │ Cron │
86│ (Node.js) │ (Python) │ (Go binary) │
87│ Port 3000 │ No port │ Schedule │
88├─────────────┴────────────┴──────────────┤
89│ PostgreSQL │ Redis │ S3 (R2) │
90│ (Plugin) │ (Plugin) │ (External) │
91└─────────────────────────────────────────┘
92
93All services share internal networking.
94Environment variables auto-injected for database URLs.
95Deploy via `railway up` or Git push.
96```
97
98## Anti-Patterns
99
1001. **Running databases on Fly.io without backups** — Fly Postgres is unmanaged. Set up `pg_dump` cron or use managed databases (Supabase, Neon) instead.
1012. **Not enabling scale-to-zero** — paying for idle compute. Configure `auto_stop_machines` on Fly.io or Railway's scale-to-zero for low-traffic services.
1023. **Storing state in ephemeral containers** — containers restart and lose local data. Use volumes (persistent disk) or external storage (S3/R2, managed DB).
1034. **Ignoring egress costs** — data transfer out can be expensive. Fly.io includes 100GB; Railway meters it. Cache aggressively and compress responses.
1045. **Over-provisioning for hobby projects** — starting with 2GB RAM instances for a blog. Start with the smallest tier and scale up based on actual metrics.
105
106## Quality Checklist
107
108```
109[ ] Git-push deploy configured and tested
110[ ] Health check endpoint defined
111[ ] Scale-to-zero enabled for non-critical services
112[ ] Database has automated backups (managed or cron pg_dump)
113[ ] Custom domain with automatic TLS
114[ ] Environment variables set (not hardcoded)
115[ ] Spend alerts configured at budget threshold
116[ ] Dockerfile optimized (multi-stage, minimal final image)
117[ ] Persistent storage on volumes, not ephemeral filesystem
118[ ] Preview environments for PRs (Railway/Render)
119[ ] Monitoring via platform dashboard or external (Sentry, Axiom)
120[ ] Migration strategy documented for platform lock-in escape
121```