Summary: A Go AWS Lambda in the Gymondo-git org that answers the 7Mind app’s and website’s old API on magic.7mind.* by calling Gymondo services. It owns no data and has been the 7Mind backend as clients see it since the 2026-09-14 cutover.
Sources: direct code inspection (README.md, docs/, docs/superpowers/specs/, internal/, cmd/, .github/workflows/), git log; origin/main read on 2026-11-09 (README “The content catalogue” and “Failure posture”, internal/routes/routes.go, internal/domain/backoffice/, commit 8905d51, git log to 2026-11-06); Gymondo-git/terraform (workspaces apps, service-cloudfront; apps service-prod.tfvars read on 2026-11-09); archive status of the Gymondo-git service-* repos
Last updated: 2026-11-09
Purpose
7Mind was folded into the Gymondo platform (see platform-unification). Installed 7Mind app builds and the 7Mind website expect the old Elixir endpoints, paths, payloads and error shapes. This gateway answers exactly those contracts and fulfils them by calling Gymondo services, translating in both directions. It is the replacement for elixir-backend from the client’s point of view.
GitHub: Gymondo-git/function-sevenmind-legacy-gateway. Main author Alejandro Peña de Alba (Gymondo). Gymondo tickets are TP-5xx; 7Mind tickets MIND-* also land here.
Stack
- Go, deployed as an AWS Lambda (
eu-central-1), invoked by Kong with API Gateway v1 events - Stdlib table tests,
httptestfor live sources,golangci-lint - Credentials in AWS Secrets Manager (
SECRET_NAME); environment variables override
Key Files / Entry Points
README.md— the authoritative endpoint table, upstream list, configuration, and the frozen-client rules. Read it before changing anythingcmd/function-sevenmind-legacy-gateway/— Lambda entry pointcmd/legacy-uuid-pack/— builds the embedded UUID index from the migration CSVinternal/routes/,internal/domain/— route table and per-domainHandler -> Service -> Sourcelayers (each domain has a live and a stub source)internal/upstream/— the shared HTTP client for all Gymondo calls (header propagation, error normalisation)internal/legacyuuid/legacy_uuid.bin— 64 MB index of 3,200,320 old UUID to Gymondo id rows, committed on purposeinternal/catalogue/,internal/entitlement/— content catalogue and entitlement filteringinternal/domain/backoffice/— course and single title lookups for the Gymondo customer-service backofficeinternal/billingperiod/— derives billing periods and display names from SKUs, including legacy Chargebee SKUsdocs/history-delta-runbook.md,docs/prevention-entitlement-map.md,docs/superpowers/specs/— design docs and runbooks for each migrated domain
Deployment
- Manual
Buildworkflow dispatch in GitHub Actions (callsGymondo-git/actionsfunction.yaml), which runsaws lambda update-function-codefor test or prod. It ships only the binary. - CloudFront behaviours, Kong routes and environment variables live in Gymondo-git/terraform and are applied separately. A path is reachable only if all three layers (CloudFront, Kong, this Lambda) allow it.
- PR tests run in
.github/workflows/test.yaml. - Hosts:
magic.7mind.*(prod: .de, .app, .fr, .it, .es, .ca, .co.uk) andmagic.6mind.de/magic.6mind.app(test). - Every response carries
x-gateway-source: live|stub.
Dependencies
Behind the private Kong host (UPSTREAM_BASE_URL): function-sso (sign-in, sign-up, password reset send and confirm, each on its own private route), Gymondo user service and function-user (profile, scheduled deletion), subscriptions, statistics, function-target (streaks), favourites, partner, voucher, and the prevention store. The /service-subscription, /service-statistic and /service-favorite paths it calls are Kong route prefixes that kept the old service names. Statistics and favourites are served by the function-statistic and function-favorite Lambdas. The service-statistic, service-favorite and service-subscription repos are archived; subscription code is in function-subscription.
Direct hosts:
- 7Mind content: the S3 catalogue artifact built by the catalogue builder Lambda (test since 2026-09-24, prod since 2026-10-05, TP-587). There is no runtime fallback. Since 2026-10-07 (TP-606) a gateway that cannot load the artifact refuses to start, and an alarm fires; a failed background refresh keeps serving the artifact it already has. The Elixir backend’s
/gateway/content/*channel ongateway.7mind.deis now only the reference for the parity tests. Two places still call it a fallback: the README’s upstream section and a comment in the terraform tfvars. The README’s “Failure posture” section and commit 8905d51 describe the current state - Aury (
AURY_BASE_URL) for the AI companion session. See aury-companion - Barmer API (
BARMER_API_BASE_URL) to verify Barmer insurees service-event-broker(EVENTBROKER_BASE_URL) for Mondia lifecycle notifications- Algolia, to mint scoped search keys
Internal: gymondo-platform services listed above; elixir-backend only as the parity reference for content, never called at runtime.
Integration Points
- 7mind-mobile-apps-monorepo: identity, content, favourites, practice history and stats, prevention, AI companion, search config, subscription status
- website-next-js: identity (since TP-570, 2026-09-07), subscription status, insurance activations, Mondia redeem pages
- Partners: Mondia webhooks
- Customer service:
GET /backoffice/content/course/:courseIdandGET /backoffice/content/single/:singleIdresolve 7Mind course and single titles for the Gymondo backoffice (since 2026-10-07). They are mounted without the identity middleware, because the agent carries no 7Mind app identity; Kong’s backoffice ingress (/~/backoffice/content/.*) is the gate. A missing entry answers 404. The README endpoint table does not list them yet - Not served, on purpose or not yet: ZPP certificate routes (still on GCP),
/monetization/coupon/resolve(parked),/insurances/dak/activate, Chargebee portal and gift routes./monetization/free_trial/activateanswers 200 but grants nothing
Conventions
- The old app is frozen; its behaviour is a hard constraint. Never answer 401 or 403 (the app deletes its session and logs the user out permanently): refusals are 404, conflicts 409, upstream faults 502. Every non-2xx body is a JSON error envelope, because the app casts every error body to a map. Upstream bodies are never relayed (they can contain the caller’s email). The README says the app “will not be updated”; in practice new app versions still ship, but old installs must keep working, so the rule stands.
- Identity travels as headers. Only
Accept-Language,X-Request-Id,X-Id-Token,User-AgentandX-Forwarded-Hostare forwarded, plus aBearerderived from the id token.X-Refresh-Tokenis not forwarded. See gymondo-sso-auth. - Insurance activations redeem a voucher (one code per flow, nine
INSURANCE_VOUCHER_*secrets). Entitlement is read from roles and package slugs, not from purchases, because migrated users have no Gymondo purchase rows. The grant is asynchronous: subscription status updates about ten seconds after the 204. - The content host must never be a
magic.*host. Aftermagic.*was repointed at Gymondo, a content fetch to it would loop back into the gateway; this broke all content screens on test on 2026-09-08. - Live sources fail at startup by name if their URL or credential is missing. Add new secrets before deploying code that needs them.
- Analytics:
/analytics/anonymizedwas the one route proxied verbatim to Elixir; since TP-602 (2026-10-05) anonymous website analytics go straight to Rudderstack. make test,make lint(must report 0 issues),make legacy-uuid-index CSV=.... The CSV is PII and is not in the repo.
Agent Change Log
2026-10-06 — note created during the wiki update for the Gymondo backend migration
2026-11-09 — content fallback removed (TP-606), backoffice content routes added, service-* upstream names explained as Kong prefixes