Repository navigation
feat(promote): promoter program + membership trial at /promote - #31
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.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(ownbun:sqlitedb): promoters, members (30-day trial), commission ledger.src/promoters-routes.ts—mountPromote:/promote(public offer; shows your link once you join),/r/:codeshort 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—/promotein the footer.test/promoters.test.ts— 8 tests (idempotent join, code format, attribution rules, 20% accrual, public routes).Verification
Full suite 147/147,
tsc --noEmitclean,threatcrush scan . --deps --fail-on critical,high,mediumclean.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;
recordSpendalready accrues commission, so wiring billing + a payout run is additive.🤖 Generated with Claude Code