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

+4 -3
View File
@@ -1,7 +1,8 @@
AUTH_GITHUB_CLIENT_ID=
AUTH_GITHUB_CLIENT_SECRET=
AUTH_SECRET=
BETTER_AUTH_API_KEY=
BETTER_AUTH_SECRET=
DATABASE_URL=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_TOKEN=
NEXT_PUBLIC_BASE_URL=
NEXT_PUBLIC_GITHUB_REPO=
+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);
+1
View File
@@ -24,6 +24,7 @@
"dependencies": {
"@base-ui/react": "^1.8.0",
"@better-auth/drizzle-adapter": "^1.7.6",
"@better-auth/infra": "^0.4.11",
"@fontsource/inter": "^5.3.0",
"@mdx-js/loader": "^3.1.1",
"@mdx-js/react": "^3.1.1",
+50
View File
@@ -172,6 +172,9 @@ importers:
'@better-auth/drizzle-adapter':
specifier: ^1.7.6
version: 1.7.6(@better-auth/core@1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4))(@better-auth/utils@0.4.2)(drizzle-orm@1.0.0-rc.5-5935859(@types/pg@8.23.1)(pg@8.23.0)(zod@4.6.5))
'@better-auth/infra':
specifier: ^0.4.11
version: 0.4.11(@better-auth/core@1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4))(better-auth@1.7.6(drizzle-kit@1.0.0-rc.5-5935859)(drizzle-orm@1.0.0-rc.5-5935859(@types/pg@8.23.1)(pg@8.23.0)(zod@4.6.5))(next@16.3.6(@babel/core@7.29.7)(@types/node@26.6.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(pg@8.23.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(zod@4.6.5)
'@fontsource/inter':
specifier: ^5.3.0
version: 5.3.0
@@ -584,6 +587,29 @@ packages:
drizzle-orm:
optional: true
'@better-auth/infra@0.4.11':
resolution: {integrity: sha512-zVhoFkauVUhyOkSEU4Hob9osLUhpc0DHE34lhXGIxTenlvJRCuQINaOvZ9Boi2BjQJlkUUxSkGYLxlkPaMpyVw==}
peerDependencies:
'@better-auth/core': '>=1.4.0'
'@react-native-async-storage/async-storage': '>=1.21.0'
better-auth: '>=1.4.0'
expo-constants: '>=16.0.0'
expo-crypto: '>=13.0.0'
expo-device: '>=6.0.0'
react-native: '>=0.74.0'
zod: '>=4.1.12'
peerDependenciesMeta:
'@react-native-async-storage/async-storage':
optional: true
expo-constants:
optional: true
expo-crypto:
optional: true
expo-device:
optional: true
react-native:
optional: true
'@better-auth/kysely-adapter@1.7.6':
resolution: {integrity: sha512-BV+DX2/z/6ozNC9DYSge78wjLerq6Bxd/lSPjzzuq9eEutkQDAJTuiaETzgGYqNV5LlEWi8TZFAQTEq/wavOEQ==}
peerDependencies:
@@ -1865,6 +1891,10 @@ packages:
resolution: {integrity: sha512-TcbdH3YtGS2KU98T99dN4sbf+E4vbJZsJTRN97wKQ7QWQ0BR7U02QX3KN4+5GHxBtKTj1c5CnvTTitc2ZRad0A==}
engines: {node: '>= 20'}
'@xmldom/xmldom@0.9.12':
resolution: {integrity: sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==}
engines: {node: '>=14.6'}
accepts@2.0.0:
resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
engines: {node: '>= 0.6'}
@@ -3001,6 +3031,9 @@ packages:
resolution: {integrity: sha512-hHaB8C/rfzDDtr/t8YZwxAuPJTT0zHyaPoVzcXwDYhYNAgH/4sIfVhi/XLLIY+bL/FqaIJnjATDbi8ObSELmxg==}
engines: {node: '>=22.0.0'}
libphonenumber-js@1.13.14:
resolution: {integrity: sha512-llihgCcx0BFLksecLP+x1J+6JDE1GsXS1RN/LoPF6qcwpeQcnjj0lcvZxY8AzbEpYwyZWPZW/nDuqkqzm3amiw==}
lightningcss-android-arm64@1.32.0:
resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==}
engines: {node: '>= 12.0.0'}
@@ -4502,6 +4535,19 @@ snapshots:
optionalDependencies:
drizzle-orm: 1.0.0-rc.5-5935859(@types/pg@8.23.1)(pg@8.23.0)(zod@4.6.5)
'@better-auth/infra@0.4.11(@better-auth/core@1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4))(better-auth@1.7.6(drizzle-kit@1.0.0-rc.5-5935859)(drizzle-orm@1.0.0-rc.5-5935859(@types/pg@8.23.1)(pg@8.23.0)(zod@4.6.5))(next@16.3.6(@babel/core@7.29.7)(@types/node@26.6.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(pg@8.23.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(zod@4.6.5)':
dependencies:
'@better-auth/core': 1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4)
'@better-auth/utils': 0.4.2
'@better-fetch/fetch': 1.3.2
'@noble/hashes': 2.4.0
'@xmldom/xmldom': 0.9.12
better-auth: 1.7.6(drizzle-kit@1.0.0-rc.5-5935859)(drizzle-orm@1.0.0-rc.5-5935859(@types/pg@8.23.1)(pg@8.23.0)(zod@4.6.5))(next@16.3.6(@babel/core@7.29.7)(@types/node@26.6.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(pg@8.23.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
better-call: 1.4.0(zod@4.6.5)
jose: 6.2.12
libphonenumber-js: 1.13.14
zod: 4.6.5
'@better-auth/kysely-adapter@1.7.6(@better-auth/core@1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4))(@better-auth/utils@0.4.2)(kysely@0.29.6)':
dependencies:
'@better-auth/core': 1.7.6(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.4)
@@ -5435,6 +5481,8 @@ snapshots:
'@vercel/cli-exec': 1.0.1
jose: 5.10.0
'@xmldom/xmldom@0.9.12': {}
accepts@2.0.0:
dependencies:
mime-types: 3.0.2
@@ -6406,6 +6454,8 @@ snapshots:
kysely@0.29.6: {}
libphonenumber-js@1.13.14: {}
lightningcss-android-arm64@1.32.0:
optional: true