selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

refref logo

Self-host refref

Open-source referral, affiliate, and loyalty platform

AlphaOpen SourceAGPL-3.0
Updated7 months ago
LanguageTypescript
Setup difficultyModerate
Stars
239
Port
3000 (webapp portal)
Requires
Node.js, Pnpm, PostgreSQL
Install with Docker Compose
refref screenshot 1

What is refref?

An open-source platform for building and running referral, affiliate, and loyalty programs. It captures referral clicks via a landing script, attributes signups to referrers, applies reward rules for events like purchases, and delivers rewards through billing providers or webhooks. Includes referrer and partner portals, flexible reward types, custom domain links, sandbox testing, and automation webhooks. Runs on PostgreSQL with a Next.js/React frontend. Self-host via Docker Compose or local Node.js 20+ with pnpm. Currently in alpha under AGPL-3.0.

Should you self-host refref?

refref scores 44/100 on selfhost.directory (how scoring works) and ranks #11 of 12 in Marketing Automation. It has 239 GitHub stars.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is moderate: expect some configuration beyond a single command. It is AGPL-3.0-licensed and written mostly in Typescript.

Its closest alternative on selfhost.directory is Mautic (76/100, 10 857 stars). It scores higher overall, so compare the two before you pick. See refref vs Mautic side by side.

Features

  • Automated Nudges
  • Automatic Reward Approval
  • Automatic Reward Dispersal
  • Customizable Rewards
  • Engagement Analytics
  • Fraud Monitoring
  • Loyalty Programs
  • Manual Reward Approval
  • Manual Reward Dispersal
  • Partner Portal
  • Personalized Pages
  • Referral Attribution
  • Referrer Portal
  • Testing Environment
  • Webhooks

refref README

How to install refref

Install refref with Docker Compose

Docker and Docker Compose
Environment variables
GOOGLE_CLIENT_ID=xxx GOOGLE_CLIENT_SECRET=xxx RESEND_API_KEY=xxx docker-compose up

Clone the repository

git clone https://github.com/refrefhq/refref.git cd refref

Start everything with Docker Compose

docker-compose up

Automatically handles PostgreSQL setup, migrations, seeding, and webapp configuration

How to configure refref

  • BETTER_AUTH_SECRETAuthentication secret key

    Authentication secret key

  • BETTER_AUTH_URLhttp://refref-webapp.localhost:1355Authentication URL

    Authentication URL

  • DATABASE_URLpostgresql://postgres:postgres@localhost:5432/refrefPostgreSQL connection string

    PostgreSQL connection string

  • GOOGLE_CLIENT_IDGoogle OAuth client ID

    Google OAuth client ID

  • GOOGLE_CLIENT_SECRETGoogle OAuth client secret

    Google OAuth client secret

  • NEXT_PUBLIC_APP_URLhttp://refref-webapp.localhost:1355Public URL of the application

    Public URL of the application

  • NEXT_PUBLIC_ASSETS_URLhttp://refref-refer.localhost:1355URL of the assets CDN for widget and attribution scripts

    URL of the assets CDN for widget and attribution scripts

  • NEXT_PUBLIC_POSTHOG_ENABLEDtrueEnable PostHog tracking

    Enable PostHog tracking

  • NEXT_PUBLIC_POSTHOG_KEYPostHog product key for analytics

    PostHog product key for analytics

  • RESEND_API_KEYResend API key for sending emails

    Resend API key for sending emails

FAQ

Can I test RefRef before I go live?

Yes. Each Live Project has a paired Sandbox Project with its own ID, and an API key reaches only one environment. Test in Sandbox, then switch the key and the Project ID.

What types of businesses can use RefRef?

B2B and B2C software, AI apps, subscriptions, and marketplaces. RefRef names each customer with your own ID, either a person or a company account.

How do I integrate RefRef with my product?

Add the landing script to your website, send signups from your backend, and connect your billing provider for purchases. The docs have guides for common auth systems, billing providers, and stores.

How does RefRef work?

A referrer shares a link. The RefRef landing script on your website records the click in a first-party cookie. When the new customer creates an account, your backend sends the signup to RefRef with that cookie, and RefRef connects the customer to the referrer. Later purchases use the same referral, and your rules decide the Rewards.

What is RefRef?

RefRef is an open source platform for referral, affiliate, and loyalty programs for software and commerce products. It gives referrers their links, connects new customers to the person who referred them, and records and delivers the Rewards that your rules give.

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…