diff --git a/packages/auth-adapters/better-auth/README.md b/packages/auth-adapters/better-auth/README.md new file mode 100644 index 00000000..fc75d2a4 --- /dev/null +++ b/packages/auth-adapters/better-auth/README.md @@ -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... +}); +``` + +## 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 +```