Install and configure refferq
Install and configure refferq: π Open Source Referral and Affiliate Marketing Platform for SaaS Business Owners - Launch your referral program in minutes!
Follow the source instructions for refferq. Read the prerequisites and configuration steps before running an example.
Installation
Prerequisites
- Node.js 18.x or higher
- PostgreSQL 14.x or higher
- npm or yarn or pnpm
Step 1: Clone the Repository
git clone https://github.com/Up-to-code/refferq.git
cd refferqStep 2: Install Dependencies
npm install
# or
yarn install
# or
pnpm installStep 3: Environment Setup
Create a .env.local file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/refferq"
# JWT Secret (generate a secure random string)
JWT_SECRET="your-super-secret-jwt-key-min-32-chars"
# Email Configuration (Resend)
# Sign up at https://resend.com for free API key
RESEND_API_KEY="re_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
RESEND_FROM_EMAIL="Refferq <onboarding@resend.dev>"
# Admin Notification Emails (comma-separated)
ADMIN_EMAILS="admin@yourdomain.com"
# Application URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Optional: Stripe (for payments)
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_PUBLISHABLE_KEY="pk_test_..."Step 4: Database Setup
# Generate Prisma Client
npx prisma generate
# Push schema to database
npx prisma db push
# (Optional) Seed database with sample data
npx prisma db seedStep 5: Email Configuration
Refferq uses Resend for sending transactional emails. Follow these steps:
-
Sign up for Resend
- Go to https://resend.com
- Create a free account (3,000 emails/month)
-
Get your API Key
- Navigate to API Keys in Resend dashboard
- Create a new API key
- Copy the key (starts with
re_...)
-
Update .env.local
RESEND_API_KEY="re_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" RESEND_FROM_EMAIL="Refferq <onboarding@resend.dev>" ADMIN_EMAILS="admin@yourdomain.com" -
Test Email Setup (Optional)
curl -X POST http://localhost:3000/api/admin/emails/test \ -H "Content-Type: application/json" \ -d '{"type": "welcome", "to": "test@example.com"}'
Note: For production, verify your domain in Resend dashboard to use your own email addresses. See docs/EMAIL.md for detailed configuration guide.
Step 6: Run Development Server
npm run devOpen https://app.refferq.com or your configured domain in your browser.
or
yarn dev
or
pnpm dev
Open [http://localhost:3000](http://localhost:3000) in your browser.
### Step 7: Create Admin Account
1. Register at `/register`
2. Use the registration form to create your account
3. Manually update the user role in the database:
```sql
UPDATE users SET role = 'ADMIN', status = 'ACTIVE' WHERE email = 'your-email@example.com';Note: New affiliates are set to
PENDINGstatus by default and require admin approval. Admins should be set toACTIVEstatus.
π¦ Deployment
Deploy on Vercel
The easiest way to deploy Refferq is using Vercel:
Manual Deployment Steps:
-
Push to GitHub
git push origin main -
Import Project in Vercel
- Go to Vercel Dashboard
- Click "New Project"
- Import your repository
-
Configure Environment Variables
- Add all variables from
.env.local - Set
DATABASE_URLto your production database
- Add all variables from
-
Deploy
- Vercel will automatically build and deploy
- Get your production URL:
https://your-project.vercel.app
For detailed deployment instructions, see DEPLOYMENT.md
π Documentation
- API Documentation - Complete API reference
- Deployment Guide - Production deployment steps
- Database Schema - Database structure and models
- Email Configuration - Email setup and templates guide
- Contributing Guide - How to contribute
ποΈ Project Structure
refferq/ βββ prisma/ β βββ schema.prisma # Database schema βββ public/ β βββ images/ # Static assets βββ src/ β βββ app/ β β βββ admin/ # Admin dashboard β β βββ affiliate/ # Affiliate dashboard β β βββ api/ # API routes β β β βββ admin/ # Admin endpoints β β β βββ affiliate/ # Affiliate endpoints β β β βββ auth/ # Authentication β β βββ login/ # Login page β β βββ register/ # Registration page β βββ components/ # React components β βββ hooks/ # Custom hooks β βββ context/ # React context β βββ icons/ # SVG icons βββ docs/ # Documentation βββ .env.local # Environment variables βββ vercel.json # Vercel configuration βββ README.md # This file
π§ Configuration
Program Settings
Configure your affiliate program through the Admin Dashboard:
-
General Settings
- Product name and program name
- Website URL
- Currency (INR, USD, EUR, GBP)
- Blocked countries
-
Branding
- Brand colors (background, button, text)
- Company logo
- Favicon
-
Payout Settings
- Minimum payout threshold
- Payout term (NET-15, NET-30, NET-45)
- Supported payout methods
-
Marketing & Tracking
- Cookie duration
- URL parameters
- Manual lead submission
- Social media ad blocking
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
npm test - Submit a pull request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π¨βπ» Author
Developed by: Refferq Team
- GitHub: @refferq
- Website: https://refferq.com
π Show Your Support
If you find this project useful, please consider:
- β Starring the repository
- π Reporting bugs
- π‘ Suggesting new features
- π Submitting pull requests
π Support
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Star History
π Acknowledgments
Built with β€οΈ using:
Made with β€οΈ by the Refferq Team
Β© 2025 Refferq. All rights reserved.
β Found this useful? Give us a star to support the project!
Check the installation
After setup, continue with the first example. If a command fails, compare the runtime version, working directory, and required configuration with the original README before changing dependencies.
Source and help
The catalog identifies the license as MIT. Read the repository license before redistributing source or assets.
This catalog entry is a fork. The README may describe upstream packages, domains, or release procedures; those destinations do not establish a separate release of this fork.
Source captured: 2026-10-11
