npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

better-auth-fraud-detection

v0.0.1

Published

Real-time fraud detection plugin for Better Auth - Prevent account takeovers, bot attacks, and suspicious activities

Readme

Better Auth Fraud Detection

Real-time fraud detection plugin for Better Auth. Protect your application from account takeovers, bot attacks, and suspicious authentication activities using advanced detection techniques.

🚧 Work in Progress

This package is currently under development. The fraud detection plugin will enable:

  • Device Fingerprinting - Track and verify device signatures
  • IP Reputation - Check IP addresses against threat databases
  • Behavioral Analysis - Detect unusual login patterns and anomalies
  • Bot Detection - Identify and block automated attacks
  • Risk Scoring - Calculate real-time risk scores for auth attempts
  • Adaptive Authentication - Require additional verification for risky logins

Installation

bun add better-auth-fraud-detection
# or
npm install better-auth-fraud-detection

Setup

import { betterAuth } from "better-auth";
import { fraudDetectionPlugin } from "better-auth-fraud-detection";

export const auth = betterAuth({
  plugins: [
    fraudDetectionPlugin({
      providers: {
        ipReputation: {
          service: "maxmind",
          apiKey: process.env.MAXMIND_API_KEY
        },
        deviceFingerprint: {
          service: "fingerprintjs",
          apiKey: process.env.FINGERPRINTJS_API_KEY
        },
        mlScoring: {
          service: "sift",
          apiKey: process.env.SIFT_API_KEY
        }
      },
      rules: {
        // Block login if risk score > 80
        blockThreshold: 80,
        // Require MFA if risk score > 50
        mfaThreshold: 50,
        // Challenge with CAPTCHA if risk score > 30
        challengeThreshold: 30
      },
      signals: {
        // Configure which signals to track
        newDevice: true,
        newLocation: true,
        impossibleTravel: true,
        bruteForce: true,
        credentialStuffing: true,
        suspiciousUserAgent: true
      },
      actions: {
        block: {
          message: "Access denied due to suspicious activity"
        },
        challenge: {
          type: "recaptcha", // or "hcaptcha", "turnstile"
          siteKey: process.env.RECAPTCHA_SITE_KEY
        }
      }
    })
  ]
});

Features (Planned)

Detection Methods

  • Device Intelligence: Browser fingerprinting, hardware detection
  • Network Analysis: IP reputation, VPN/proxy detection, geolocation
  • Behavioral Patterns: Login velocity, time-based patterns, session anomalies
  • Credential Analysis: Leaked password detection, common password checks
  • Bot Detection: Headless browser detection, automation tools detection
  • Social Engineering: Phishing attempt detection, account takeover patterns

Risk Signals

  • New device or browser
  • Unusual login location
  • Impossible travel (geography/time)
  • Multiple failed attempts
  • Rapid-fire login attempts
  • Known bad IP addresses
  • Suspicious user agents
  • Account enumeration attempts

Response Actions

  • Block authentication
  • Require additional verification (MFA)
  • Present CAPTCHA challenge
  • Rate limiting
  • Account lockout
  • Email/SMS alerts to user
  • Honeypot accounts
  • Shadow banning

Integration Providers

  • IP Intelligence: MaxMind, IPQualityScore, AbuseIPDB
  • Device Fingerprinting: FingerprintJS, DeviceAtlas
  • ML/AI Scoring: Sift, Arkose Labs, DataDome
  • CAPTCHA: reCAPTCHA, hCaptcha, Cloudflare Turnstile

Client Usage

import { createAuthClient } from "better-auth/client";
import { fraudDetectionClient } from "better-auth-fraud-detection/client";

const authClient = createAuthClient({
  plugins: [fraudDetectionClient()]
});

// Get risk assessment for current session
const risk = await authClient.fraud.getRiskScore();

// Report suspicious activity
await authClient.fraud.reportSuspicious({
  reason: "unusual_behavior",
  details: "User attempted to access admin panel repeatedly"
});

// Get fraud analytics (admin only)
const analytics = await authClient.fraud.getAnalytics({
  timeRange: "last_30_days"
});

License

MIT