Installation & Usage
This package is currently in beta. Please report any issues you find to the GitHub repository, or reach out to us in the Community
Follow the Better-Auth installation guide 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.
npm install @proofkit/better-auth
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.
import { betterAuth } from "better-auth";
import { FileMakerAdapter } from "@proofkit/better-auth";
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,
},
}),
});
Create Database Tables
Run the following command to create the necessary tables and fields in your FileMaker file.
pnpm dlx @proofkit/better-auth@latest migrate
[Full Access] credentials are required for the schema changes to be applied automatically, but you may want to use a more restricted account for the rest of better-auth usage. If your credentials that you entered eariler in the auth.ts
file do not have the [Full Access] permissions, you can override them in the CLI.
pnpm dlx @proofkit/better-auth@latest migrate --username "full_access_username" --password "full_access_password"
If you make any schema-related changes to the better-auth config, such as adding plugins, you will need to run the migration command again to apply the changes to your FileMaker file.
Next Steps
Now that you have your database setup and your tables created, you can continue with the Better-Auth installation guide to get your app up and running.