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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gatekeepr/better-auth

v0.0.1

Published

Gatekeepr helpers for Better Auth email sign-up and sign-in abuse protection.

Downloads

61

Readme

@gatekeepr/better-auth

Gatekeepr helpers for Better Auth email sign-up and sign-in abuse protection.

The package ships a Better Auth server plugin that runs before /sign-up/email and /sign-in/email, extracts the email/IP/User-Agent signal set, checks Gatekeepr, and interrupts the request with a Response when the request should be blocked.

Install

yarn add @gatekeepr/better-auth

Better Auth Plugin

import { betterAuth } from "better-auth"
import { createGatekeeprBetterAuthPlugin } from "@gatekeepr/better-auth/api"

export const auth = betterAuth({
	emailAndPassword: {
		enabled: true
	},
	plugins: [
		createGatekeeprBetterAuthPlugin({
			gatekeeprApiKey: process.env.GATEKEEPR_API_KEY
		})
	]
})

The /api export wraps the hook with Better Auth's createAuthMiddleware. Use the root export for lower-level testing or custom middleware wiring.

By default, the plugin protects Better Auth's email/password sign-up and sign-in endpoints:

["/sign-up/email", "/sign-in/email"]

Decisions

By default, only Gatekeepr block decisions interrupt the Better Auth request. challenge decisions are allowed so your app can choose whether to add extra verification later.

createGatekeeprBetterAuthPlugin({
	gatekeeprApiKey: process.env.GATEKEEPR_API_KEY,
	rejectStatuses: ["block", "challenge"]
})

Customize the blocked response:

createGatekeeprBetterAuthPlugin({
	gatekeeprApiKey: process.env.GATEKEEPR_API_KEY,
	blockHttpCode: 429,
	blockMessage: (gatekeepr) => `Blocked: ${gatekeepr.threats.join(", ")}`
})

Custom Paths

Use matchPaths for additional Better Auth endpoints that carry an email in the request body.

createGatekeeprBetterAuthPlugin({
	gatekeeprApiKey: process.env.GATEKEEPR_API_KEY,
	matchPaths: [
		"/sign-up/email",
		"/sign-in/email",
		"/magic-link/send"
	]
})

Use getEmail, getIp, or getUserAgent when your app stores these signals in custom context fields.

createGatekeeprBetterAuthPlugin({
	gatekeeprApiKey: process.env.GATEKEEPR_API_KEY,
	getEmail: (ctx) => ctx.body.loginEmail
})

Lower-Level Usage

import {
	checkBetterAuthContext,
	createGatekeeprBetterAuth
} from "@gatekeepr/better-auth"

const gatekeepr = createGatekeeprBetterAuth({
	gatekeeprApiKey: process.env.GATEKEEPR_API_KEY
})

const decision = await gatekeepr.checkContext(ctx)
if(!decision.allowed) return { response: decision.response }

The decision object includes decision.gatekeepr for server-side logging and decision.payload for the exact email/IP/User-Agent payload sent to Gatekeepr.