@xylex-group/better-auth-athena
v1.0.9
Published
A better-Auth database adapter for @xylex-group/athena
Maintainers
Readme
better-auth-athena
current version: 1.0.9
A Better-Auth database adapter for the @xylex-group/athena gateway. It lets Better-Auth read and write data through Athena while keeping column names in snake_case as required by the gateway.
Installation
npm install better-auth-athenaThis package relies on the following peer dependencies, so ensure they are installed in your project:
npm install better-auth @xylex-group/athenaUsage
import { betterAuth } from "better-auth";
import { athenaAdapter } from "better-auth-athena";
export const auth = betterAuth({
database: athenaAdapter({
client: "my-app",
}),
});Configuration
athenaAdapter accepts the following options:
| Option | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| url | string | ❌ (if config.yaml provides it) | — | Athena gateway URL. |
| apiKey | string | ❌ (if config.yaml provides it) | — | API key used to authenticate with Athena. |
| client | string | ❌ | — | Client name included with gateway requests. |
| debugLogs | DBAdapterDebugLogOption | ❌ | false | Enables Better-Auth adapter debug logs. |
| usePlural | boolean | ❌ | false | Treats table names as plural when mapping models. |
| configPath | string | ❌ | ./config.yaml | Path to the YAML config file (resolved from process.cwd()). |
| watchConfig | boolean | ❌ | true | When enabled, reload config.yaml on changes. |
If url/apiKey are not passed, the adapter reads them from config.yaml in process.cwd(). If the file does not exist, it is generated at runtime from defaults.
Notes
findManysorting is performed in memory because the Athena SDK does not expose an order-by method on its query builder.- The adapter enables JSON, date, boolean, and numeric ID support in Better-Auth.
Development
Node.js 20.19.0 or later is required for the test/build tooling.
npm run typecheck
npm run test
npm run buildCI/CD
GitHub Actions runs the typecheck, test, and build steps for every pull request and push. Releases can be published to npm by creating a GitHub release after the CI workflow succeeds.
Contributing
See CONTRIBUTING.md for setup steps and the contribution process.
Contributors
See CONTRIBUTORS.md for the current list of project contributors.
License
MIT
