docs: added more info to concept/plugins (#818)

This commit is contained in:
Multinite
2024-12-08 21:05:00 +10:00
committed by GitHub
parent 926b845aec
commit 1863bf4df9

View File

@@ -20,10 +20,11 @@ export const auth = betterAuth({
plugins: [
// Add your plugins here
]
})
});
```
Client plugins are added when creating the client. Most plugin require both server and client plugins to work correctly.
The Better-Auth auth client on the frontend uses the `createAuthClient` function provided by `better-auth/client`.
```ts title="auth-client.ts"
import { createAuthClient } from "better-auth/client";
@@ -32,9 +33,17 @@ const authClient = createAuthClient({
plugins: [
// Add your client plugins here
]
})
});
```
We recommend keeping the auth-client and your normal auth instance in separate files.
<Files>
<Folder name="auth" defaultOpen>
<File name="server.ts" />
<File name="auth-client.ts" />
</Folder>
</Files>
## Creating a Plugin
To get started, you'll need a server plugin.