Skip to content

Getting Started ​

🚧 Note: This project is currently under active development. APIs and features may change before the stable release.

Overview ​

Better Auth Plugins is a collection of 17 enterprise-grade plugins that extend Better Auth with powerful features like cloud storage integration, advanced security, analytics, and more.

Prerequisites ​

  • Better Auth v0.5.0 or higher
  • Node.js 18+ or Bun 1.0+
  • TypeScript 5.0+ (recommended)

Installation ​

Install the plugins you need via your preferred package manager:

bash
# Using Bun (recommended)
bun add better-auth-feature-flags better-auth-storage

# Using npm
npm install better-auth-feature-flags better-auth-storage

# Using pnpm
pnpm add better-auth-feature-flags better-auth-storage

# Using yarn
yarn add better-auth-feature-flags better-auth-storage

Basic Setup ​

Configure Better Auth with your chosen plugins:

typescript
import { betterAuth } from "better-auth";
import { featureFlags } from "better-auth-feature-flags";
import { storagePlugin } from "better-auth-storage";
import { analyticsPlugin } from "better-auth-analytics";

export const auth = betterAuth({
  // Your Better Auth config
  database: {
    // ...
  },

  // Add plugins
  plugins: [
    featureFlags({
      storage: "database",
      analytics: { trackUsage: true },
    }),
    storagePlugin({
      providers: ["google-drive", "onedrive"],
    }),
    analyticsPlugin({
      trackEvents: true,
    }),
  ],
});

Client-Side Setup ​

For client-side functionality, import from the plugin's client module:

typescript
import { createAuthClient } from "better-auth/client";
import { featureFlagsClient } from "better-auth-feature-flags/client";
import { storageClient } from "better-auth-storage/client";

const client = createAuthClient({
  plugins: [featureFlagsClient(), storageClient()],
});

// Use feature flags
const isNewFeatureEnabled = await client.featureFlags.isEnabled("new-feature");

Available Plugins ​

PluginPackageDescription
Feature Flagsbetter-auth-feature-flagsFeature toggles, A/B testing, and gradual rollouts
Storagebetter-auth-storageCloud storage integration (Google Drive, OneDrive, Dropbox)
Analyticsbetter-auth-analyticsUser behavior and auth event tracking
Rate Limitbetter-auth-rate-limitRequest throttling and brute force protection
Audit Logbetter-auth-audit-logComprehensive activity logging
Session Managementbetter-auth-session-managementAdvanced session control and device management
Fraud Detectionbetter-auth-fraud-detectionFraud prevention and risk scoring
Impersonationbetter-auth-impersonationAdmin user impersonation for support
Webhooksbetter-auth-webhooksEvent-driven integrations
Notificationsbetter-auth-notificationsEmail, SMS, and push notifications
Consentbetter-auth-consentGDPR compliance and privacy management
Compliancebetter-auth-complianceRegulatory compliance tools
Backup Codesbetter-auth-backup-codesRecovery codes for 2FA
Subscriptionbetter-auth-subscriptionSubscription and billing management
Onboardingbetter-auth-onboardingUser onboarding flows
Abuse Detectionbetter-auth-abuse-detectionAbuse and spam prevention
MCPbetter-auth-mcpModel Context Protocol integration

TypeScript Support ​

All plugins are written in TypeScript and provide full type definitions:

typescript
import type { StorageOptions } from "better-auth-storage";

const config: StorageOptions = {
  providers: ["google-drive"],
  syncInterval: 300,
};

Next Steps ​

  • Explore the available plugins and their configurations
  • Check the Better Auth documentation for core features
  • Review the TypeScript types for better IDE support

Status ​

This project is actively being developed. Follow our progress: