feat: add @better-auth/infra dash plugin

This commit is contained in:
jake committed 2026-09-26 14:03:02 -04:00
1 parent a9859215f2
commit 3e3e9a04a3
4 files changed
+72 -6

No files matched your search

+17 -3
View File
@@ -1,4 +1,6 @@
import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2";
import { dash } from "@better-auth/infra";
import { waitUntil } from "@vercel/functions";
import { type BetterAuthOptions, betterAuth } from "better-auth/minimal";
import { nextCookies } from "better-auth/next-js";
@@ -6,16 +8,17 @@ import { db } from "@/lib/db";
import * as schema from "@/lib/db/schema";
export const auth = betterAuth({
appName: "jarv.is",
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
database: drizzleAdapter(db, {
provider: "pg",
schema,
}),
plugins: [nextCookies()],
plugins: [dash(), nextCookies()],
socialProviders: {
github: {
clientId: process.env.AUTH_GITHUB_CLIENT_ID!,
clientSecret: process.env.AUTH_GITHUB_CLIENT_SECRET!,
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
mapProfileToUser: (profile) => ({
name: profile.login,
email: profile.email,
@@ -24,4 +27,15 @@ export const auth = betterAuth({
}),
},
},
advanced: {
database: {
joins: true,
},
backgroundTasks: {
handler: waitUntil,
},
ipAddress: {
ipAddressHeaders: ["x-vercel-forwarded-for", "x-forwarded-for"],
},
},
} satisfies BetterAuthOptions);