mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
|
|
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| eslint.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| vitest.config.ts | ||
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