@quickback-dev/cli 0.72.7 → 0.72.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/commands/migrations-baseline.d.ts +2 -0
  2. package/dist/commands/migrations-baseline.d.ts.map +1 -0
  3. package/dist/commands/migrations-baseline.js +29 -0
  4. package/dist/commands/migrations-baseline.js.map +1 -0
  5. package/dist/commands/migrations.d.ts.map +1 -1
  6. package/dist/commands/migrations.js +16 -9
  7. package/dist/commands/migrations.js.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/lib/migrations/baseline.d.ts +26 -0
  10. package/dist/lib/migrations/baseline.d.ts.map +1 -0
  11. package/dist/lib/migrations/baseline.js +258 -0
  12. package/dist/lib/migrations/baseline.js.map +1 -0
  13. package/dist/lib/migrations/sqlite-baseline-worker.d.ts +3 -0
  14. package/dist/lib/migrations/sqlite-baseline-worker.d.ts.map +1 -0
  15. package/dist/lib/migrations/sqlite-baseline-worker.js +86 -0
  16. package/dist/lib/migrations/sqlite-baseline-worker.js.map +1 -0
  17. package/dist/skill/docs/api/actions.md +37 -1
  18. package/dist/skill/docs/api/openapi.md +2 -0
  19. package/dist/skill/docs/api/views.md +5 -1
  20. package/dist/skill/docs/changelog/index.md +29 -0
  21. package/dist/skill/docs/configure/agents.md +16 -0
  22. package/dist/skill/docs/configure/domains.md +1 -1
  23. package/dist/skill/docs/configure/index.md +2 -2
  24. package/dist/skill/docs/configure/single-tenant.md +1 -0
  25. package/dist/skill/docs/define/access.md +2 -0
  26. package/dist/skill/docs/define/scopes.md +1 -1
  27. package/dist/skill/docs/define/views.md +8 -0
  28. package/dist/skill/docs/platform/auth/index.md +10 -1
  29. package/dist/skill/docs/platform/auth/plugins/organization-defaults.md +37 -0
  30. package/dist/skill/docs/platform/auth/security.md +16 -0
  31. package/dist/skill/docs/platform/auth/using-auth.md +2 -0
  32. package/dist/skill/docs/platform/database/schema-baselines.md +86 -0
  33. package/dist/skill/docs/tooling/cli.md +13 -0
  34. package/dist/skill/docs/tooling/cloud-compiler/authentication.md +2 -0
  35. package/dist/skill/docs/tooling/cloud-compiler/endpoints.md +19 -1
  36. package/dist/skill/docs/ui/account/customization.md +2 -2
  37. package/dist/skill/docs/ui/account/environment-variables.md +7 -1
  38. package/dist/skill/docs/ui/account/features/admin.md +2 -2
  39. package/dist/skill/docs/ui/account/features/api-keys.md +1 -1
  40. package/dist/skill/docs/ui/account/features/index.md +10 -8
  41. package/dist/skill/docs/ui/account/features/organizations.md +19 -9
  42. package/dist/skill/docs/ui/account/features/passkeys.md +6 -2
  43. package/dist/skill/docs/ui/account/features/sessions.md +2 -2
  44. package/dist/skill/docs/ui/account/index.md +61 -30
  45. package/dist/skill/docs/ui/account/with-quickback.md +1 -1
  46. package/dist/skill/docs/ui/admin/connecting.md +1 -1
  47. package/dist/skill/docs/ui/admin/index.md +1 -1
  48. package/package.json +1 -1
  49. package/src/skill/docs/api/actions.md +37 -1
  50. package/src/skill/docs/api/openapi.md +2 -0
  51. package/src/skill/docs/api/views.md +5 -1
  52. package/src/skill/docs/changelog/index.md +29 -0
  53. package/src/skill/docs/configure/agents.md +16 -0
  54. package/src/skill/docs/configure/domains.md +1 -1
  55. package/src/skill/docs/configure/index.md +2 -2
  56. package/src/skill/docs/configure/single-tenant.md +1 -0
  57. package/src/skill/docs/define/access.md +2 -0
  58. package/src/skill/docs/define/scopes.md +1 -1
  59. package/src/skill/docs/define/views.md +8 -0
  60. package/src/skill/docs/platform/auth/index.md +10 -1
  61. package/src/skill/docs/platform/auth/plugins/organization-defaults.md +37 -0
  62. package/src/skill/docs/platform/auth/security.md +16 -0
  63. package/src/skill/docs/platform/auth/using-auth.md +2 -0
  64. package/src/skill/docs/platform/database/schema-baselines.md +86 -0
  65. package/src/skill/docs/tooling/cli.md +13 -0
  66. package/src/skill/docs/tooling/cloud-compiler/authentication.md +2 -0
  67. package/src/skill/docs/tooling/cloud-compiler/endpoints.md +19 -1
  68. package/src/skill/docs/ui/account/customization.md +2 -2
  69. package/src/skill/docs/ui/account/environment-variables.md +7 -1
  70. package/src/skill/docs/ui/account/features/admin.md +2 -2
  71. package/src/skill/docs/ui/account/features/api-keys.md +1 -1
  72. package/src/skill/docs/ui/account/features/index.md +10 -8
  73. package/src/skill/docs/ui/account/features/organizations.md +19 -9
  74. package/src/skill/docs/ui/account/features/passkeys.md +6 -2
  75. package/src/skill/docs/ui/account/features/sessions.md +2 -2
  76. package/src/skill/docs/ui/account/index.md +61 -30
  77. package/src/skill/docs/ui/account/with-quickback.md +1 -1
  78. package/src/skill/docs/ui/admin/connecting.md +1 -1
  79. package/src/skill/docs/ui/admin/index.md +1 -1
@@ -208,6 +208,14 @@ read: {
208
208
  }
209
209
  ```
210
210
 
211
+ A view can be `PUBLIC` while the rest of the resource stays members-only. On an org-scoped table an anonymous caller names the organization with `?organizationId=`; without it the view returns `403 ORG_REQUIRED`:
212
+
213
+ ```bash
214
+ GET /api/v1/jobs/views/careers?organizationId=org_abc123
215
+ ```
216
+
217
+ The view's OpenAPI operation and MCP tool declare `organizationId` for this case. See [`PUBLIC`](/define/access).
218
+
211
219
  ### Masking
212
220
 
213
221
  Masking rules are applied to the returned fields. If a view includes a masked field like `email`, the masking rules still apply:
@@ -70,7 +70,7 @@ role. Better Auth's own API is the gate for its tables.
70
70
  ## Compiler-managed auth versions and upgrades
71
71
 
72
72
  The compiler pins Better Auth, its schema CLI, and the generated companion
73
- packages to **1.7.3**. Recompile and install the emitted dependencies together;
73
+ packages to **1.7.17**. Recompile and install the emitted dependencies together;
74
74
  remove older Better Auth overrides from `build.dependencies`. An incompatible
75
75
  override is rejected because it would run a different auth version from the
76
76
  one that generated your schema.
@@ -81,6 +81,15 @@ migration history stays on your machine. Apply the newly generated auth
81
81
  migration before starting the updated Worker. Existing migration SQL is
82
82
  preserved.
83
83
 
84
+ This release includes the upstream fixes for Magic Link/OAuth account takeover,
85
+ OAuth Proxy account takeover, and concurrent PostgreSQL rate-limit bypasses.
86
+ Upgrade every deployment sharing verification storage or OAuth Proxy flows
87
+ together, including preview and development deployments. Request fresh Magic
88
+ Links and restart pending OAuth/SAML sign-in and account-linking flows after
89
+ the upgrade: state issued by older versions may no longer complete. These
90
+ security fixes do not themselves require a database schema migration; projects
91
+ upgrading from older auth schemas should still apply any emitted migrations.
92
+
84
93
  ### Upgrading from 1.6
85
94
 
86
95
  The upgrade adds the current JWT/OAuth schema, including JWKS `alg`/`crv` and
@@ -0,0 +1,37 @@
1
+ # Organization Defaults
2
+
3
+ Every Better Auth project ships `organizationDefaults()`, a Better Auth plugin the compiler emits into `src/plugins/organization-defaults/` and adds to `src/lib/auth.ts` alongside `organization()`. It needs no configuration.
4
+
5
+ ## Reserved organization slugs
6
+
7
+ An organization slug becomes a URL segment: `/account/<slug>` in the Account UI, and `<appUrl>/<slug>` in your app with the default `tenantPattern`. A slug that matches a route shadows it. An organization called `security` could never open its own page, and one called `admin` or `support` impersonates something it isn't.
8
+
9
+ The plugin refuses about 150 reserved slugs with `400` and `code: "ORGANIZATION_SLUG_RESERVED"` on:
10
+
11
+ - `POST /auth/v1/organization/create`
12
+ - `POST /auth/v1/organization/update` (renaming the slug)
13
+ - `POST /auth/v1/organization/check-slug`, so the Account UI's "is this URL available" check agrees with the write
14
+ - the operator route `POST /auth/v1/admin/create-organization`, which writes the row directly and applies the same rule
15
+
16
+ Matching is exact and case-insensitive: `home` is reserved, `home-depot` is not. The list covers:
17
+
18
+ - every top-level Account UI route (`home`, `profile`, `security`, `dashboard`, `login`, …)
19
+ - auth and account words (`settings`, `billing`, `members`, `invite`, `oauth`, …)
20
+ - platform paths (`api`, `cms`, `app`, `static`, `webhooks`, `www`, …)
21
+ - roles and system accounts (`admin`, `root`, `sysadmin`, `superuser`, `system`, …)
22
+ - common shell commands (`sudo`, `ls`, `rm`, `cd`, `git`, `curl`, …)
23
+ - values that read as code (`null`, `undefined`, `true`, `localhost`, `env`, …)
24
+
25
+ The full list is `RESERVED_ORGANIZATION_SLUGS` in `src/plugins/organization-defaults/reserved-slugs.ts`. A compiler test fails if a new top-level Account UI route is missing from it.
26
+
27
+ Organizations that already hold a reserved slug keep it. Updates that don't change the slug still work, but the org's Account page is shadowed by the route until it is renamed.
28
+
29
+ ## Default active organization
30
+
31
+ New sessions start with no active organization, so the app, the CMS, and org-scoped API calls have nothing to default to. The plugin fills that gap when the choice is unambiguous:
32
+
33
+ - **Pinned project** (`features.pinnedOrganizationId`): a member of the pinned organization starts every session in it.
34
+ - **One membership**: the session starts in that organization.
35
+ - **Several memberships, or none**: nothing is chosen; the user picks an organization in the app or the Account UI.
36
+
37
+ It never overrides an active organization the session already carries. The Account UI applies the same rule client-side for sessions created before the plugin existed.
@@ -346,6 +346,22 @@ auth: defineAuth("better-auth", {
346
346
  - Cannot selectively allow only specific subdomains
347
347
  - All-or-nothing: either exact domain only, or all subdomains
348
348
 
349
+ #### Cookie prefix
350
+
351
+ Better Auth names its cookies `<prefix>.session_token`, and the prefix is `better-auth` unless you change it:
352
+
353
+ ```ts
354
+ auth: defineAuth("better-auth", {
355
+ advanced: {
356
+ cookiePrefix: 'kindling' // cookies become kindling.session_token, …
357
+ }
358
+ })
359
+ ```
360
+
361
+ Set it when two separate Better Auth deployments live under one domain and either of them shares its cookie across subdomains. Say `auth.example.com` shares a cookie on `example.com` and a second, unrelated deployment runs at `id.team.example.com`. A browser sends both cookies to the second host, the names are the same, and which session the server reads depends on cookie order. A different prefix on one of them keeps the two apart.
362
+
363
+ Apps that share one session must use the same prefix: an identity service and every app that reads its session cookie. The prefix may contain letters, digits, `-` and `_`. Changing it on a live app signs everyone out, because the old cookie is no longer read.
364
+
349
365
  #### 2. Trusted Origins (Application-Level)
350
366
 
351
367
  ```ts
@@ -89,6 +89,8 @@ When organizations are enabled, the active organization is on the auth context a
89
89
  const orgId = c.get('ctx').activeOrgId;
90
90
  ```
91
91
 
92
+ A new session starts in the user's organization when the choice is unambiguous (the pinned organization, or their only membership). With several memberships, `activeOrgId` stays unset until the user picks one. See [Organization Defaults](/platform/auth/plugins/organization-defaults).
93
+
92
94
  > **`activeOrgId`, not `activeOrganizationId`**
93
95
  >
94
96
  > `activeOrganizationId` is Better Auth's *session* field name (`session.session.activeOrganizationId`). Quickback canonicalises it to `ctx.activeOrgId`; firewall rules written against `ctx.activeOrganizationId` are rewritten to `ctx.activeOrgId` at compile time.
@@ -0,0 +1,86 @@
1
+ # Schema Baselines
2
+
3
+ `quickback migrations baseline` replaces a long **D1/SQLite schema history**
4
+ with a compact baseline. It uses the project's pinned `drizzle-kit@0.31.10`
5
+ and requires Node.js 22.13 or newer for the isolated SQLite replay. The rest
6
+ of the CLI retains its existing Node requirement.
7
+
8
+ ```bash
9
+ quickback migrations baseline --database features # preview; migration files unchanged
10
+ quickback migrations baseline --database features --write # explicit local cutover
11
+ quickback migrations baseline --database auth --write # separate history/database
12
+ ```
13
+
14
+ This first version supports `auth` and `features` histories with SQLite v6
15
+ Drizzle snapshots and Wrangler's default `d1_migrations` ledger. It does not
16
+ support PostgreSQL, tenant Durable Objects, custom/broker-managed migration ledgers, virtual
17
+ tables, or histories that attach databases/load extensions. It refuses unknown
18
+ arguments, broken journals, missing SQL, broken snapshot chains and symlinks.
19
+ No command here connects to a database or invokes Wrangler. Use the standard
20
+ Wrangler D1 migration runner for adoption; broker-managed deployment ledgers
21
+ require a separate adoption protocol and are not supported.
22
+
23
+ ## What is compacted
24
+
25
+ The command replays the SQL history in an isolated in-memory SQLite process,
26
+ validates the final snapshot through Drizzle, and checks its table, column,
27
+ foreign-key and index contracts. It exports the final tables, indexes, views,
28
+ triggers, migration seed rows (including blobs and large integers), and
29
+ AUTOINCREMENT sequences. Seed expressions such as random ids or timestamps are
30
+ materialized at preparation time; the SQL filename addresses those actual bytes. Replaying the proposed baseline must reproduce that
31
+ state exactly and pass foreign-key checks.
32
+
33
+ The result is one `0000_quickback_baseline_<digest>.sql` and a rooted snapshot
34
+ and journal. A compiler-owned trigger document, when present, remains as a
35
+ second SQL migration under its content hash. This preserves trigger deduplication
36
+ and later trigger removal; concatenating old SQL would not do that. Custom
37
+ triggers remain in the schema baseline, after the seed inserts.
38
+
39
+ `--write` uses the same project migration lock as builds, rechecks the source
40
+ inventory, stages the complete tree, and keeps the original tree byte-for-byte
41
+ under `quickback/.archives/migration-baselines/<database>/<digest>/`. It writes
42
+ reviewable `manifest.json` and `adopt.sql` under
43
+ `quickback/baselines/<database>/<digest>/`. Commit the baseline and review
44
+ artifacts. Keep the archive until every deployed database has crossed over;
45
+ standard Quickback ignores `.archives/`. An ordinary write failure restores
46
+ the original tree. If the process or machine dies during the rename cutover,
47
+ recover the original tree from that archive before another build or deploy.
48
+
49
+ This is an explicit replacement path. Normal `quickback build` remains additive
50
+ and never rewrites applied migrations. `meta/_baseline.json` retains retired
51
+ ledger names so a later rebaseline can recognize previously adopted databases.
52
+
53
+ ## Fresh versus existing databases
54
+
55
+ **Fresh databases:** apply the compact SQL files normally with Wrangler. Each
56
+ migration is applied in a transaction; the schema baseline defers foreign keys
57
+ while inserting its seed rows. A baseline is a schema bootstrap, not an export
58
+ of production rows or encrypted integration secrets.
59
+
60
+ **Existing databases:** do not run the baseline's CREATE statements against them.
61
+
62
+ 1. Back up each target and stop deployment jobs that could apply migrations.
63
+ 2. Using the original history, apply every pending migration up to the cutoff.
64
+ 3. Prepare and review the baseline locally. Rebuild the project and inspect the
65
+ next Drizzle migration; an unchanged schema should produce none.
66
+ 4. Test `adopt.sql` against a populated local copy or disposable staging target.
67
+ 5. Execute the reviewed `adopt.sql` on each matching existing D1 database **before**
68
+ running normal migration application with the compacted files.
69
+ 6. Apply subsequent migrations and test the application. Repeat independently
70
+ for auth/features and every environment.
71
+
72
+ The adoption SQL performs a single atomic INSERT into `d1_migrations`. It
73
+ requires every source migration name, permits only known retired/baseline names,
74
+ and checks the exact schema catalog, including triggers and indexes. A mismatch
75
+ raises a malformed-JSON error and records **no** baseline names. Equivalent
76
+ schemas with different SQL text are deliberately refused; investigate instead
77
+ of bypassing the guard. A repeat adoption inserts no duplicate names. Old ledger
78
+ rows are retained, and application tables/rows are never changed by adoption.
79
+ The generated statement is limited to a conservative 64 KiB; larger statements
80
+ refuse preparation rather than produce an unchecked cutover.
81
+
82
+ Do not edit the manifest or adoption guard to silence a mismatch. Missing history
83
+ must be recovered from a trusted archive or deployment artifact, not invented.
84
+ A new baseline changes which migration filenames are pending on an existing
85
+ DB, so deploying compacted files without the adoption step will attempt to
86
+ recreate tables.
@@ -355,6 +355,19 @@ also writes `.dev.vars.example` with every declared secret, for local
355
355
  `wrangler dev`. Neon and PlanetScale keep their own template, and any declared
356
356
  secret it lacks is appended to it.
357
357
 
358
+ ### Compact D1 Schema Migrations
359
+
360
+ ```bash
361
+ quickback migrations baseline --database features
362
+ quickback migrations baseline --database features --write
363
+ ```
364
+
365
+ Preview by default. `--write` stages a compact Drizzle baseline, preserves the
366
+ original history, and writes guarded adoption SQL for existing databases.
367
+ Supports D1 auth/features histories; requires Node 22.13+ and the pinned
368
+ Drizzle version. Read [Schema Baselines](/platform/database/schema-baselines)
369
+ before deploying compacted files to an existing database.
370
+
358
371
  ### Run Data Migrations
359
372
 
360
373
  ```bash
@@ -30,6 +30,8 @@ The API key takes precedence over stored credentials from `quickback login`.
30
30
 
31
31
  The compiler-cloud worker validates authentication by forwarding your credentials to the Quickback API's Better Auth `GET /auth/v1/get-session` endpoint via a [Cloudflare service binding](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). This resolves both session tokens (from `quickback login`) and API keys (from `QUICKBACK_API_KEY`, sent as `x-api-key` — `get-session` is the only Better Auth endpoint that accepts a key in place of a session).
32
32
 
33
+ A valid session is enough for a validation compile. A complete compile also needs the account behind it — the session's user, or the API key's owner — to be non-anonymous with a verified email, and it counts toward a daily per-account limit. See [Who can run which compile](/tooling/cloud-compiler/endpoints#who-can-run-which-compile).
34
+
33
35
  ## Credential Storage
34
36
 
35
37
  Credentials are stored at `~/.quickback/credentials.json`:
@@ -19,6 +19,24 @@ The cloud compiler API is hosted at `https://compiler.quickback.dev`
19
19
 
20
20
  The `/compile` endpoint requires either a session token (from `quickback login`) or an API key (via `QUICKBACK_API_KEY` header). See [Authentication](/tooling/cloud-compiler/authentication) for details.
21
21
 
22
+ ### Who can run which compile
23
+
24
+ | Compile | Who |
25
+ |---------|-----|
26
+ | Validation (`?complete=false`) | Any session, including an anonymous one. [Start](https://start.quickback.dev) runs them for signed-out visitors through its own server-side token. |
27
+ | Complete (`?complete=true`, the default) | A Quickback account that is **not anonymous** and has a **verified email**, within a per-account daily limit. |
28
+
29
+ A complete compile that is refused answers with a JSON body carrying `error`, `code` and `hint`:
30
+
31
+ | Status | `code` | Meaning |
32
+ |--------|--------|---------|
33
+ | 403 | `ANONYMOUS_SESSION` | Anonymous sessions run validation compiles only. Create an account and run `quickback login`. |
34
+ | 403 | `EMAIL_NOT_VERIFIED` | Verify your email address first. |
35
+ | 403 | `BUILDER_ACCESS_REQUIRED` | Complete compiles are limited to approved accounts while access is in private beta. |
36
+ | 429 | `COMPILE_QUOTA_EXCEEDED` | The account used its complete compiles for the day. `Retry-After` gives the seconds until the limit resets at 00:00 UTC. |
37
+
38
+ Every admitted complete compile that counts toward the limit carries `X-Quickback-Compile-Quota-Limit` and `X-Quickback-Compile-Quota-Remaining`. A compile that never ran (all compiler instances busy, `503 COMPILER_BUSY`) does not count. Validation compiles are never limited this way.
39
+
22
40
  ## Raw-files mode (`POST /compile`)
23
41
 
24
42
  `/compile` normally expects the parsed `CompilerInput` the CLI assembles client-side. Thin clients (agents, web builders, CI without the CLI) can instead send the project sources verbatim and let the compiler organize them server-side:
@@ -61,7 +79,7 @@ without producing a runtime writes exactly the tagged files from a
61
79
 
62
80
  ## Edge validation backend
63
81
 
64
- Validation compiles (`POST /compile?complete=false`) may be served by an edge Worker instead of the compiler container. This is **transparent to clients**: same endpoint, same auth, same request and response shapes (plain or gzipped JSON, raw-files or parsed input, identical payload limits, error shapes, and generated-file envelopes) — just no container cold start.
82
+ Validation compiles (`POST /compile?complete=false`) are served by an edge Worker instead of the compiler container. The edge Worker has no public URL of its own; `compiler.quickback.dev` checks auth and then forwards to it. This is **transparent to clients**: same endpoint, same auth, same request and response shapes (plain or gzipped JSON, raw-files or parsed input, identical payload limits, error shapes, and generated-file envelopes) — just no container cold start.
65
83
 
66
84
  The response header `X-Quickback-Compile-Backend` says which backend answered:
67
85
 
@@ -93,7 +93,7 @@ setAppConfig({
93
93
  | `privacy` | "Privacy Policy" | Footer link text |
94
94
  | `support` | "Contact Support" | Footer link text |
95
95
  | `company` | (from `VITE_COMPANY_NAME`) | Footer company name |
96
- | `organizations` | "Organizations" | Navigation and page titles. Profile and the user menu prefix this as **Manage …** (`Manage Organizations`). |
96
+ | `organizations` | "Organizations" | Navigation, the switcher, and Home. The singular form (trailing `s` dropped) labels **New …** and **… settings**, so `"Workspaces"` gives **New workspace**. |
97
97
 
98
98
  ## Custom Messages
99
99
 
@@ -153,7 +153,7 @@ setAppConfig({
153
153
  welcome: '/getting-started',
154
154
  },
155
155
  authenticated: {
156
- dashboard: '/dashboard',
156
+ home: '/home',
157
157
  profile: '/my-account',
158
158
  settings: '/preferences',
159
159
  },
@@ -149,6 +149,7 @@ Enable or disable features using boolean environment variables. **Every flag car
149
149
  |---|---|---|
150
150
  | `VITE_ENABLE_ORGANIZATIONS` | `organizations` | `false` |
151
151
  | `VITE_ENABLE_ORG_TEAMS` | `orgTeams` | `false` |
152
+ | `VITE_ENABLE_ORG_CREATION` | `orgCreation` | `false` |
152
153
  | `VITE_ENABLE_ADMIN` | `admin` | `false` |
153
154
  | `VITE_ENABLE_FILE_UPLOADS` | `fileUploads` | `false` |
154
155
  | `VITE_ENABLE_PASSKEY` | `passkey` | `false` |
@@ -193,7 +194,12 @@ VITE_ENABLE_REALTIME=false # default: false
193
194
  VITE_ENABLE_ORGANIZATIONS=false # default: false
194
195
  VITE_ENABLE_ORG_TEAMS=false # default: false
195
196
  # Auto-set to true when the BA config has organization({ teams: { enabled: true } }).
196
- # When false the Teams tab is hidden and the auth client doesn't expose team APIs.
197
+ # When false the Teams page is hidden and the auth client doesn't expose team APIs.
198
+ VITE_ENABLE_ORG_CREATION=false # default: false
199
+ # Auto-set to true when the BA config sets
200
+ # plugins.organization.allowUserToCreateOrganization: true. When false there is no
201
+ # "New organization" button and /organizations/new redirects home (the server
202
+ # closes POST /organization/create; operators create orgs from Admin).
197
203
 
198
204
  # Admin
199
205
  VITE_ENABLE_ADMIN=false # default: false — the compiler always emits it explicitly
@@ -72,7 +72,7 @@ curl -X POST https://api.example.com/auth/v1/admin/set-role \
72
72
 
73
73
  Better Auth's `organization.create` seats whoever calls it. For an operator that is an escalation rather than a convenience: the membership it grants is tenant-data access — under `cms.access: "member"`, access to that organization's records — which is exactly what the `appmanager`/`sysadmin` split withholds.
74
74
 
75
- So organization creation asks for an `ownerUserId`, seats that user, and never seats the caller. Self-serve creation (`POST /auth/v1/organization/create`) is closed by default for the same reason; a project that wants it sets `plugins.organization.allowUserToCreateOrganization: true`.
75
+ So organization creation asks for an `ownerUserId`, seats that user, and never seats the caller. Self-serve creation (`POST /auth/v1/organization/create`) is closed by default for the same reason; a project that wants it sets `plugins.organization.allowUserToCreateOrganization: true`. Account UI follows the same setting: it shows **New organization** (and serves `/organizations/new`) only when that option is `true`. Both routes refuse [reserved slugs](/platform/auth/plugins/organization-defaults#reserved-organization-slugs).
76
76
 
77
77
  An operator who genuinely wants their own organization creates one naming themselves as owner — explicit, and visible in the audit trail rather than implied by whoever happened to make the call.
78
78
 
@@ -127,7 +127,7 @@ The admin domain serves the same Account SPA at root (`/`). The SPA's client-sid
127
127
 
128
128
  ## CMS Access Control
129
129
 
130
- When both CMS and Account UI are enabled, the Account profile shows a CMS action. It opens the sole organization directly or lets a multi-organization user choose one first. You can restrict this to the sysadmin tier only:
130
+ When both CMS and Account UI are enabled, the Account top bar and Home show a CMS action. It opens the current (or sole) organization directly, or lets a multi-organization user choose one first. You can restrict this to the sysadmin tier only:
131
131
 
132
132
  ```typescript
133
133
  cms: { domain: "cms.example.com", access: "sysadmin" },
@@ -1,6 +1,6 @@
1
1
  # API Key Management
2
2
 
3
- API keys are a user credential. Manage them at `/api-keys`, linked from `/profile`. The `apiKey` plugin is on by default.
3
+ API keys are a user credential. Manage them at `/api-keys` (**API keys** under Account in the sidebar). The `apiKey` plugin is on by default.
4
4
 
5
5
  ## Creating API Keys
6
6
 
@@ -11,18 +11,20 @@ Control which features are available in your Account UI deployment using feature
11
11
 
12
12
  ### `appConfig.features`
13
13
 
14
- These eleven flags populate `appConfig.features` and are the ones `isFeatureEnabled()` accepts.
14
+ These thirteen flags populate `appConfig.features` and are the ones `isFeatureEnabled()` accepts.
15
15
 
16
16
  | Variable | `features` key | Default |
17
17
  |---|---|---|
18
18
  | `VITE_ENABLE_ORGANIZATIONS` | `organizations` | `false` |
19
19
  | `VITE_ENABLE_ORG_TEAMS` | `orgTeams` | `false` |
20
+ | `VITE_ENABLE_ORG_CREATION` | `orgCreation` | `false` |
20
21
  | `VITE_ENABLE_ADMIN` | `admin` | `false` |
21
22
  | `VITE_ENABLE_FILE_UPLOADS` | `fileUploads` | `false` |
22
23
  | `VITE_ENABLE_PASSKEY` | `passkey` | `false` |
23
24
  | `VITE_ENABLE_EMAIL_OTP` | `emailOTP` | `false` |
24
25
  | `VITE_ENABLE_PASSWORD` | `password` | `true` |
25
26
  | `VITE_ENABLE_GOOGLE_OAUTH` | `googleOAuth` | `false` |
27
+ | `VITE_ENABLE_CLOUDFLARE_OAUTH` | `cloudflareOAuth` | `false` |
26
28
  | `VITE_ENABLE_SUBSCRIPTIONS` | `subscriptions` | `false` |
27
29
  | `VITE_ENABLE_REALTIME` | `realtime` | `false` |
28
30
  | `VITE_ENABLE_API_KEYS` | `apiKeys` | `true` |
@@ -176,10 +178,10 @@ VITE_ENABLE_GOOGLE_OAUTH=false # default: false
176
178
 
177
179
  **When enabled:**
178
180
  - "Continue with Google" button on the login and signup pages
179
- - Google row on `/connected-accounts` (linked from **Manage Connected Accounts** on `/profile`)
181
+ - Google row under **Connected accounts** on `/security`
180
182
 
181
183
  **When disabled:**
182
- - No social sign-in button, no **Manage Connected Accounts** link, no `/connected-accounts` page
184
+ - No social sign-in button and no **Connected accounts** card on `/security`
183
185
 
184
186
  **Requirements:**
185
187
  - Google OAuth credentials configured on the Better Auth side
@@ -192,7 +194,7 @@ VITE_ENABLE_CLOUDFLARE_OAUTH=false # default: false
192
194
 
193
195
  **When enabled:**
194
196
  - "Continue with Cloudflare" button on the login and signup pages
195
- - Cloudflare rows on `/connected-accounts` — unlike
197
+ - Cloudflare rows under **Connected accounts** on `/security` — unlike
196
198
  Google, more than one Cloudflare identity can be linked to the same user
197
199
  (**Connect another Cloudflare account**), and every linked identity signs
198
200
  in to this user. Link work and personal Cloudflare logins here so each one
@@ -265,11 +267,11 @@ VITE_ENABLE_ORGANIZATIONS=false # default: false
265
267
  ```
266
268
 
267
269
  **When enabled:**
268
- - `/dashboard` lists organizations and pending invitations
269
- - Organization management pages (`/$slug`)
270
+ - Home (`/home`) lists your organizations, each with **Open** / **CMS** / settings, plus pending invitations
271
+ - The organization switcher in the top bar (a plain label with one organization, a menu with several)
272
+ - The organization sidebar group: General (`/$slug`), Members, Teams, Billing
270
273
  - Member invitations and roles
271
- - `/organizations/*` routes
272
- - Sign-in still lands on `/profile`; **Manage Organizations** opens `/dashboard`
274
+ - `/organizations/new`, only when `VITE_ENABLE_ORG_CREATION` is also on
273
275
 
274
276
  **When disabled:**
275
277
  - Single-user mode only
@@ -1,37 +1,43 @@
1
1
  # Organizations
2
2
 
3
- Account UI provides a complete organization management interface when `VITE_ENABLE_ORGANIZATIONS=true`. `/dashboard` is that surface: the organizations you belong to and pending invitations. **Manage Organizations** on `/profile` (and in the user menu) opens it. Personal account settings live on `/profile`. The profile **Go to…** picker opens the tenant app using `account.appUrl` and `account.tenantPattern` — see [Customization](/ui/account/customization#tenant-url-patterns). When CMS is enabled, the profile also offers an access-aware CMS action: one membership opens directly, several memberships produce a picker, and the selected organization is made active before navigation. A pinned project targets only its configured organization; it never labels another membership as the CMS destination. Teams are a separate opt-in (`VITE_ENABLE_ORG_TEAMS`), surfaced when the compiler detects `organization({ teams: { enabled: true } })` in the Better Auth config.
3
+ Account UI provides a complete organization management interface when `VITE_ENABLE_ORGANIZATIONS=true`.
4
+
5
+ - **Home** (`/home`) lists the organizations you belong to, each with **Open** (the tenant app, via `account.appUrl` and `account.tenantPattern`; see [Customization](/ui/account/customization#tenant-url-patterns)), **CMS**, and a settings gear. Pending invitations sit above the list.
6
+ - **The top bar** shows the organization you're in. With one organization it is a plain label. With several it is a switcher: picking an organization opens it in the app, and its gear opens its settings.
7
+ - **The sidebar** has a group for the current organization: **General**, **Members**, **Teams**, **Billing**.
8
+
9
+ Opening the app or the CMS for an organization makes it the session's active organization first. With exactly one organization, sessions start with it active ([Organization Defaults](/platform/auth/plugins/organization-defaults)). A pinned project (`features.pinnedOrganizationId`) shows only its configured organization and never offers another membership. Teams are a separate opt-in (`VITE_ENABLE_ORG_TEAMS`), surfaced when the compiler detects `organization({ teams: { enabled: true } })` in the Better Auth config.
4
10
 
5
11
  ## Organization CRUD
6
12
 
7
- - Create new organizations, with `checkSlug` debounce on the slug field
8
- - Update name, **slug** (rename navigates to the new URL), and **metadata** (JSON object)
13
+ - Create new organizations at `/organizations/new`, with `checkSlug` debounce on the slug field. Reserved slugs (`home`, `admin`, `api`, `sudo`, …) are refused with the server's reason; see [Organization Defaults](/platform/auth/plugins/organization-defaults). Only offered when the project allows self-serve creation (`plugins.organization.allowUserToCreateOrganization: true`, surfaced as `VITE_ENABLE_ORG_CREATION`). Otherwise operators create organizations from [Admin](/ui/account/features/admin)
14
+ - **General** (`/$slug`): update name, **slug** (rename navigates to the new URL), and **metadata** (JSON object). Members without `organization:update` see a read-only summary
9
15
  - **Logo upload** only when `account.fileUploads: true` **and** managed R2 is configured with valid credentials (`R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`). Start apps leave this off. See [Avatars](/ui/account/features/avatars).
10
16
  - Delete organizations — gated on the `organization:delete` permission (default: owner)
11
17
 
12
18
  ## Member Management
13
19
 
14
- - Invite members by email (with an optional team picker when teams are enabled)
20
+ - **Members** (`/$slug/members`): the member list with an **Invite** button. Invite by email, with an optional team picker when teams are enabled
15
21
  - Assign roles: **owner**, **admin**, **member**
16
22
  - Change roles and remove members — actions are filtered per-target by the role hierarchy (non-owners can't manage owner-role members)
17
- - Leave the organization
23
+ - Leave the organization from **General** (owners can't leave; they transfer ownership or delete)
18
24
 
19
25
  > **Note:** These three roles (`owner`, `admin`, `member`) are Better Auth's built-in organization roles and map directly to Account UI's role picker. Use the same roles in your Quickback [Access](/define/access) rules — with [`auth.roleHierarchy`](/define/access#role-hierarchy) configured, you can write `roles: ["member+"]` to mean "member and above." [Custom org roles](/define/access#custom-org-roles) declared in your access trees are auto-registered with the organization plugin, so `invite-member` / `update-member-role` accept them too.
20
26
 
21
27
  ## Invitations
22
28
 
23
- - Pending invitation list, per organization
29
+ - Pending invitations per organization, under the member list on **Members** (the old `/$slug/invitations` path redirects there)
24
30
  - Resend, cancel (per-org), accept, and reject (per-user)
25
- - Pending invites across organizations land on the user's `/dashboard`
31
+ - Pending invites across organizations appear on the user's Home, with Accept / Decline
26
32
  - Invitations carry an optional `teamId` when teams are enabled — the invitee joins that team on accept
27
33
 
28
34
  ## Teams
29
35
 
30
36
  Set `organization({ teams: { enabled: true } })` in your Better Auth config. The compiler emits `VITE_ENABLE_ORG_TEAMS=true` and the SPA exposes:
31
37
 
32
- - **Teams tab** on each organization, split into "Your teams" and "Other teams"
38
+ - **Teams** page on each organization, split into "Your teams" and "Other teams"
33
39
  - **Team detail** page with member roster, add/remove members
34
- - **Active-team picker** in the organization header — switches `session.activeTeamId` via `setActiveTeam`, so server-side handlers can scope by team
40
+ - **Active-team picker** on the Teams page — switches `session.activeTeamId` via `setActiveTeam`, so server-side handlers can scope by team
35
41
  - **Team-aware invitations** — when sending an invite, optionally pick a team; the member is added on accept
36
42
 
37
43
  Per-team actions (create / rename / delete / add-member / remove-member) gate on the `team:create`, `team:update`, and `team:delete` permissions from Better Auth's default statements.
@@ -48,3 +54,7 @@ This means projects that ship custom roles get a UI that matches what their serv
48
54
 
49
55
  - [Environment Variables](/ui/account/environment-variables)
50
56
  - [Account UI Overview](/ui/account)
57
+
58
+ ## Billing
59
+
60
+ When subscriptions are on (`VITE_ENABLE_SUBSCRIPTIONS`), each organization has a **Billing** page (`/$slug/billing`) showing its plan and subscription status. Operators manage subscriptions for every organization from **Admin → Subscriptions**.
@@ -1,6 +1,6 @@
1
1
  # Passkeys
2
2
 
3
- When the passkey feature is enabled (`enablePasskey` on the runtime config, default: `false`), Account UI provides passkey registration and management. When it is off, the passkey routes guard themselves at runtime — direct navigation redirects away and the management pages never render.
3
+ When the passkey feature is enabled (`enablePasskey` on the runtime config, default: `false`), Account UI provides passkey registration and management. Passkeys are managed on **Security** (`/security`); the old `/passkeys` path redirects there. When the feature is off, the Passkeys card, the Home prompt, and `/passkeys/setup` are hidden, and direct navigation redirects away.
4
4
 
5
5
  ## Passkey Registration
6
6
 
@@ -16,9 +16,13 @@ When the passkey feature is enabled (`enablePasskey` on the runtime config, defa
16
16
 
17
17
  ## Managing Passkeys
18
18
 
19
+ On **Security** (`/security`):
20
+
19
21
  - View registered passkeys
20
22
  - Remove individual passkeys
21
- - Register additional passkeys
23
+ - Register additional passkeys, with an optional name
24
+
25
+ Home shows an **Add a passkey** prompt while you have none.
22
26
 
23
27
  ## Requirements
24
28
 
@@ -1,6 +1,6 @@
1
1
  # Session Management
2
2
 
3
- Account UI includes a session management page where users can view and revoke their active sessions.
3
+ **Sessions** (`/devices`, under Account in the sidebar) lists your active sessions and lets you revoke them.
4
4
 
5
5
  ## Active Sessions
6
6
 
@@ -14,7 +14,7 @@ Users can see all devices where they're currently logged in, including:
14
14
 
15
15
  Users can revoke any session except their current one. This immediately invalidates the session token.
16
16
 
17
- Two events revoke other sessions without a click: changing the password from the profile page (the UI sends `revokeOtherSessions: true`), and resetting it through the forgot-password flow (the server default `revokeSessionsOnPasswordReset: true`, see [Session Freshness and Password Reset](/platform/auth/security#session-freshness-and-password-reset)).
17
+ Two events revoke other sessions without a click: changing the password with the current password on **Security** (the UI sends `revokeOtherSessions: true`), and resetting it with an emailed code — on **Security** when email OTP is on, or through the forgot-password flow (the server default `revokeSessionsOnPasswordReset: true`, see [Session Freshness and Password Reset](/platform/auth/security#session-freshness-and-password-reset)).
18
18
 
19
19
  ## Related
20
20