Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/better-auth-fmodata-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@proofkit/better-auth": minor
"@proofkit/fmodata": patch
---

BREAKING(@proofkit/better-auth): Use fmodata Database object instead of raw OData config.
Config now requires `database` (fmodata Database instance) instead of
`odata: { serverUrl, auth, database }`.
Enables fetch override via FMServerConnection's fetchClientOptions.
36 changes: 19 additions & 17 deletions apps/docs/content/docs/better-auth/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,38 @@ This automated setup expects you to have Next.js and shadcn/ui set up in your pr

Run the following command to add the necessary packages and config files to your project. You will not need to follow the better-auth installation guide.
<CliCommand command="add better-auth" exec />

# Step 1b: Manual Setup

Follow the [Better-Auth installation guide](https://better-auth.com/docs/installation) to get started in your app, but come back here for special instructions for anything related to your Database Setup or schema migrations.

### Database Setup

Ensure you have the @proofkit/better-auth package installed in your app.
<PackageInstall packages="@proofkit/better-auth" />
Ensure you have the @proofkit/better-auth and @proofkit/fmodata packages installed in your app.
<PackageInstall packages="@proofkit/better-auth @proofkit/fmodata" />

Configure your database connection in your `auth.ts` file. Be sure to set these value secrets in your environment variables. The credentials you use here need `fmodata` permissions enabled, and read/write access to the better-auth tables.
```ts title="auth.ts"
import { betterAuth } from "better-auth";
import { FMServerConnection } from "@proofkit/fmodata";
import { FileMakerAdapter } from "@proofkit/better-auth";

const connection = new FMServerConnection({
serverUrl: process.env.FM_SERVER_URL!,
auth: {
// option 1: username/password credentials
username: process.env.FM_USERNAME!,
password: process.env.FM_PASSWORD!,

// option 2: Data API key (OttoFMS 4.11+, OData enabled for the key)
// apiKey: process.env.OTTO_API_KEY!,
},
});

const db = connection.database(process.env.FM_DATABASE!);

export const auth = betterAuth({
database: FileMakerAdapter({
odata: {
serverUrl: process.env.FM_SERVER_URL,
auth: {
// option 1: username/password credentials
username: process.env.FM_USERNAME,
password: process.env.FM_PASSWORD,

// option 2: Data API key (OttoFMS 4.11+, OData enabled for the key)
// apiKey: process.env.OTTO_API_KEY,
},
database: process.env.FM_DATABASE,
},
}),
database: FileMakerAdapter({ database: db }),
// ...rest of your config
});
```
Expand Down
7 changes: 2 additions & 5 deletions packages/better-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,21 @@
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@commander-js/extra-typings": "^14.0.0",
"@proofkit/fmodata": "workspace:*",
"@tanstack/vite-config": "^0.2.1",
"better-auth": "^1.4.11",
"c12": "^3.3.3",
"chalk": "5.4.1",
"commander": "^14.0.2",
"dotenv": "^16.6.1",
"fs-extra": "^11.3.3",
"neverthrow": "^8.2.0",
"odata-query": "^8.0.7",
"prompts": "^2.4.2",
"vite": "^6.4.1",
"zod": "^4.3.5"
"vite": "^6.4.1"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/prompts": "^2.4.9",
"@vitest/ui": "^3.2.4",
"fm-odata-client": "^3.0.2",
"publint": "^0.3.16",
"typescript": "^5.9.3",
"vitest": "^4.0.17"
Expand Down
Loading
Loading