Skip to content

0002 — Restore the Go backend from git history

Status: accepted (2026-07-23)

Context

Commit 1120727 ("remove unused API and storage modules") deleted the entire aim-backend/ tree — 115 files, the platform's only API. The mobile app and website still call its /api/v1 surface in production; the new admin portal needs the /api/v1/admin/* routes. The platform cannot ship without a backend.

Alternatives considered:

  • Re-implement the surface in NestJS, mirroring Karat's backend — a familiar stack with an existing blueprint, but the surface is large (auth, wallet, orders, fantasy scoring, predictions orderbook, admin) and a mirror would take weeks to reach parity, with high regression risk on wallet/scoring arithmetic.
  • Fresh Go rewrite — same parity problem without even the blueprint benefit.

Both were rejected for time-to-parity: a byte-for-byte restore reaches parity immediately, because it is the code the shipped clients were built against.

Decision

Restore aim-backend/ from this repository's own history (the 40d8e62 tree), excluding the committed .env (see ADR 0009). Verify it compiles clean on Go 1.25 and keep its module path (github.com/Aimorgcode/Hub/aim-backend) and entrypoint (cmd/api/main.go) unchanged — renaming the module would touch every import for zero behavioural gain.

Consequences

  • Immediate parity with the deployed clients; the restore compiled without modification.
  • The historical module name survives in a repo that no longer matches it — cosmetic debt, accepted.
  • Everything the deleted .env contained is exposed in git history and must be rotated (ADR 0009).
  • New backend work (e.g. POST /auth/admin/login for the portal) builds on the restored code rather than a parallel rewrite.