Skip to content

A three-tier referral and commission backend with REST APIs for referral management, earnings calculation, and trade webhook handling, emphasizing scalability, idempotency, and data accuracy through optimized schema design and testing.

Notifications You must be signed in to change notification settings

abhisheks-gh/referral-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Referral System

A multi-level referral and commission system for Nika Finance, built using:

  • Java: 25
  • Spring Boot: 3.5.6
  • PostgreSQL: 18.0
  • Maven build tool

Setup

  1. Create DB referral_db in PostgreSQL 18.0
  2. Add .env file with DB_USER and DB_PASSWORD
  3. Run: mvn clean install mvn spring-boot:run

API Endpoints

POST /api/referral/generate → Generate referral code
POST /api/referral/register → Register user with optional referral
POST /api/webhook/trade → Simulate trade & distribute commission
GET /api/users → Get all users
GET /api/users/{id} → Get user by ID
GET /api/users/{id}/referrals → Get referrals for user
GET /api/commissions/{userId} → Get user commissions

Testing

Run: mvn test
All tests use JUnit 5, Mockito, and MockMvc.

Notes

Simulates Web3 payout logic (not connected to real blockchain). Uses USDC as the token for fee and commission simulation.


© 2025 Abhishek Kumar.
All rights reserved. Not licensed for production or commercial use.

About

A three-tier referral and commission backend with REST APIs for referral management, earnings calculation, and trade webhook handling, emphasizing scalability, idempotency, and data accuracy through optimized schema design and testing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages