Skip to content

Hosting comparison and recommendation

Decision record: ADR 0011, amended by ADR 0028: production starts on a single VPS (infra/vps/, runbooks (docs/runbooks/README.md)), and AWS comes later. The comparison below still holds for that move.

Workload Shape Notes
Web app + API Request/response, SSR Stateless; scales horizontally
Published games Static files (JS, images, audio) Largest cost driver at scale: bandwidth
Play origin Static + strict headers on a separate domain Needs its own CDN distribution/cert
Database PostgreSQL Users, games, versions, packs, moderation, money ledger, events
Object storage Blobs: builds, assets, screenshots, version snapshots S3 API
Background jobs Builds, validation, screenshots, headless runs Long-running, needs headless Chromium, must be isolated
MCP over HTTP Streaming, long-lived requests Streamable HTTP
Multiplayer (Phase 6) Long-lived WebSocket processes Stateful

CloudFront + S3 (static/games) · API Gateway (HTTP API) + Lambda running Hono · Aurora Serverless v2 PostgreSQL (+ RDS Proxy) · SQS + Lambda for jobs, Fargate tasks for Chromium/builds · Cognito or Better Auth · API Gateway WebSockets or Fargate for multiplayer.

Supabase (Postgres, auth, storage, realtime) + Cloudflare (Workers for API/SSR, R2 for game assets with zero egress fees, Pages/CDN) — or Vercel for the web app. Jobs: Cloudflare Queues + a container service for Chromium builds.

The same Docker images used locally, on AWS ECS Fargate behind an ALB · RDS PostgreSQL · S3 · CloudFront (two distributions: platform and play origin) · worker service on Fargate (Spot for builds/headless runs) · Secrets Manager · AWS CDK. Alternative container hosts with the same images: Fly.io, Render, Railway, Google Cloud Run.

Criterion A. AWS serverless B. BaaS (Supabase + Cloudflare) C. Containers on AWS
Ease of implementation (solo) 2 — many services, IAM, VPC + Lambda + RDS Proxy 5 — fastest to first deploy 4 — one image per service, CDK templates
Local-to-cloud parity 2 — Lambda/APIGW emulation is imperfect 3 — Supabase CLI runs locally; Workers runtime differs from Node 5 — identical images, Compose → ECS
Fit for headless Chromium, sandboxed builds, WebSockets 2 — Lambda limits (15 min, package size, no long-lived sockets) 2 — needs a second provider for containers 5
Scalability 5 4 4 — autoscaling services; DB is the limit in all options
Performance 4 — cold starts on API 5 — edge everywhere 4 — warm containers; CDN for assets
Cost at 100 players 5 5 3 — fixed floor
Cost at 1M players 3 5 — R2 zero egress 4 (3 with CloudFront pay-as-you-go, 4–5 with R2 or a flat-rate CDN plan)
Lock-in 2 2 4 — portable to any container host
Total 25 31 33

Cost estimates (USD / month, infrastructure only)

Section titled “Cost estimates (USD / month, infrastructure only)”
  • A monthly player plays 4 sessions/month. ~1% of players are creators.
  • First load of a game ≈ 5 MB (compressed); 50% of session loads hit the browser cache → ~10 MB egress per player/month. Platform pages/API add ~1 MB per player/month.
  • ~50 API calls per session (batched analytics, saves, leaderboards) → 200 calls per player/month.
  • Creators trigger builds/headless runs: ~20 job-minutes per creator per month.
  • Excluded: AI inference (BYOK; a platform-paid tier is priced separately), multiplayer servers (Phase 6), email, domains, monitoring SaaS, support/staff, taxes. Figures are list prices from 2025–26, us-east-1 / USD, rounded, and should be treated as ±50% planning numbers to re-check at Phase 7.
Volume 100 players 10,000 players 1,000,000 players
Egress ~1 GB ~110 GB ~11 TB
API calls ~20k ~2M ~200M (≈ 80 req/s avg, ~400 req/s peak)
Job minutes ~20 ~2,000 ~200,000
Option 100 players 10,000 players 1,000,000 players
A. AWS serverless $5–25 — Lambda/APIGW in free tier; Aurora Serverless v2 with auto-pause or a t4g.micro RDS; S3/CloudFront in free tier $60–150 — Aurora ~0.5–2 ACU avg; APIGW + Lambda ~$5; Fargate jobs ~$10 $2,000–3,000 — Lambda + APIGW ~$350; Aurora ~8 ACU avg + I/O ~$800; RDS Proxy ~$100; CloudFront 11 TB ~$900; jobs ~$150; WAF/logs ~$100
B. Supabase + Cloudflare $0–30 — free tiers (Supabase free projects pause when idle; Pro $25 for always-on) $40–100 — Supabase Pro + small compute; Workers paid $5; R2 storage $800–1,500 — Supabase Team + larger compute ~$700–1,000; Workers ~200M req ~$60; R2 egress $0 + ops/storage ~$50; container provider for jobs ~$150
C. Containers on AWS $50–70 — 2 small Fargate tasks ~$18; ALB ~$18; RDS t4g.micro ~$15; public subnets (no NAT gateway) $100–180 — Fargate ~$40; ALB ~$22; RDS t4g.small ~$30; Fargate Spot jobs ~$10; S3/CloudFront ~$5 $1,600–2,500 with CloudFront pay-as-you-go — Fargate 6–10 tasks ~$300; ALB ~$60; RDS Multi-AZ m-class + read replica ~$650; jobs (Spot) ~$100; CloudFront ~$900; misc ~$100. $900–1,600 if game assets are served from Cloudflare R2 or a CloudFront flat-rate plan

Observations:

  • Bandwidth dominates at 1M players. Keep game bundles small (the framework’s size budget matters financially) and serve published game assets from the cheapest egress available. The BlobStore/PLAY_ORIGIN config makes switching that one piece to R2 a configuration change.
  • The database is the next largest line in all options; read replicas and caching catalog pages at the CDN keep it modest.
  • Option C’s floor (~$50–70/month) is the price of parity. For a private staging environment, the same Compose file can run on a single small VM (~$10–20/month).

Option C — containers. Docker Compose locally; the same images on ECS Fargate + RDS + S3 + CloudFront in production; infrastructure in AWS CDK (TypeScript). It scores best on the criteria that are hardest to change later (local parity, fit for headless Chromium/sandboxed builds/WebSockets, lock-in) and is within ~1.5× of the cheapest option at every scale. Two hedges are designed in: (1) published game assets can move to R2 or a flat-rate CDN plan by config; (2) the Hono API can also run on Lambda/Workers if a serverless edge API is ever needed.

Terminal window
docker compose up

starts: postgres, s3 (S3-compatible store), api-web (Hono + React Router SSR), worker (pg-boss jobs, Playwright), play (static server for the play origin on play.localhost with production-identical headers) and optionally ollama for a local model. Framework and game work does not need Docker: pnpm dev runs Vite with hot reload.

Local (Compose service) Cloud (CDK construct) What changes
postgres RDS PostgreSQL DATABASE_URL
s3 S3 buckets S3_ENDPOINT unset, IAM role instead of keys
api-web ECS service behind ALB + CloudFront image tag, env vars
worker ECS service (Fargate Spot), autoscale on queue depth image tag, env vars
play S3 + CloudFront distribution on the user-content domain with response-header policy PLAY_ORIGIN
.env Secrets Manager / SSM secret references