Skip to content

Commit 6dc5bc5

Browse files
authored
feat: auth upgrade, experimental joins, IP config & cookie cache strategy (better-auth#261)
1 parent fdc9700 commit 6dc5bc5

4 files changed

Lines changed: 57 additions & 41 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,36 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: pnpm/action-setup@v4
19-
- uses: actions/setup-node@v4
20-
with:
21-
node-version: 22
22-
cache: pnpm
23-
- run: pnpm install --frozen-lockfile
24-
- run: pnpm lint
18+
- uses: oven-sh/setup-bun@v2
19+
- run: bun install --frozen-lockfile
20+
- run: bun lint
2521

2622
format:
2723
name: Format
2824
runs-on: ubuntu-latest
2925
steps:
3026
- uses: actions/checkout@v4
31-
- uses: pnpm/action-setup@v4
32-
- uses: actions/setup-node@v4
33-
with:
34-
node-version: 22
35-
cache: pnpm
36-
- run: pnpm install --frozen-lockfile
37-
- run: pnpm fmt:check
27+
- uses: oven-sh/setup-bun@v2
28+
- run: bun install --frozen-lockfile
29+
- run: bun fmt:check
3830

3931
typecheck:
4032
name: Typecheck
4133
runs-on: ubuntu-latest
4234
steps:
4335
- uses: actions/checkout@v4
44-
- uses: pnpm/action-setup@v4
45-
- uses: actions/setup-node@v4
46-
with:
47-
node-version: 22
48-
cache: pnpm
49-
- run: pnpm install --frozen-lockfile
50-
- run: pnpm typecheck
36+
- uses: oven-sh/setup-bun@v2
37+
- run: bun install --frozen-lockfile
38+
- run: bun typecheck
5139

5240
build:
5341
name: Build
5442
runs-on: ubuntu-latest
5543
needs: [lint, format, typecheck]
5644
steps:
5745
- uses: actions/checkout@v4
58-
- uses: pnpm/action-setup@v4
59-
- uses: actions/setup-node@v4
60-
with:
61-
node-version: 22
62-
cache: pnpm
63-
- run: pnpm install --frozen-lockfile
64-
- run: pnpm build
46+
- uses: oven-sh/setup-bun@v2
47+
- run: bun install --frozen-lockfile
48+
- run: bun run build
6549
env:
6650
SKIP_ENV_VALIDATION: true

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@aws-sdk/client-s3": "^3.998.0",
1818
"@aws-sdk/s3-request-presigner": "^3.998.0",
1919
"@better-auth/infra": "0.1.9-beta.1",
20-
"@better-auth/stripe": "1.5.0-beta.18",
20+
"@better-auth/stripe": "1.5.1",
2121
"@better-auth/utils": "^0.3.1",
2222
"@mixedbread-ai/sdk": "^2.2.11",
2323
"@octokit/rest": "^22.0.1",
@@ -46,7 +46,7 @@
4646
"ai": "^6.0.97",
4747
"auth": "1.5.0-beta.18",
4848
"better-all": "^0.0.7",
49-
"better-auth": "1.5.0-beta.18",
49+
"better-auth": "1.5.1",
5050
"class-variance-authority": "^0.7.1",
5151
"clsx": "^2.1.1",
5252
"cmdk": "^1.1.1",

apps/web/src/lib/auth.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ async function getOctokitUser(token: string) {
2828
}
2929

3030
export const auth = betterAuth({
31+
appName: "Better Hub",
3132
database: prismaAdapter(prisma, {
3233
provider: "postgresql",
3334
}),
35+
experimental: {
36+
joins: true,
37+
},
3438
plugins: [
3539
dash({
3640
activityTracking: {
@@ -113,6 +117,7 @@ export const auth = betterAuth({
113117
cookieCache: {
114118
enabled: true,
115119
maxAge: 60 * 60 * 24 * 7,
120+
strategy: "jwe",
116121
},
117122
},
118123
trustedOrigins: [
@@ -123,6 +128,11 @@ export const auth = betterAuth({
123128
// Beta site
124129
"https://beta.better-hub.com",
125130
],
131+
advanced: {
132+
ipAddress: {
133+
ipAddressHeaders: ["x-vercel-forwarded-for", "x-forwarded-for"],
134+
},
135+
},
126136
});
127137

128138
export const getServerSession = cache(async () => {

0 commit comments

Comments
 (0)