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

@strapi-community/plugin-better-auth

v1.0.0-alpha.2

Published

Better Auth database adapter for Strapi

Readme

Strapi + Better Auth

A Better Auth database adapter that uses Strapi as the database backend. This package allows you to integrate Better Auth's authentication system with your Strapi application seamlessly.

[!CAUTION]
This plugin is in ALPHA state. It is by no means considered stable and should not be used in production. If you want to contribute to it's development, please contact any of the maintainers.

Features

  • ✅ Full Better Auth database adapter implementation
  • ✅ Uses Strapi's document service for data management
  • ✅ Supports all Better Auth core features (users, sessions, accounts, verification)
  • ✅ All Better Auth endpoints available through Strapi API
  • ✅ Works with Strapi v5+

Installation

npm install @strapi-community/plugin-better-auth
# or
yarn add @strapi-community/plugin-better-auth
# or
pnpm add @strapi-community/plugin-better-auth

Usage

1. Install the plugin in your Strapi application

Add the plugin to your Strapi plugins configuration:

// config/plugins.ts
export default {
  'better-auth': {
    enabled: true,
  }
}

2. Customize the Better Auth options

The Better Auth options can be customized through the plugin config:

// config/plugins.ts
export default {
  'better-auth': {
    enabled: true,
    config: {
      betterAuthOptions: {
        emailAndPassword: {
          enabled: true,
          requireEmailVerification: true,
        },
        socialProviders: {
          github: {
            clientId: process.env.GITHUB_CLIENT_ID!,
            clientSecret: process.env.GITHUB_CLIENT_SECRET!,
          },
          google: {
            clientId: process.env.GOOGLE_CLIENT_ID!,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
          },
        },
        session: {
          expiresIn: 60 * 60 * 24 * 7, // 7 days
        },
      },
    },
  },
};

3. Client implementation

Call the Better Auth API from your front-end:

// In your React/Vue/Svelte app
import { createAuthClient } from 'better-auth/react'; // or /vue, /svelte

const authClient = createAuthClient({
  baseURL: 'http://localhost:1337/api/better-auth',
});

// Sign up
await authClient.signUp.email({
  email: '[email protected]',
  password: 'password123',
  name: 'John Doe',
});

4. Server side authentication

Use the Better Auth session to authenticate your users in custom Strapi controllers.

// In a Strapi controller
export default {
  async customMethod(ctx) {
    // Access the Better Auth instance
    // @ts-expect-error - Accessing custom property
    const auth = strapi.betterAuth;
    
    // Use Better Auth API methods
    const session = await auth.api.getSession({
      headers: ctx.request.headers,
    });
    
    if (session) {
      // User is authenticated
      console.log('User:', session.user);
    }
  }
}

Supported plugins

Any Better Auth plugin may be used with Strapi + Better Auth, but only a subset are considered supported for the integration. Strapi + Better Auth works out of the box for these without any required schema changes.

| Plugin | Tested | |-----------|-------------| | Two Factor | ✅ | | Username | ✅ | | Anonymous | ❌ | | Email OTP | ❌ | | Generic OAuth | ❌ | | JWT | ❌ | | Magic Link | ❌ | | One Tap | ❌ | | Passkey | ❌ | | Phone Number | ❌ |

Resources

Authors

License

See the LICENSE file for licensing information.