Webpez is a full-stack Referral & Credit System built as a digital product platform. Users can register, share referral links, earn credits on referrals’ first purchases, and track all referral activity through a responsive dashboard. This project demonstrates a scalable, modular full-stack application with clean architecture, secure authentication, and thoughtful engineering practices.
- Secure registration, login, and logout
- Passwords hashed using bcrypt
- JWT-based authentication with HTTP-only cookies
- Each user receives a unique referral link
- Referral relationships tracked upon registration
- Referral status recorded (registered vs converted)
- 2 credits awarded to both users on the first purchase only
- Prevents double-crediting
- “Purchase Now” button to simulate purchases
- Only the first purchase of a referred user triggers credit rewards
- Total Referred Users
- Total Pending Users
- Total Converted Users (who purchased)
- Total Credits Earned
- Total My Referral Users
- Unique referral link with copy/share option
- Total Registered Users
- Total Referred Users
- Total Organic Users
- Total Credits Earned
- All Registered Users Table
- Unique referral link with copy/share option
| Layer | Technology |
|---|---|
| Frontend | Next.js 15, TypeScript, Tailwind CSS, Framer Motion |
| Backend | Node.js, Express.js, TypeScript |
| Database | MongoDB + Mongoose |
| State Management | Redux Toolkit + React Redux |
| Validation | Zod (frontend & backend) |
| Authentication | JWT + bcrypt |
root/
├── backend/
│ ├── configs/
│ ├── controllers/
│ ├── enums/
│ ├── middlewares/
│ ├── models/
│ ├── routes/
│ ├── schemas/
│ ├── services/
│ ├── types/
│ ├── env.example
│ ├── package-lock.json
│ ├── package.json
│ ├── server.ts
│ └── tsconfig.json
│
├── frontend/
│ ├── app/
│ ├── components/
│ ├── enums/
│ ├── hooks/
│ ├── json/
│ ├── library/
│ ├── public/
│ ├── schemas/
│ ├── store/
│ ├── types/
│ ├── env.example
│ ├── next-env.d.ts
│ ├── next.config.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── postcss.config.mjs
│ └── tsconfig.json
│
├── .gitignore
├── LICENSE
└── README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register new user |
| POST | /api/auth/login |
User login |
| POST | /api/auth/logout |
User logout |
| GET | /api/users/me |
Get logged-in user details |
| GET | /api/users/registered |
Total referred users |
| GET | /api/users/referred |
Referred users who purchased |
| POST | /api/purchases |
Simulate purchase (first triggers credits) |
MONGODB_URL=mongodb://localhost:27017/mydatabase
JWT_SECRET=your_jwt_secret_key
FRONTEND_URL=http://localhost:3000
ADMIN_EMAIL=admin@example.com
NODE_ENV=development
PORT=5000
NEXT_PUBLIC_BASE_URL=http://localhost:5000
NEXT_PUBLIC_SITE_URL=http://localhost:3000
- Node.js v18+
- MongoDB (local or Atlas cluster)
- Git
git clone https://github.com/mironcoderr/jobtask-filesure-webpez.git
cd webpezcd backend
npm install
cp .env.example .env
npm run dev
Backend runs on http://localhost:5000
cd ../frontend
npm install
cp .env.example .env.local
npm run dev
Frontend runs on http://localhost:3000
Example Flow of Referral & Credit System:
-
User Registration
- User signs up
- Referral code (if any) is detected
- Referrer–referred relationship is created
-
User Login
- User logs in
- Dashboard loads referral stats:
- Total Referred Users
- Pending Users
- Converted Users
- Total Credits
- Unique Referral Link
-
Purchase Flow
- User clicks “Purchase Now”
- System checks if it's the first purchase
- Credits are assigned to both referrer and referred user
- Referral status updated to “converted”
- Register User A
- Copy User A’s referral link
- Open incognito → Register User B using the referral link
- Login as User B → Click “Buy Product”
- Login as User A → Check dashboard for earned credits
- Miron Mahmud
- Email: mironcoder@gmail.com
- Phone: +880 18382 88389
- Website: mironmahmud.com
- GitHub: mironcoderr