better-auth-affiliates
Open Sourcev1.0.0MIT License

Affiliate programs for Better Auth

A complete referral and affiliate system plugin. Track clicks, manage commissions, and grow with partner marketing.

npm install better-auth-affiliates

Features

Everything you need to run a successful affiliate program.

Affiliate Links

Generate unique tracking codes with custom commission structures.

Click Tracking

Monitor clicks, conversions, and revenue in real-time.

Partner Dashboard

Pre-built components for affiliates to track performance.

Better Auth Native

Zero-config integration with your existing auth setup.

Type-Safe

Full TypeScript support with Zod validation throughout.

Database Agnostic

Works with any database adapter Better Auth supports.

Simple Integration

Add the plugin to your Better Auth configuration. No complex setup or database migrations required.

  • Drop-in plugin architecture
  • Automatic cookie-based attribution
  • Built-in REST & tRPC endpoints
  • Works with any database adapter
auth.ts
import { betterAuth } from "better-auth"
import { affiliates } from "better-auth-affiliates"

export const auth = betterAuth({
  plugins: [
    affiliates({
      defaultCommissionRate: 10,
      cookieExpiration: 30 * 24 * 60 * 60, // 30 days
    }),
  ],
})

Ready to get started?

See the interactive demo with real components and live data.