marinedotsh/better-auth-referral — explained in plain English
Analysis updated 2026-05-18
Add a refer a friend feature to an app without building the tracking system yourself.
Reward users automatically when someone they invited signs up successfully.
Show users a dashboard of how many people they have referred and when.
Attribute signups to a referral code during both email and OAuth signup flows.
| marinedotsh/better-auth-referral | void5tar/curio | diendh/zca-bridge | |
|---|---|---|---|
| Stars | 68 | 68 | 69 |
| Language | TypeScript | TypeScript | TypeScript |
| Setup difficulty | easy | moderate | moderate |
| Complexity | 2/5 | 3/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires an existing Better Auth setup plus a database migration step.
This project is a plugin that adds a referral system to apps already using Better Auth, a login and account library. Instead of building your own referral tracking from scratch, you install this plugin and it handles generating referral codes, recording who invited whom, and giving you the stats to show users how many people they have brought in. Every user automatically gets a unique eight character referral code. When a new person signs up and includes that code, either through a normal email signup or through signing in with a provider like GitHub, the plugin checks that the code is valid, lets the normal signup happen, then records the connection between the person who invited and the person who joined, and creates a fresh referral code for the new user too. You can also set an optional function that runs after a successful referred signup, useful for things like giving the referrer a reward or sending a notification. If someone signs up without a code, everything works exactly as before. Once set up, any signed in user can fetch their own referral code along with simple stats such as how many people joined today and how many joined overall. There is also an endpoint to list everyone a given user has referred, with support for paging through longer lists and an option to partially hide referred users' email addresses for privacy. Setting it up means installing the package and its two required companion libraries, adding a server side plugin to your Better Auth configuration, adding a matching client side plugin, and then running your normal Better Auth database setup steps so two new tables for referral codes and referrals get created. The referral code that gets checked during signup can be sent under a different header name if you prefer, and the whole thing is released under the MIT license.
A plugin for Better Auth that adds ready made user referral tracking, including referral codes, signup attribution, and referral stats.
Mainly TypeScript. The stack also includes TypeScript, Better Auth, Zod.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.