zenstack/packages/auth-adapters/better-auth
github-actions[bot] 87644178b3
[CI] Bump version 3.7.1 (#2678)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-05-22 08:31:58 -07:00
..
src chore: bump Kysely to 0.29 (#2626) 2026-05-13 14:34:00 -07:00
test fix(better-auth): array support (#2617) 2026-04-27 18:12:13 -07:00
eslint.config.js feat: better-auth adapter (#416) 2025-11-17 16:57:13 -08:00
package.json [CI] Bump version 3.7.1 (#2678) 2026-05-22 08:31:58 -07:00
README.md chore: add README for better-auth adapter (#425) 2025-11-18 16:11:52 -08:00
tsconfig.json fix(better-auth): keep schema-generator import lazy in CJS output (#2658) 2026-05-07 22:48:12 -07:00
tsdown.config.ts fix(better-auth): keep schema-generator import lazy in CJS output (#2658) 2026-05-07 22:48:12 -07:00
vitest.config.ts feat: better-auth adapter (#416) 2025-11-17 16:57:13 -08:00

ZenStack Better-Auth Adapter

This package provides a database adapter for better-auth. It allows you to use ZenStack ORM as the database backend for better-auth.

Installation

npm install @zenstackhq/better-auth@next

Configuration

import { zenstackAdapter } from '@zenstackhq/better-auth';

// ZenStack ORM client
import { db } from './db';

const auth = new BetterAuth({
    database: zenstackAdapter(db, {
        provider: 'postgresql', // or 'sqlite'
    }),
    // other better-auth options...
});

Schema generation

You can use the @better-auth/cli to populate better-auth's data models into your ZModel schema.

npx @better-auth/cli generate