Skip to content

Commit fa0e81b

Browse files
authored
Merge pull request #281 from better-stack-ai/upgrade/upstream-auth-20260929
Upgrade BTST to Better Auth 1.7 and companion UI 3
2 parents 48cb6e8 + 775a912 commit fa0e81b

42 files changed

Lines changed: 1104 additions & 5137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Pack Better Auth UI
2+
description: Build the pinned companion source for coordinated release consumers.
3+
outputs:
4+
tarball:
5+
description: Absolute path to the packed companion.
6+
value: ${{ steps.pack.outputs.tarball }}
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Checkout Better Auth UI
11+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12+
with:
13+
repository: better-stack-ai/better-auth-ui
14+
ref: 29e8dd41b50f1382f968078630aa00f15137a8ab # 3.0.0 companion candidate
15+
path: .packed-consumer/better-auth-ui
16+
- name: Install and build Better Auth UI
17+
shell: bash
18+
working-directory: .packed-consumer/better-auth-ui
19+
run: |
20+
corepack pnpm@10.26.2 install --ignore-workspace --frozen-lockfile
21+
corepack pnpm@10.26.2 build
22+
- name: Pack Better Auth UI
23+
id: pack
24+
shell: bash
25+
working-directory: .packed-consumer/better-auth-ui
26+
run: |
27+
mkdir -p "$RUNNER_TEMP/better-auth-ui"
28+
tarball="$(npm pack --quiet --pack-destination "$RUNNER_TEMP/better-auth-ui")"
29+
echo "tarball=$RUNNER_TEMP/better-auth-ui/$tarball" >> "$GITHUB_OUTPUT"

‎.github/workflows/init.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ jobs:
4343
- name: Verify historical Next.js migration hashes
4444
run: pnpm --filter @btst/codegen legacy-next-hashes:check
4545

46+
- name: Pack pinned Better Auth UI
47+
id: pack-auth-ui
48+
uses: ./.github/actions/pack-auth-ui
49+
4650
- name: Run init harness
4751
working-directory: packages/cli
4852
run: bash scripts/test-init.sh
4953
timeout-minutes: 20
5054
env:
55+
BTST_AUTH_UI_TARBALL: ${{ steps.pack-auth-ui.outputs.tarball }}
5156
CI: true
5257

5358
- name: Upload artifacts on failure
@@ -79,9 +84,14 @@ jobs:
7984
- name: Install dependencies
8085
run: pnpm install --frozen-lockfile
8186

87+
- name: Pack pinned Better Auth UI
88+
id: pack-auth-ui
89+
uses: ./.github/actions/pack-auth-ui
90+
8291
- name: Run packed framework fixtures
8392
run: pnpm --filter @btst/codegen test:better-auth-ui-fixtures
8493
env:
94+
BTST_AUTH_UI_TARBALL: ${{ steps.pack-auth-ui.outputs.tarball }}
8595
BTST_KEEP_FIXTURES: 1
8696
CI: true
8797

‎.github/workflows/packed-consumers.yml‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ jobs:
5959
- name: Checkout Better Stack
6060
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6161

62-
- name: Checkout Better Auth UI
63-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64-
with:
65-
repository: better-stack-ai/better-auth-ui
66-
ref: f5f4f36fdeeb6060c7f95dce6706a3559bdbe5b7 # 2.0.1 companion
67-
path: .packed-consumer/better-auth-ui
68-
6962
- name: Setup pnpm
7063
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
7164

@@ -78,19 +71,9 @@ jobs:
7871
- name: Install Better Stack workspace dependencies
7972
run: pnpm install --frozen-lockfile
8073

81-
- name: Install and build Better Auth UI
82-
working-directory: .packed-consumer/better-auth-ui
83-
run: |
84-
corepack pnpm@10.26.2 install --ignore-workspace --frozen-lockfile
85-
corepack pnpm@10.26.2 build
86-
87-
- name: Pack Better Auth UI
74+
- name: Pack pinned Better Auth UI
8875
id: pack-auth-ui
89-
working-directory: .packed-consumer/better-auth-ui
90-
run: |
91-
mkdir -p "$RUNNER_TEMP/better-auth-ui"
92-
tarball="$(npm pack --quiet --pack-destination "$RUNNER_TEMP/better-auth-ui")"
93-
echo "tarball=$RUNNER_TEMP/better-auth-ui/$tarball" >> "$GITHUB_OUTPUT"
76+
uses: ./.github/actions/pack-auth-ui
9477

9578
- name: Test harness
9679
run: pnpm test:packed-consumers

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ Render the generated `<Toaster />` in your root layout and start from a clean co
5252
Run the released generator from the application root:
5353

5454
```bash
55-
pnpm dlx @btst/codegen@0.2.1 init \
55+
pnpm dlx @btst/codegen@4.0.0 init \
5656
--framework nextjs \
5757
--adapter memory \
5858
--plugins blog
5959
```
6060

61-
The generator shows detected-file and conflict prompts before it writes. It installs `@btst/stack@3.0.2`, `next-themes@0.4.6`, registers Blog on the backend and client, mounts the API and page routes, adds the plugin CSS, and wires the shared provider.
61+
The generator shows detected-file and conflict prompts before it writes. It installs `@btst/stack@4.0.0`, `next-themes@0.4.6`, registers Blog on the backend and client, mounts the API and page routes, adds the plugin CSS, and wires the shared provider.
6262

6363
Set the trusted local origins in `.env.local`:
6464

‎docs/content/docs/breaking-changes.mdx‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,59 @@ This page documents breaking changes between major versions and provides migrati
1010

1111
---
1212

13+
## v3 → v4: Better Auth 1.7 and Better Auth UI 1.7
14+
15+
BTST v4 uses Better DB 3, rebased onto Better Auth 1.7.6. The optional
16+
`@btst/better-auth-ui` 3 plugin packages upstream Better Auth UI 1.7.26
17+
React/shadcn components and connects them to BTST routing and shared services.
18+
Existing BTST backend plugins and framework entry factories retain their APIs.
19+
20+
Upgrade the packages together:
21+
22+
| Package | Version |
23+
| --- | --- |
24+
| `@btst/stack`, `@btst/codegen` | `4.0.0` |
25+
| `@btst/db`, selected `@btst/adapter-*`, `@btst/cli` | `3.0.0` |
26+
| Optional `@btst/better-auth-ui` | `3.0.0` |
27+
| `better-auth`, `@better-auth/core` | `1.7.6` |
28+
| `@better-auth/utils` | `0.4.2` |
29+
| `@better-fetch/fetch` | `1.3.2` |
30+
| `better-call` | `1.4.0` |
31+
| React and React DOM | `>=19.2.6` |
32+
| Tailwind CSS and its PostCSS/Vite integration | `>=4.3.2` |
33+
| `@tanstack/react-query`, `@tanstack/query-core` | `5.102.0` |
34+
35+
For example, a Drizzle application can install the core cohort with:
36+
37+
```bash
38+
pnpm add --save-exact @btst/stack@4.0.0 @btst/adapter-drizzle@3.0.0 \
39+
better-auth@1.7.6 @better-auth/core@1.7.6 \
40+
@better-auth/utils@0.4.2 @better-fetch/fetch@1.3.2 better-call@1.4.0
41+
pnpm add --save-dev --save-exact @btst/codegen@4.0.0
42+
```
43+
44+
Use Drizzle ORM `^0.45.2` or a compatible 1.0 release candidate supported by
45+
the adapter. Better Auth moved native joins from `experimental.joins` to
46+
`advanced.database.joins`; the BTST adapters enable native joins automatically.
47+
If the application configures this directly on its Better Auth instance, migrate
48+
that setting too.
49+
50+
Keep React Query and Query Core on the same tested version. The generated
51+
TanStack Start integration uses `5.102.0`; Query Core `5.104.0` changes hydration
52+
behavior at the end of its SSR query stream.
53+
54+
The Better Auth UI companion now uses upstream feature plugins. Follow the
55+
[Better Auth UI companion guide](/plugins/better-auth-ui) to migrate provider
56+
configuration and select optional features. Applications continue to own their
57+
Better Auth server, credentials, schema migrations, and authorization policy.
58+
59+
Run the application's typecheck, production build, sign-in/account flows, and
60+
any enabled organization/admin/billing flows before deployment. Keep the previous
61+
application artifact and lockfile available while verifying production. The
62+
older version tables below describe their historical migrations.
63+
64+
---
65+
1366
## v2 or release candidate → stable v3: production playbook
1467

1568
Use this section as the canonical migration order for a production application.

‎docs/content/docs/cli.mdx‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BTST has two CLI packages:
1313
- `@btst/cli` owns low-level DB schema generation and migrations
1414

1515
`@btst/codegen generate` and `@btst/codegen migrate` run the aligned
16-
`@btst/cli@2.2.4` release in isolation. This avoids adding its dependency graph
16+
`@btst/cli@3.0.0` release in isolation. This avoids adding its dependency graph
1717
or competing `btst` binary to the application. The delegated CLI still loads
1818
the configuration, environment files, aliases, Better Auth adapter, and ORM
1919
peers from the application directory.
@@ -71,7 +71,7 @@ npx @btst/codegen migrate --config=lib/stack.ts --database-url=postgres://...
7171
```
7272

7373
When a delegated command fails, fix the underlying issue and run the equivalent
74-
`npx @btst/cli@2.2.4 ...` command directly.
74+
`npx @btst/cli@3.0.0 ...` command directly.
7575

7676
## About Better DB
7777

@@ -83,7 +83,7 @@ For v3 applications, prefer the codegen passthrough commands above. If a v2
8383
application lists `@btst/cli` in its dependencies, remove it during migration;
8484
the pinned one-off CLI keeps Better DB dependencies from polluting the consumer
8585
graph. You can still invoke the low-level CLI directly with
86-
`npx @btst/cli@2.2.4`.
86+
`npx @btst/cli@3.0.0`.
8787

8888
## Parameters
8989

@@ -101,13 +101,13 @@ Generate database schemas for your ORM from your BTST `dbSchema`:
101101
<Tabs items={["prisma", "drizzle", "kysely"]}>
102102
<Tab value="prisma">
103103
```bash
104-
npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=prisma --output=schema.prisma
104+
npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=prisma --output=schema.prisma
105105
```
106106
</Tab>
107107

108108
<Tab value="drizzle">
109109
```bash
110-
npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=drizzle --output=src/db/schema.ts
110+
npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=drizzle --output=src/db/schema.ts
111111
```
112112
</Tab>
113113

@@ -117,17 +117,17 @@ Generate database schemas for your ORM from your BTST `dbSchema`:
117117
**Using DATABASE_URL environment variable:**
118118

119119
```bash
120-
DATABASE_URL=sqlite:./dev.db npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql
120+
DATABASE_URL=sqlite:./dev.db npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql
121121
```
122122

123123
**Or using --database-url flag:**
124124

125125
```bash
126-
npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql --database-url=sqlite:./dev.db
126+
npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql --database-url=sqlite:./dev.db
127127
```
128128

129129
```bash
130-
npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql --database-url=postgres://user:pass@localhost:5432/db
130+
npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=kysely --output=migrations/schema.sql --database-url=postgres://user:pass@localhost:5432/db
131131
```
132132
</Tab>
133133
</Tabs>
@@ -140,25 +140,25 @@ Migrate your database schema directly (Kysely only). For Prisma and Drizzle, use
140140
**Using DATABASE_URL environment variable:**
141141

142142
```bash
143-
DATABASE_URL=sqlite:./dev.db npx @btst/cli@2.2.4 migrate --config=lib/stack.ts
143+
DATABASE_URL=sqlite:./dev.db npx @btst/cli@3.0.0 migrate --config=lib/stack.ts
144144
```
145145

146146
**Or using --database-url flag:**
147147

148148
```bash
149-
npx @btst/cli@2.2.4 migrate --config=lib/stack.ts --database-url=sqlite:./dev.db
149+
npx @btst/cli@3.0.0 migrate --config=lib/stack.ts --database-url=sqlite:./dev.db
150150
```
151151

152152
```bash
153-
npx @btst/cli@2.2.4 migrate --config=lib/stack.ts --database-url=postgres://user:pass@localhost:5432/db
153+
npx @btst/cli@3.0.0 migrate --config=lib/stack.ts --database-url=postgres://user:pass@localhost:5432/db
154154
```
155155

156156
### Generate SQL to File
157157

158158
Instead of running migrations directly, generate SQL to a file:
159159

160160
```bash
161-
npx @btst/cli@2.2.4 migrate --config=lib/stack.ts --output=migrations.sql --database-url=sqlite:./dev.db
161+
npx @btst/cli@3.0.0 migrate --config=lib/stack.ts --output=migrations.sql --database-url=sqlite:./dev.db
162162
```
163163

164164
## Project config loading
@@ -179,5 +179,5 @@ project context as the application:
179179
You can still override a value for one command:
180180

181181
```bash
182-
SOME_VAR=value npx @btst/cli@2.2.4 generate --config=lib/stack.ts --orm=prisma --output=schema.prisma
182+
SOME_VAR=value npx @btst/cli@3.0.0 generate --config=lib/stack.ts --orm=prisma --output=schema.prisma
183183
```

‎docs/content/docs/databases/adapters.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The memory adapter remains useful for local, single-process development where
8989
the plugin documents serialized access. It is not a production isolation
9090
substitute. The generated scaffold rejects Form Builder with memory or MongoDB
9191
and Media with MongoDB; use Prisma, Drizzle, or Kysely for those production
92-
configurations. `@btst/codegen@0.2.0 init` adds `transaction: true`
92+
configurations. `@btst/codegen@4.0.0 init` adds `transaction: true`
9393
automatically for all four atomic-write plugins: AI Chat, Form Builder, Kanban,
9494
and Media.
9595

‎docs/content/docs/installation.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ choice.
2525
### Quickstart prerequisites
2626

2727
- Node.js 22 and an existing Next.js App Router application
28-
- shadcn/ui initialized with CSS variables and Tailwind configured
28+
- React and React DOM 19.2.6 or newer
29+
- shadcn/ui initialized with CSS variables and Tailwind CSS 4.3.2 or newer
2930
- a clean commit or working tree you can review after the generator patches it
3031
- the shadcn Button, dropdown menu, and Sonner components, with `<Toaster />`
3132
rendered in the root layout
@@ -56,7 +57,7 @@ below lists them explicitly.
5657
Run this command from the existing application root:
5758

5859
```bash
59-
npx @btst/codegen@0.2.1 init \
60+
npx @btst/codegen@4.0.0 init \
6061
--framework nextjs \
6162
--adapter memory \
6263
--plugins blog

0 commit comments

Comments
 (0)