Skip to content

Commit a831866

Browse files
authored
Merge pull request #426 from zenstackhq/dev
merge dev to main (better-auth README)
2 parents 5a36a7d + 4240ecd commit a831866

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ZenStack Better-Auth Adapter
2+
3+
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.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @zenstackhq/better-auth@next
9+
```
10+
11+
## Configuration
12+
13+
```ts
14+
import { zenstackAdapter } from '@zenstackhq/better-auth';
15+
16+
// ZenStack ORM client
17+
import { db } from './db';
18+
19+
const auth = new BetterAuth({
20+
database: zenstackAdapter(db, {
21+
provider: 'postgresql', // or 'sqlite'
22+
}),
23+
// other better-auth options...
24+
});
25+
```
26+
27+
## Schema generation
28+
29+
You can use the `@better-auth/cli` to populate better-auth's data models into your ZModel schema.
30+
31+
```bash
32+
npx @better-auth/cli generate
33+
```

0 commit comments

Comments
 (0)