mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-21 14:00:08 -05:00
docs: add subsection for advanced database configuration options (#9149)
Co-authored-by: Morgan PEYRE <morgan.peyre@brickcode.tech>
This commit is contained in:
@@ -649,6 +649,26 @@ export const auth = betterAuth({
|
||||
* `skipTrailingSlashes`: Skip trailing slash validation in route matching. (default: `false`)
|
||||
* OAuth state configuration options (`storeStateStrategy`, `skipStateCookieCheck`) are now part of the `account` option
|
||||
|
||||
<h3 id="advanced-database"><code>database</code></h3>
|
||||
|
||||
Set custom strategies for ID generation and findMany queries.
|
||||
|
||||
* `generateId`: Controls how record IDs are generated. Accepts a custom function, `false`, `"serial"`, or `"uuid"` (default: [random base62 string](https://github.com/better-auth/better-auth/blob/main/packages/core/src/utils/id.ts)). See the [Database documentation](/docs/concepts/database#id-generation) for more info.
|
||||
* `defaultFindManyLimit`: The default maximum number of records returned by the `findMany` adapter method. (default: `100`)
|
||||
|
||||
```ts
|
||||
import { betterAuth } from "better-auth";
|
||||
|
||||
export const auth = betterAuth({
|
||||
advanced: {
|
||||
database: {
|
||||
generateId: "uuid",
|
||||
defaultFindManyLimit: 50,
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### `backgroundTasks`
|
||||
|
||||
Configure background task handling for deferred operations. Background tasks allow non-critical operations (like cleanup, analytics, timing-attack mitigation, or rate limit counter updates) to run after the response is sent. This can significantly improve response times on serverless platforms.
|
||||
|
||||
Reference in New Issue
Block a user