@nwire/auth-better-auth
v0.7.1
Published
Nwire — better-auth adapter. Wraps a configured better-auth instance as an IdpAdapter so canonical resolvers (SignIn/SignOut/Register/Refresh/Me/etc.) work against better-auth's database-first auth backend. For self-hosted apps that don't want a separate
Readme
@nwire/auth-better-auth
IdP adapter for better-auth — the TypeScript-first default.
What it does
Wraps better-auth's API so it conforms to Nwire's IdpAdapter contract. Supports verifyToken, signIn, signOut, register, requestPasswordReset, resetPassword. Pairs with Drizzle/Prisma adapters on better-auth's side; the rest of Nwire (RBAC, scoped containers, canonical resolvers) works unchanged.
Install
pnpm add @nwire/auth-better-auth @nwire/auth better-authQuick start
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { betterAuthAdapter } from "@nwire/auth-better-auth";
import { identityPlugin } from "@nwire/auth";
import { defineApp } from "@nwire/forge";
import { db } from "./db.js";
const auth = betterAuth({
database: drizzleAdapter(db, { provider: "pg" }),
emailAndPassword: { enabled: true },
socialProviders: { github: { clientId: "...", clientSecret: "..." } },
});
defineApp("my-app", {
plugins: [identityPlugin({ adapter: betterAuthAdapter({ auth }) })],
});API surface
betterAuthAdapter({ auth })— produces anIdpAdapterthat conforms to the@nwire/authcontract.
When to use
When you want a TS-first auth backend you own the DB schema for. Pair with @nwire/data-drizzle.
Within nwire-app
For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).
import { createApp } from "@nwire/forge";
const app = createApp({
/* ...config... */
});
// Adapter/plugin wiring happens here when applicable.