mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-30 02:46:44 -05:00
docs: added more info to concept/plugins (#818)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user