Skip to content

0010 — Remove the gaming/fantasy and affiliate domains

Status: accepted (2026-08-10). Supersedes 0003.

Context

ADR 0003 kept the fantasy modules and MongoDB because other clients might still depend on the fantasy endpoints. A year on, the evidence says nothing does: every gaming table in production (contests, contest_entries, contest_templates, all pop_*, prediction_orders, prediction_trades, final_results) had zero rows, production Mongo held a single empty collection (user_teams), and no frontend in this repo — mobile app, website, admin portal, accounting portal — ever shipped a gaming screen. The legacy fantasy clients point at the old server (api.aim11.in), not this deployment. The affiliate program was equally dead weight: its earnings model was 100% contest-commission (affiliate_earnings.contest_id NOT NULL), so with contests gone no earnings row could ever be written again, and production had zero affiliates, earnings, or link clicks.

The owner directed removal of the entire gaming surface (contest join, contests, leaderboards, matches/series/teams, POP, predictions) and, during the work, the affiliate program as well.

Decision

Delete both domains end to end:

  • Backend — 8 gaming handlers, the Mongo/Redis-leaderboard repo packages, 4 gaming Postgres repos, the scoring service, pkg/entity / pkg/fantasy / pkg/teamrules, the 4 background sync/poll goroutines, the seed job, the Roanuz webhook receiver, the affiliate + KYC-document handlers/repos, and every related route. ENTITY_ACCESS_TOKEN is no longer read (boot no longer requires a gaming secret). MongoDB is removed from the stack entirely.
  • Database — tracked migration scripts/postgres/migrations/064_drop_gaming_and_affiliates.sql drops all gaming tables/functions/triggers, the affiliate tables, and the users.team_name / users.affiliate_id / users.referred_by columns. The boot migrations in internal/migrate no longer recreate gaming objects. Legacy migration files stay on disk untouched (the freeze test forbids editing history); wallet_ledger rows with gaming txn_types are kept for audit continuity.
  • GuardsTestRouteSurfaceFrozen gains retiredRoutePrefixes, an explicit reviewed allow-list of removed route families, mirroring deliberateCommerceAdditions; the baseline golden remains frozen so any OTHER route disappearance still fails.
  • Kept deliberately — the daily spin and claims flows (commerce wallet features), wallets.free_points/cash/rewards columns (claims still convert rewards; retiring the currencies is its own decision), and historical ledger rows.

Consequences

  • The production stack is two data stores (Postgres, Redis). aim_mongo and its volume are removed from compose; deploy/backup workflows no longer mongodump.
  • A commerce-only deployment needs no gaming secret to boot.
  • Old API images cannot run against a database where 064 has been applied (their boot migration does ALTER TABLE contests … fail-closed). Deploy order is therefore: new image first, then 064 via apply-migrations.sh — the order the deploy workflow already uses. Rollback of this release means restoring a pre-064 backup, not rollback_064.sql (none exists).
  • If a fantasy product ever returns, it starts from the old server's codebase or git history (git log before this change), not from dormant code.