Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions packages/auth-adapters/better-auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ZenStack Better-Auth Adapter

This package provides a database adapter for [better-auth](https://better-auth.com). It allows you to use ZenStack ORM as the database backend for better-auth.

## Installation

```bash
npm install @zenstackhq/better-auth@next
```

## Configuration

```ts
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...
});
Comment on lines +13 to +24
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code example is missing the import statement for BetterAuth. Add the following import:

import { betterAuth } from 'better-auth';

Additionally, based on the better-auth library conventions, the function is typically named betterAuth (lowercase), not BetterAuth (uppercase). The example should use:

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

Copilot uses AI. Check for mistakes.
```

## Schema generation

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

```bash
npx @better-auth/cli generate
```
Loading