Skip to content

All projects

2025 to Now · Production · Telegram Mini App

Dragon Farm

A farming game rebuilt from scratch across four repositories and three servers, then moved off AWS onto hardware I own end to end.

  • Next.js 16
  • React 19
  • FSD
  • NestJS 11
  • Prisma 7
  • PostgreSQL 17
  • Redis
  • Terraform
  • Ansible
  • Prometheus
downtime on the AWS to Hetzner move
7 min
monthly infrastructure bill
$546 to $140
measured restore, from zero to matching data
17 min
Prometheus alert rules in production
29

What I walked into

A live game on AWS: EKS, Helm, Traefik and Aurora Serverless v2, costing about $546 a month. The backend was 27,378 lines of Python and FastAPI with roughly two per cent test coverage, and its own audit later produced eight critical findings, including a live double-purchase race on a FOR KEY SHARE lock.

The brief was a full frontend redesign. The real problem was that nobody could safely change anything underneath it.


What I changed, and why

  1. Strangler fig, not a rewrite

    The new NestJS 11 server took traffic route by route while the Python monolith kept serving the rest. No flag day, no frozen feature work.

  2. Auth as four separate doors

    argon2id with a rotating __Host-df_rt refresh cookie whose retired fingerprints are archived. Replaying an old token reads as theft and kills every session that owner holds.

  3. Binary WebSocket protocol

    Game state moves as packed binary rather than JSON. Fewer bytes per tick, and the shape of a message is a contract rather than a convention.

  4. Monitoring on its own machine

    Prometheus, Alertmanager, Grafana and Loki live on a separate box, so a dead server cannot also silence the alarm about itself. A cross-machine watchdog reaches Telegram without going through the stack.

  5. Backups that were actually restored

    Encrypted nightly archives outside the cloud account, and a rehearsal that brought the game API up with matching row counts 17 minutes from zero.

The migration took seven minutes of downtime. The rehearsal that made those seven minutes possible took three weeks.

Where it landed

Production moved to Hetzner on 2 August 2026 with seven minutes of downtime, and the AWS account was drained and closed. The monthly bill fell from about $546 to roughly $140.

The client is now on Next.js 16 and React 19 with Feature-Sliced Design across 213 TypeScript files, six locales written by hand without an i18n library, and Lighthouse at 100 on desktop and 86 on mobile. Port 22 is closed to the internet; all SSH runs over a private Tailscale network between the three machines.