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

@nerdfolio/remult-better-auth

v0.4.3

Published

Remult ORM adapter for better-auth

Downloads

4,020

Readme

remult-better-auth

Adapter to use better-auth with remult

Installation


pnpm add @nerdfolio/remult-better-auth

# or

npm i @nerdfolio/remult-better-auth

Usage

Generate the Auth Entities (schema)


pnpx @better-auth/cli@latest generate

# or

npx @better-auth/cli@latest generate

Options:

--config - The path to your Better Auth config file. By default, the CLI will search for an auth.ts file in ./, ./utils, ./lib, or any of these directories under src directory.

--output - The schema output file

See Better Auth CLI docs for further explanations.

Here is a sample output

Initialize The Remult API

Follow the Remult setup to define the api for your particular web framework. For example, in SolidStart, it would be something like

// src/api.ts

import { auth } from "./auth"

export const api = remultApi({
	entities: [...],
	dataProvider: ...,
	async getUser({request}) {
		const s = await auth.api.getSession({
			headers: request.headers
		})

		if (!s) {
			throw new BetterAuthError(
				"getUserInfo: No session found in request.",
				JSON.stringify(request)
			)
		}

		const { id = "", name = "" } = s ? s.user : {}
		const roles = "role" in s.user
			? (s.user.role as string).split(",").map((r) => r.trim())
			: []satisfies string[]

		return { id, name, roles } satisfies UserInfo
	},
	...
})

Initialize Better-Auth with This Adapter

Then pass the remult instance or its dataProvider or a promise to either to @nerdfolio/remult-better-auth. These values can be obtained via api.getRemult() or (await api.getRemult()).dataProvider.

import { betterAuth } from "better-auth"
import { api } from "~/api"
import { User, Account, Session, Verification } from "./src/auth-schema" // generated via the cli

return betterAuth({
	database: remultAdapter({
		authEntities: {User, Account, Session, Verification},
		dataProvider: api.getRemult().then(r => r.dataProvider)
	}),
	...anyOtherBetterAuthOptions
})

Adapter Options:

  • authEntities: on initial entity generation, use {}. Afterwards, use this to point to your auth entities.
  • debugLogs: optional, default => false. When true the adapter will output what better-auth passes to it
  • usePlural: optional. default => false. When true, the generated table names will be pluralized, e.g. users, accounts
  • dataProvider optional. Specify an alternate data provider for this adapter. You may also want to pass this from your api definition to ensure the custom data provider is used instead of the default.

[!NOTE] There may be situations where the configuration of better-auth and this adapter runs before your remult api configuration. In those cases, you'll end up with the default dataProvider instead of the one you intended. Even though dataProvider is optional, it's better to pass in the provider you used for your remult api.