Skip to content

Host the game server on Fly.io and its database on Neon

Context and problem

Online play needs the game server (rust/canasta-server) and its Postgres hosted (#50). The server keeps every table in its own memory, one task per table, so it must run as exactly one process that never sleeps, and players hold WebSockets open the whole game. The browser’s refresh cookie is SameSite=Strict, so the server must sit on the same site as the web client at play.homefelt.io. It is a family-and-friends game: cost and upkeep matter more than scale.

Options considered

  1. Fly.io + Neon. One small always-on Fly machine from a Docker image, with TLS, secrets and a custom domain; managed Postgres on Neon, which scales to zero between games. About $3–10 a month, almost no upkeep; two accounts.
  2. Fly.io for both. The same server plus Fly’s Managed Postgres. One bill, but its smallest plan is about $38 a month for high availability a family game does not need.
  3. Railway. Server and Postgres in one place, the quickest setup. Billed by use above a $5 plan, with fewer region choices.
  4. Hetzner VPS. The cheapest (about $6 a month), but Eduardo would run the OS, Postgres, backups and certificates himself, and Hetzner reported limited new cloud capacity in 2026.

Render was ruled out early: its cheap tier sleeps, which drops every WebSocket.

Decision

We chose Fly.io + Neon, decided by Eduardo on 25 November 2026. The server runs as the Fly app homefelt-api (fly.toml, image rust/canasta-server/Dockerfile), one shared-cpu-1x machine with 512 MB in iad (Ashburn, US East), never scaled out and deployed with the rolling strategy only. It answers at https://api.homefelt.io. Postgres is a Neon project in AWS US East (N. Virginia), reached on its direct (not pooled) endpoint over TLS. The web client stays on Vercel at play.homefelt.io, built with VITE_SERVER_URL=https://api.homefelt.io. The client IP for per-IP limits comes from Fly’s Fly-Client-IP header (HOMEFELT_CLIENT_IP_HEADER).

Consequences

Good

  • No server to look after: Fly restarts the machine, renews the certificate and keeps the secrets; Neon keeps backups and point-in-time restore.
  • Low cost at family scale, and the same Docker image runs on any other host if we move.

Bad

  • One machine is a single point of failure, and each deploy takes the server offline for a few seconds (tables are saved first and load again when players reconnect).
  • Neon pauses after a few idle minutes, so the first save after a quiet spell waits a moment.
  • Growing past one machine means moving tables out of process memory first.

More information