A modern referral partner platform built for Aice Tangerang Selatan
- Overview
- Features
- Tech Stack
- Getting Started
- Environment Variables
- Project Structure
- User Roles
- Authentication
- API Endpoints
- Deployment
- Contributing
- License
Partner Flow is a comprehensive referral partner platform designed for Aice in the Tangerang Selatan region. Built with Next.js for optimal performance and SEO, it enables businesses to manage their referral programs efficiently through a modern, intuitive interface.
- π― Multi-Level Referral System - Partners can earn commissions from their referrals and their referrals' referrals
- π Real-Time Analytics - Track referrals, commissions, and performance metrics in real-time
- π Role-Based Access Control - Separate dashboards for partners and administrators
- π Social Media Integration - Easy sharing across multiple platforms
- π± Responsive Design - Works seamlessly on desktop, tablet, and mobile devices
- π Dark Mode Support - Built-in theme switching for user comfort
- π Personal Dashboard - View referral statistics, earnings, and performance metrics
- π Referral Link Generation - Unique referral codes for tracking
- π€ Social Media Sharing - One-click sharing to Facebook, Twitter, LinkedIn, WhatsApp, and Email
- π Referral Tracking - Monitor referral status (pending, approved, rejected)
- π° Commission Tracking - View earnings and commission history
- π Performance Analytics - Detailed statistics on referral performance
- π Referral Bonuses - Multi-level commission structure
- π₯ Partner Management - View and manage all registered partners
- π Credential Access - View partner login credentials (with toggle)
- π Referral Approval - Approve or reject pending referrals
- π Referral Conversion - Convert successful referrals to partners
- π Platform Analytics - System-wide statistics and insights
- ποΈ Activity Monitoring - Track recent platform activity
- π Data Export - Export partner and referral data
- π Email/Password Login - Traditional authentication method
- π Google OAuth - Sign in with Google account
- π Registration Wizard - Step-by-step onboarding for new users
- π Secure Sessions - JWT-based session management
- π‘οΈ Protected Routes - Route-level access control
- Framework: Next.js 15.3 - React framework with App Router
- Language: TypeScript 5.0 - Type-safe JavaScript
- Styling: Tailwind CSS 4.0 - Utility-first CSS framework
- UI Components: Radix UI - Accessible component primitives
- Icons: Lucide React - Beautiful icon library
- Animations: Framer Motion - Production-ready motion library
- Authentication: NextAuth.js 5.0 - Complete authentication solution
- API: RESTful API integration with backend service
- State Management: React Hooks and Context API
- Package Manager: npm/yarn
- Linting: ESLint
- Code Formatting: Prettier (recommended)
- Node.js 18.x or higher
- npm or yarn package manager
- Backend API service running on configured port
- Clone the repository
git clone https://github.com/partner-flow/partner-flow-fe.git
cd partner-flow-fe- Install dependencies
npm install- Configure environment variables
cp .env.example .envEdit .env file with your configuration:
# App Configuration
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_NAME="Partner Flow"
# Backend API
NEXT_PUBLIC_BACKEND_URL="http://localhost:8080"
# Google OAuth (Optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# NextAuth Configuration
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"- Generate NextAuth secret
openssl rand -base64 32- Run development server
npm run dev- Open browser Navigate to http://localhost:3000
| Variable | Description | Required | Default |
|---|---|---|---|
NEXT_PUBLIC_APP_URL |
Frontend application URL | Yes | http://localhost:3000 |
NEXT_PUBLIC_APP_NAME |
Application name | Yes | Partner Flow |
NEXT_PUBLIC_BACKEND_URL |
Backend API URL | Yes | http://localhost:8080 |
GOOGLE_CLIENT_ID |
Google OAuth Client ID | No | - |
GOOGLE_CLIENT_SECRET |
Google OAuth Client Secret | No | - |
NEXTAUTH_URL |
NextAuth URL | Yes | http://localhost:3000 |
NEXTAUTH_SECRET |
NextAuth secret key | Yes | - |
- Go to Google Cloud Console
- Create a new OAuth 2.0 client ID
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/googlehttps://yourdomain.com/api/auth/callback/google(for production)
- Copy Client ID and Client Secret to your
.envfile
partner-flow-fe/
βββ .env.example # Environment variables template
βββ public/ # Static assets
βββ src/
β βββ app/ # Next.js App Router
β β βββ api/ # API routes
β β β βββ auth/ # Authentication endpoints
β β β β βββ login/ # Login endpoint
β β β β βββ register/ # Registration endpoint
β β β β βββ onboarding/ # Onboarding endpoint
β β β βββ partners/ # Partner endpoints
β β βββ auth/ # Authentication pages
β β β βββ login/ # Login page
β β β βββ register/ # Registration page
β β β βββ onboarding/ # Onboarding wizard
β β βββ dashboard/ # Dashboard pages
β β β βββ page.tsx # Main dashboard
β β βββ page.tsx # Homepage
β βββ components/ # React components
β β βββ dashboard/ # Dashboard-specific components
β β β βββ stats-card.tsx
β β β βββ referral-tools.tsx
β β β βββ referrals-table.tsx
β β β βββ partners-table.tsx
β β β βββ referral-management.tsx
β β β βββ partner-dashboard.tsx
β β β βββ admin-dashboard.tsx
β β βββ layouts/ # Layout components
β β β βββ navbar.tsx
β β βββ providers/ # Context providers
β β β βββ theme-provider.tsx
β β βββ ui/ # UI components
β βββ config.ts # Configuration file
β βββ lib/ # Utility libraries
β β βββ auth.ts # NextAuth configuration
β βββ types/ # TypeScript type definitions
β βββ next-auth.d.ts # NextAuth types
βββ package.json # Dependencies
βββ README.md # This file
Note: The .agents folder is located at the parent directory (../.agents) and contains project documentation.
Default role for all new registrations
- Automatically assigned during registration
- Access to personal dashboard
- Can create and share referral links
- Track own referrals and earnings
- Cannot view other partners' data
- Cannot approve or reject referrals
Manually assigned by database administrators
- Full platform access
- View all partners and their data
- View all referrals across the platform
- Approve or reject pending referrals
- Convert referrals to partners
- View partner credentials (with toggle)
- Access system-wide analytics
How to obtain admin role:
- Direct database manipulation:
UPDATE users SET role = 'admin' WHERE email = '...' - Backend API endpoint (if implemented)
- Initial seed data during database setup
Demo Accounts:
- Partner:
partner@example.com/partner123 - Admin:
admin@partnerflow.com/admin123
-
Email/Password
- Traditional authentication
- Validates against backend API
- JWT token generation
-
Google OAuth
- Sign in with Google account
- Redirects to onboarding wizard for first-time users
- Automatic profile creation
- JWT-based authentication
- Secure session storage
- Automatic token refresh
- Session expiration handling
All dashboard routes require authentication:
useEffect(() => {
if (status === "unauthenticated") {
router.push("/auth/login");
}
}, [status, router]);POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/onboarding- Complete onboardingGET /api/auth/session- Get current session
GET /api/partners- Get all partners (admin only)POST /api/partners/onboarding- Complete partner onboarding
GET /api/referrals?partner_id={id}- Get partner referralsGET /api/referrals- Get all referrals (admin only)PUT /api/referrals/{id}- Update referral status (admin only)
- Push code to GitHub
- Import project in Vercel
- Configure environment variables
- Deploy
- Build the application
npm run build- Start production server
npm start- Configure reverse proxy (nginx example)
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@partnerflow.com or open an issue in the repository.