MyAppAffiliate

Go-Live & Deploy

From zero to tracking a real app.

1. Deploy the API (public HTTPS)

The API ships with a Dockerfile + fly.toml + render.yaml. Fly (no GitHub needed):

Shell
cd .
brew install flyctl && fly auth login
fly launch --no-deploy
fly secrets set DATABASE_URL="<pooled Neon URL>" API_CORS_ORIGINS="*"
fly deploy && fly open /health

Use the pooled Neon URL (host has -pooler) for runtime; migrations run automatically as the release step. Render/Railway alternatives are in the repo's docs/18-deployment.md.

The prototype API is already live at https://maa-api-cccf50.fly.dev.

2. Onboard your app

Shell
APP_NAME="YourApp" BUNDLE_ID="com.you.app" CODE="YOURCODE" \
API_BASE_URL="https://<your-api>" pnpm --filter @maa/api onboard

Prints (once): appId, SDK key, RevenueCat webhook URL + Authorization secret, and your referral code.

3. Integrate the SDK

See SDKs (e.g. iOS): configureapplyCode / attribute(url:)identify → RevenueCat affiliate_id pass-through. Web SaaS product? Follow the Web SaaS guide instead.

4. Configure RevenueCat

See Webhooks: set the webhook URL + Authorization secret, and make sure logIn uses the same user id as identify.

To make …/<appId>/<code> links attribute automatically:

  1. Deploy the link Worker (apps/links, wrangler deploy); set LINKS_API_BASE_URL and APPLE_APP_ID (TEAMID.bundleid).
  2. Host the AASA (the Worker serves /.well-known/apple-app-site-association).
  3. Add the Associated Domains capability in Xcode: applinks:<your-link-domain>.
  4. Handle the URL with AffiliateSDK.attribute(url:).

The referral-code path needs none of this and works immediately.

6. Verify

Make a sandbox purchase → RevenueCat webhook fires → a commission appears on the dashboard. Or rehearse without a device: pnpm --filter @maa/api smoke.