Skip to content

feat(growth): implement referral reward loop engine (#2) - #109

Open
angelTomo9 wants to merge 1 commit into
Nexussyn:mainfrom
angelTomo9:agent/angelTomo9/issue-2-1787619641673
Open

feat(growth): implement referral reward loop engine (#2)#109
angelTomo9 wants to merge 1 commit into
Nexussyn:mainfrom
angelTomo9:agent/angelTomo9/issue-2-1787619641673

Conversation

@angelTomo9

Copy link
Copy Markdown

Closes #2

Summary of Deliverables

Implements the referral reward loop engine in src/growth/referral.ts with SQL schema migrations and test coverage.

Features & Deliverables

  • Database Schema: migrations/add_referral_system.sql creating referral_codes, referral_conversions, and system_events tables.
  • Referral Engine: src/growth/referral.ts providing:
    • Code generation (createReferralCode)
    • Conversion processor (processReferral)
    • 5-credit award mechanism for referrers
    • Idempotency guard (prevents duplicate conversions for the same referred user)
    • Self-referral protection (blocks user from claiming own code)
    • Event logging to system_events with metadata.
  • Test Suite: tests/referral.test.ts verifying happy path, credit allocation, duplicate rejection, and self-referral handling.

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.

[AGENT-TASK] Implement referral reward loop — +20% conversion

1 participant