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

@sparko-ai/block-free-emails

v1.0.3

Published

Better Auth plugin that blocks sign-ups (or magic link requests) coming from disposable or free email providers. It ships with a maintained list of common domains and gives you hooks to fully customize how domains are allowed.

Readme

@sparko-ai/block-free-emails

Better Auth plugin that blocks sign-ups (or magic link requests) coming from disposable or free email providers.
It ships with a maintained list of common domains and gives you hooks to fully customize how domains are allowed.

Features

  • 🔒 Uses the curated FREE_EMAIL_DOMAINS list out of the box.
  • 🚫 Blocks via a configurable blocklist or flips to allowlist mode when you need to restrict access to corporate domains.
  • 🧩 Accepts a custom validator for advanced policies (regex, database checks, etc.).
  • ♻️ Works as a normal Better Auth plugin – simply drop it into your betterAuth configuration.

Installation

pnpm add @sparko-ai/block-free-emails
# or
npm install @sparko-ai/block-free-emails
# or
yarn add @sparko-ai/block-free-emails

Quick start

import { betterAuth } from "better-auth";
import { blockFreeEmails } from "@sparko-ai/block-free-emails";

export const auth = betterAuth({
  plugins: [
    blockFreeEmails({
      customErrorMessage: "Use your company email so we can verify employment."
    })
  ]
});

When a user enters an email belonging to one of the known free providers, an APIError with the provided message is thrown before the request continues.

Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | blockedDomains | string[] | FREE_EMAIL_DOMAINS | Domains that should be rejected. Extend or replace the default list. | | allowedDomains | string[] | [] | Switches the plugin to allowlist mode – only these domains are accepted. | | customErrorMessage | string | "Please use your corporate email address. Free email providers are not allowed." | Message returned to the user when a domain is blocked. | | blockOnSignIn | boolean | true | Placeholder for future flows. The current implementation always runs on the magic-link sign-in route – keep this true for forward compatibility. | | customValidator | (email, domain) => boolean \| Promise<boolean> | undefined | Run any custom logic. Return false to block the request even if the domain is normally allowed. |

The evaluation order is:

  1. customValidator (if defined)
  2. allowedDomains allowlist check
  3. blockedDomains blocklist check

Helper utilities

import { isFreeEmailDomain, FREE_EMAIL_DOMAINS } from "@sparko-ai/block-free-emails";

isFreeEmailDomain("[email protected]"); // true
FREE_EMAIL_DOMAINS.includes("outlook.com"); // ✔ up-to-date list

Use these helpers if you need to run validation outside of Better Auth (e.g., in a marketing form or CRM sync).

Scripts

pnpm run build       # bundles to dist/ with tsup
pnpm run dev         # watch mode
pnpm run lint        # eslint over src/
pnpm run type-check  # strict TypeScript compile

License

MIT © Sparko