Eclipse
Boilit
BoilitBoilitBeta
Boilerplates

Boilerplate

Next.js with Better Auth Plugin (Email Normalization)

This boilerplate demonstrates how to create and integrate a custom plugin for Better Auth, showcasing an example called emailNormalizationPlugin, which automatically normalizes user emails to lowercase before authentication.

It extends the base boilerplate Next.js with Better Auth and Email-based OTP, adding a reusable and composable plugin system to enhance authentication workflows.

Overview

The emailNormalizationPlugin solves a common issue in authentication systems — users entering emails with uppercase letters (e.g., John.Doe@Example.com) that could cause mismatched credentials or duplicate accounts.

By normalizing emails to lowercase during the sign-in process, this plugin ensures consistency, reliability, and better UX without requiring additional logic in your routes or backend.

Features

  • Better Auth Plugin System example implementation.
  • Custom plugin: emailNormalizationPlugin for normalizing emails.
  • Works with the Email-based OTP authentication flow.
  • Next.js App Router for frontend and backend routes.
  • TypeScript support for plugin creation and type safety.
  • Extensible architecture to easily add more Better Auth plugins.

Use Case

Ideal for developers looking to:

  • Extend Better Auth with custom pre-processing or validation logic.
  • Solve common input normalization issues (like uppercase emails).
  • Learn how to structure and register custom plugins in a Next.js + Better Auth environment.

With this boilerplate, you’ll learn how to create your own Better Auth plugins, starting with a practical and universally needed case — email normalization — ensuring smooth authentication experiences across all devices and users. 🚀

Boilerplate details

  • Last update


    6 hours ago
  • Boilerplate age


    6 hours ago
Login to download