Skip to content

feat(promote): promoter program + membership trial at /promote - #31

Merged
ralyodio merged 1 commit into
mainfrom
promote-program
Oct 18, 2026
Merged

ralyodio merged 1 commit into
mainfrom
promote-program

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

The Mosh Pit promoter program, live at pit.world/promote — the public destination the promotion push needs. Bring people to the Mosh Pit, keep 20% of everything they spend. Free 30-day trial, then $2/mo for access.

Why it's built this way

  • Attribution without tracking. A referral is recorded only at conversion (startMembership), never per click, and the promoter code rides the URL through sign-in — so no tracking cookie is set, consistent with pit.world's no-cookie posture. A valid, non-self code is credited exactly once.
  • Honest from day one. Commission accrues in a ledger (recordSpend, 20% of a referral's spend) the moment a charge lands, so the dashboard is truthful before payouts are automated.

Surfaces

  • src/promoters.ts — Promoters (own bun:sqlite db): promoters, members (30-day trial), commission ledger.
  • src/promoters-routes.ts — mountPromote: /promote (public offer; shows your link once you join), /r/:code short share link, POST /promote/join, /promote/start (trial opt-in that attributes the referrer), /promote/dashboard (link + referrals + accrued commission).
  • src/server.ts — Deps.promoters, mount after accounts, sitemap, serve() wiring (PIT_PROMOTERS_DB); src/html.ts — /promote in the footer.
  • test/promoters.test.ts — 8 tests (idempotent join, code format, attribution rules, 20% accrual, public routes).

Verification

Full suite 147/147, tsc --noEmit clean, threatcrush scan . --deps --fail-on critical,high,medium clean.

Staged (not here)

The $2/mo recurring CoinPay charge after the trial and automated 20% payout execution — there's no billing primitive in the repo yet (CoinPay is OAuth-only). The 30-day trial is the runway; recordSpend already accrues commission, so wiring billing + a payout run is additive.

🤖 Generated with Claude Code

ThreatCrush-of-affiliates for the Mosh Pit: bring people in, keep 20% of
everything they spend. The public destination the promotion push needs.

- src/promoters.ts — Promoters class (own bun:sqlite db): promoters, members
  (30-day free trial), and a commission ledger. Attribution is recorded only at
  conversion (startMembership), never per click; a valid, non-self referral code
  is credited exactly once. recordSpend accrues 20% when a referral spends.
- src/promoters-routes.ts — mountPromote: /promote (public offer, shows your
  link once you join), /r/:code short share link, POST /promote/join,
  /promote/start (free-trial opt-in that attributes the referrer), and a
  /promote/dashboard with your link, referral count and accrued commission. The
  ref rides the URL through sign-in, so no tracking cookie is set — consistent
  with pit.world's no-cookie posture.
- src/server.ts — Deps.promoters, mounts after accounts, sitemap, serve() wiring
  (PIT_PROMOTERS_DB); src/html.ts — /promote in the footer nav.
- test/promoters.test.ts — 8 tests: idempotent join, code format, trial +
  attribution rules (self/unknown refused, credited once), 20% accrual on spend,
  and public-route behaviour. Full suite 147/147, tsc clean, threatcrush clean.

Staged (not in this PR): the $2/mo recurring CoinPay charge after the trial and
automated 20% payout execution — no billing primitive exists in the repo yet
(CoinPay is OAuth-only here). The 30-day trial is the runway; commission accrues
honestly from day one via recordSpend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 4e83baf into main Oct 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant