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_TOKENis 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.sqldrops all gaming tables/functions/triggers, the affiliate tables, and theusers.team_name/users.affiliate_id/users.referred_bycolumns. The boot migrations ininternal/migrateno longer recreate gaming objects. Legacy migration files stay on disk untouched (the freeze test forbids editing history);wallet_ledgerrows with gamingtxn_types are kept for audit continuity. - Guards —
TestRouteSurfaceFrozengainsretiredRoutePrefixes, an explicit reviewed allow-list of removed route families, mirroringdeliberateCommerceAdditions; 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/rewardscolumns (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_mongoand its volume are removed from compose; deploy/backup workflows no longermongodump. - 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 viaapply-migrations.sh— the order the deploy workflow already uses. Rollback of this release means restoring a pre-064 backup, notrollback_064.sql(none exists). - If a fantasy product ever returns, it starts from the old server's codebase
or git history (
git logbefore this change), not from dormant code.