You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
retain @btst/db@2.2.3 and the 2.2.3 adapters without a Better Auth fork upgrade;
use Better Auth 1.6.16, Core 1.6.16, Utils 0.4.1, Fetch 1.2.2, and Better Call 1.3.6;
use matching API-key and passkey 1.6.16 packages only when those optional features are enabled; and
require explicit adapter transaction: true configuration when installed plugins perform atomic writes, including Form Builder and Media.
The guide must not instruct v3 users to upgrade the BTST database fork to Better Auth 1.7.2. Future fork synchronization is separate post-v3 work.
This correction supersedes preserved planning text that names Better Auth 1.7.2 as the stable-v3 target.
This was generated by AI during triage.
Current status — 2026-08-31
RC3 is already published, core #202 is complete, and better-auth-ui#20 has shipped as 2.0.0-rc.3. This issue now targets the stable-v3 guide, not an RC3 publication gate.
update the canonical migration page against the newest release candidate; and
pass docs builds, links, snippets, and clean-room migration verification before stable v3 publication.
The Better Stack Web RC3 audit is complete in better-stack-web#37. Bio Mogging #109 remains post-publication/user-owned validation and is non-blocking.
Any preserved wording below that says this work must finish before RC3 publication is superseded by this stable-release status.
Turn the existing v2-to-v3 guide into the canonical production migration and verification playbook for the final RC3 API. Preserve concise API diffs, but replace stale RC2 assumptions with the runtime/plugin design from #202, the final authorization contract delivered by #180–#193, the executable compatibility contract from #174, and the separately maintained Better Auth UI boundary documented by better-stack-ai/better-auth-ui#20.
This guide must be sufficient for a developer who did not participate in the v3 design to migrate a non-trivial full-stack application without reading source code, release-tracker comments, or retained audit lockfiles.
<StackProviderstack={stack}router={router}auth={clientAuth}initialIdentity={initialIdentity}overrides={{blog: {post: {/* actual plugin-specific customization */},},}}>{children}</StackProvider>
The exact field names must match the landed #202 API. The normative concepts are:
createClientStack owns API/site/query/request runtime and client plugin registration.
StackProvider consumes the resolved browser-safe stack projection plus framework services and optional application-owned authorization.
Plugin overrides contain only genuine plugin-specific presentation/browser behavior.
Override keys/types are inferred from registered plugins.
Omitting overrides is the canonical zero-customization path; empty blocks do not activate plugins.
Server-only headers, secrets, backend stacks, and server auth never cross into browser code.
Final authorization chapter
Remove the stale #172/#173 migration assumptions and document the landed #180–#193 contract directly:
Plugins publish schema-backed, typed permission descriptors and the minimum facts required for an operation.
Applications own the runtime identity schema and one browser-safe synchronous defineAuthorization rule set.
createClientAuth and createServerAuth resolve identity independently against the same schema; authentication finds the identity and authorization decides permissions.
Browser checks are local presentation checks and may use session claims such as role; they make no permission request and install no authorization-result cache.
The backend is authoritative: operations validate input, derive trusted facts, resolve the request identity, evaluate the declared permission, then enter lifecycle/domain execution.
Enabled authorization with no matching rule denies; omitting server authorization preserves the documented permissive compatibility behavior.
Local full-stack apps may import one browser-safe rule module on both sides. Managed/custom/separate backends share the rule-free versioned contract and may use an asynchronous remote evaluator.
Remote backends never trust browser identity or browser-supplied record facts; they resolve identity and facts authoritatively.
Ordinary denials are 401 for anonymous and 403 for authenticated callers. Identity/schema/transport/fact/policy failures remain errors rather than false.
initialIdentity is tri-state: undefined means unresolved and fetches, null means settled anonymous, and an identity means settled authenticated. Framework layout/parent-route helpers hydrate it without duplicating the initial request.
Session changes use explicit refresh/refetch at the application/framework seam.
Row/tenant query scoping is a separate server-only data concern, not boolean UI authorization.
Core exports no provider-specific auth adapter and no global open-string useCan/CanAccess API.
Include compact, type-checked client rule, server resolver, bound descriptor, operation, managed-backend contract, and hydration examples. Clearly label which modules are browser-safe, client-only, server-only, or publishable across repositories.
Better Auth UI companion boundary
After the corrected companion docs under better-stack-ai/better-auth-ui#22 are final, the core migration guide must link to and summarize the same boundary:
Better Auth is configured by the application and remains a prerequisite.
Better Auth UI reads its own Better Auth session and uses Better Auth native account/organization/permission APIs.
The companion exports no Better Auth-to-BTST client/server auth or identity factories.
Applications that want the same user in BTST authorization write a small app-owned createClientAuth/createServerAuth identity mapping; fields such as role/tenant remain application-owned.
Session synchronization is explicit: Next.js refresh, React Router revalidation, TanStack invalidation, or client-auth identity refetch.
Auth plus account is the minimal installation; organization/API-key/passkey/multi-session require matching optional Better Auth plugins.
authClient is configured once under auth, avatar only under account, exact account/organization override contracts reject auth-only fields, and route bases derive from the resolved site runtime.
Optional adapter subpaths list their extra peers; the base install does not pull them all in.
Do not duplicate the companion's complete reference guide or upstream Better Auth setup. Link to focused references and keep core's guide centered on the migration boundary.
Staged migration playbook
Preflight and exact versions — record the current baseline, select the exact stable or next cohort from Add packed npm/pnpm compatibility smoke tests #174, install cleanly with the application's package manager, and preserve a rollback point.
Constructors and runtime — migrate to canonical backend/client constructors, one client runtime, server-import-safe client plugin definitions, request-specific SSR stack creation, and the browser-safe provider projection.
Plugin registration and IDs — migrate programmatic IDs to canonical camelCase, update full-stack registration, remove duplicate API/site/query/header fields, and preserve explicit per-plugin transport boundaries.
Provider and overrides — remove manual override maps and empty activation blocks; keep only real plugin customization and framework services.
Backend factories and lifecycle hooks — migrate every used plugin to one options object, nested hooks, the final lifecycle vocabulary, and explicit required domain dependencies.
Authorization — define typed descriptors/rules/identity resolvers, preserve authoritative trusted facts and 401/403/error behavior, and audit request/trusted/raw call sites.
Framework entry points and identity hydration — adopt API/page/layout helpers, including request-aware Next.js clients and dedicated wrapper pages with synthetic params where needed.
Embedded surfaces — migrate comments, forms/direct hooks, cards/counts, and independent provider roots outside the primary catch-all layout.
Better Auth UI — migrate to the corrected v3 companion on the retained Better Auth 1.6.16 cohort, exact overrides, derived route bases, minimal optional feature set, and explicit session refresh.
Data and production verification — validate adapter/schema changes, existing records, optimized build/start, SSR/SSG/ISR, browser navigation/hydration/errors, authorization roles, and representative mutations.
The completed better-auth-ui#20 remains the source for the RC3 bridge and ownership boundary; #22 changes only the supported v3 dependency cohort and associated verification.
Stable-v3 cohort documentation correction — 2026-08-31
The stable-v3 guide must use the cohort verified by #244, better-auth-ui#22, and #174:
@btst/db@2.2.3and the2.2.3adapters without a Better Auth fork upgrade;1.6.16, Core1.6.16, Utils0.4.1, Fetch1.2.2, and Better Call1.3.6;1.6.16packages only when those optional features are enabled; andtransaction: trueconfiguration when installed plugins perform atomic writes, including Form Builder and Media.The guide must not instruct v3 users to upgrade the BTST database fork to Better Auth 1.7.2. Future fork synchronization is separate post-v3 work.
This correction supersedes preserved planning text that names Better Auth 1.7.2 as the stable-v3 target.
Current status — 2026-08-31
RC3 is already published, core #202 is complete, and better-auth-ui#20 has shipped as
2.0.0-rc.3. This issue now targets the stable-v3 guide, not an RC3 publication gate.Updated sequencing:
The Better Stack Web RC3 audit is complete in better-stack-web#37. Bio Mogging #109 remains post-publication/user-owned validation and is non-blocking.
Any preserved wording below that says this work must finish before RC3 publication is superseded by this stable-release status.
Parent
What to build
Turn the existing v2-to-v3 guide into the canonical production migration and verification playbook for the final RC3 API. Preserve concise API diffs, but replace stale RC2 assumptions with the runtime/plugin design from #202, the final authorization contract delivered by #180–#193, the executable compatibility contract from #174, and the separately maintained Better Auth UI boundary documented by
better-stack-ai/better-auth-ui#20.This guide must be sufficient for a developer who did not participate in the v3 design to migrate a non-trivial full-stack application without reading source code, release-tracker comments, or retained audit lockfiles.
Final RC3 ownership model
The migration path must consistently teach:
The exact field names must match the landed #202 API. The normative concepts are:
createClientStackowns API/site/query/request runtime and client plugin registration.StackProviderconsumes the resolved browser-safe stack projection plus framework services and optional application-owned authorization.overridesis the canonical zero-customization path; empty blocks do not activate plugins.Final authorization chapter
Remove the stale #172/#173 migration assumptions and document the landed #180–#193 contract directly:
defineAuthorizationrule set.createClientAuthandcreateServerAuthresolve identity independently against the same schema; authentication finds the identity and authorization decides permissions.role; they make no permission request and install no authorization-result cache.forRequest(request).apiis request-authorized; the trusted operation surface skips user authorization but preserves validation/domain/lifecycle; explicit raw access bypasses composition and is not the ordinary app API. Use the final names produced by [v3 RC3 DX] Centralize client runtime configuration and normalize all plugin interfaces #202.false.initialIdentityis tri-state:undefinedmeans unresolved and fetches,nullmeans settled anonymous, and an identity means settled authenticated. Framework layout/parent-route helpers hydrate it without duplicating the initial request.useCan/CanAccessAPI.Include compact, type-checked client rule, server resolver, bound descriptor, operation, managed-backend contract, and hydration examples. Clearly label which modules are browser-safe, client-only, server-only, or publishable across repositories.
Better Auth UI companion boundary
After the corrected companion docs under
better-stack-ai/better-auth-ui#22are final, the core migration guide must link to and summarize the same boundary:createClientAuth/createServerAuthidentity mapping; fields such as role/tenant remain application-owned.authClientis configured once under auth, avatar only under account, exact account/organization override contracts reject auth-only fields, and route bases derive from the resolved site runtime.Do not duplicate the companion's complete reference guide or upstream Better Auth setup. Link to focused references and keep core's guide centered on the migration boundary.
Staged migration playbook
nextcohort from Add packed npm/pnpm compatibility smoke tests #174, install cleanly with the application's package manager, and preserve a rollback point.Verification matrix
The guide must provide a copyable checklist covering:
initialIdentity;Acceptance criteria
Out of scope
Blocked by
better-stack-ai/better-auth-ui#22— corrected 1.6.16 companion cohort and companion-owned documentation.The completed better-auth-ui#20 remains the source for the RC3 bridge and ownership boundary; #22 changes only the supported v3 dependency cohort and associated verification.