@quickback-dev/cli 0.18.0 → 0.31.1

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 (72) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +17 -1
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/docs/content.d.ts.map +1 -1
  5. package/dist/docs/content.js +23 -58
  6. package/dist/docs/content.js.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/api-client.d.ts +17 -0
  9. package/dist/lib/api-client.d.ts.map +1 -1
  10. package/dist/lib/api-client.js.map +1 -1
  11. package/dist/lib/file-loader.d.ts +24 -0
  12. package/dist/lib/file-loader.d.ts.map +1 -1
  13. package/dist/lib/file-loader.js +46 -0
  14. package/dist/lib/file-loader.js.map +1 -1
  15. package/dist/skill/docs/changelog.md +423 -1
  16. package/dist/skill/docs/compiler/config/domains.md +44 -10
  17. package/dist/skill/docs/compiler/config/output.md +1 -1
  18. package/dist/skill/docs/compiler/config/providers.md +6 -12
  19. package/dist/skill/docs/compiler/config/variables.md +0 -30
  20. package/dist/skill/docs/compiler/definitions/access.md +203 -1
  21. package/dist/skill/docs/compiler/definitions/actions.md +40 -7
  22. package/dist/skill/docs/compiler/definitions/schema.md +6 -10
  23. package/dist/skill/docs/compiler/index.md +15 -34
  24. package/dist/skill/docs/compiler/targets/hono-api/cloudflare.md +1 -2
  25. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +0 -1
  26. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +19 -0
  27. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +1 -1
  28. package/dist/skill/docs/compiler/targets/index.md +6 -34
  29. package/dist/skill/docs/index.md +2 -5
  30. package/dist/skill/docs/stack/account-ui/customization.md +2 -14
  31. package/dist/skill/docs/stack/account-ui/environment-variables.md +7 -1
  32. package/dist/skill/docs/stack/account-ui/features/avatars.md +2 -4
  33. package/dist/skill/docs/stack/account-ui/features/index.md +1 -1
  34. package/dist/skill/docs/stack/account-ui/features/organizations.md +31 -11
  35. package/dist/skill/docs/stack/account-ui/index.md +5 -43
  36. package/dist/skill/docs/stack/account-ui/with-quickback.md +2 -75
  37. package/dist/skill/docs/stack/auth/plugins/index.md +74 -0
  38. package/package.json +1 -1
  39. package/src/skill/docs/changelog.md +362 -0
  40. package/src/skill/docs/compiler/config/providers.md +6 -12
  41. package/src/skill/docs/compiler/config/variables.md +0 -30
  42. package/src/skill/docs/compiler/definitions/access.md +203 -1
  43. package/src/skill/docs/compiler/definitions/actions.md +40 -7
  44. package/src/skill/docs/compiler/definitions/schema.md +6 -10
  45. package/src/skill/docs/compiler/index.md +15 -34
  46. package/src/skill/docs/compiler/targets/hono-api/cloudflare.md +1 -2
  47. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +0 -1
  48. package/src/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +19 -0
  49. package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +1 -1
  50. package/src/skill/docs/compiler/targets/index.md +6 -34
  51. package/src/skill/docs/index.md +2 -5
  52. package/src/skill/docs/stack/account-ui/customization.md +2 -14
  53. package/src/skill/docs/stack/account-ui/environment-variables.md +7 -1
  54. package/src/skill/docs/stack/account-ui/features/avatars.md +2 -4
  55. package/src/skill/docs/stack/account-ui/features/index.md +1 -1
  56. package/src/skill/docs/stack/account-ui/features/organizations.md +31 -11
  57. package/src/skill/docs/stack/account-ui/index.md +5 -43
  58. package/src/skill/docs/stack/account-ui/with-quickback.md +2 -75
  59. package/dist/skill/docs/compiler/targets/supabase-rls/index.md +0 -55
  60. package/dist/skill/docs/compiler/targets/supabase-rls/limitations.md +0 -48
  61. package/dist/skill/docs/compiler/targets/supabase-rls/mappings.md +0 -99
  62. package/dist/skill/docs/compiler/targets/supabase-rls/setup.md +0 -88
  63. package/dist/skill/docs/stack/account-ui/library-usage.md +0 -257
  64. package/dist/skill/docs/stack/account-ui/standalone.md +0 -149
  65. package/dist/skill/docs/stack/account-ui/worker.md +0 -362
  66. package/src/skill/docs/compiler/targets/supabase-rls/index.md +0 -55
  67. package/src/skill/docs/compiler/targets/supabase-rls/limitations.md +0 -48
  68. package/src/skill/docs/compiler/targets/supabase-rls/mappings.md +0 -99
  69. package/src/skill/docs/compiler/targets/supabase-rls/setup.md +0 -88
  70. package/src/skill/docs/stack/account-ui/library-usage.md +0 -257
  71. package/src/skill/docs/stack/account-ui/standalone.md +0 -149
  72. package/src/skill/docs/stack/account-ui/worker.md +0 -362
@@ -1,5 +1,367 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.24.0 — May 19, 2026
4
+
5
+ ### Cross-feature namespaces: one hoisted gate, many features
6
+
7
+ v0.23 shipped `defineTable({ namespace: { prefix, via } })` — a hoisted relationship-resolver middleware that gates every standalone action in *one feature's* Hono app. That covers the 95% case where a domain concept (events) and the actions under it all live in the same feature directory.
8
+
9
+ v0.24 lifts the namespace to the project level so it can span multiple features. A new `authz.namespaces` block on `quickback.config.ts` declares a path-prefix gate that any feature's standalone action can participate in by matching the prefix in its `path:`. One synthetic routes file, one resolver mount, one relationship match per request — regardless of how many feature directories contribute actions.
10
+
11
+ ```ts
12
+ // quickback.config.ts
13
+ authz: {
14
+ relationships: {
15
+ attendeeOf: {
16
+ from: 'guests',
17
+ subject: { column: 'userId', equals: 'ctx.userId' },
18
+ resource: { column: 'eventId' },
19
+ loads: 'events',
20
+ exposeAs: 'event',
21
+ },
22
+ },
23
+ namespaces: {
24
+ eventScope: { prefix: '/event/:eventId', via: 'attendeeOf' },
25
+ },
26
+ }
27
+
28
+ // features/feeds/actions/feed-moments.ts (cross-feature)
29
+ export default defineAction({
30
+ path: '/event/:eventId/feed-moments',
31
+ method: 'POST',
32
+ // No gate boilerplate. ctx.event is typed.
33
+ });
34
+
35
+ // features/rsvp/actions/respond.ts (different feature, same namespace)
36
+ export default defineAction({
37
+ path: '/event/:eventId/respond',
38
+ method: 'POST',
39
+ });
40
+ ```
41
+
42
+ The compiler emits one `src/routes/__namespace-event-scope.routes.ts` mounted at `/api/v1/event/:eventId/*`. The file imports each contributing feature's `actions` map under a distinct alias (`feedsActions`, `rsvpActions`), runs the `attendeeOf` resolver once per request at the head of the file, and dispatches to the matching action handler.
43
+
44
+ #### Discovery is path-prefix-only
45
+
46
+ No new `namespace: 'eventScope'` field on `defineAction`. Actions opt in by matching `path:` against a declared namespace prefix — same model the table-level v0.23 form uses, just lifted to the project level. This means actions move in/out of the namespace based on their path strings, which is the simplest discovery story and matches today's convention (filenames and paths are already the discoverable surface).
47
+
48
+ #### Source-feature stays the action's home for metadata
49
+
50
+ OpenAPI tags, MCP tool grouping, and CMS form discovery continue to bucket each action under its source feature. Only the *runtime routes file* moves to the synthetic location — the feed-moments action is still tagged "feeds" in OpenAPI, the response shape doesn't change, and your generated SDK reads identically. The URL conveys the namespace membership without forcing every layer of the compiler to re-anchor the action.
51
+
52
+ #### Worker-root mount order
53
+
54
+ Synthetic namespace routes files register at priority `20` — ahead of per-feature mounts (priority `0`/`10`). `sortRoutesBySpecificity` keeps the order stable, and the namespace prefix's path parameter makes it sort more specific than `/api/v1/<feature>` anyway, so the middleware fires first for every request under its prefix.
55
+
56
+ #### Compile-time guardrails
57
+
58
+ The same v0.23 invariants apply at the project level, with two additions:
59
+
60
+ - **`via:` must point at a declared `authz.relationships[*]` entry**, and that relationship must declare `loads + exposeAs` — without `loads` there's nothing for the middleware to hydrate, and a namespace that only gates without hydrating is indistinguishable from a per-action access rule.
61
+ - **`prefix:` must contain at least one `:param` segment** — middleware runs before input parsing, so the relationship key comes from `c.req.param()`.
62
+ - **Same-name conflict** between `defineTable({ namespace })` and `authz.namespaces.<sameName>` is rejected. Pick one declaration site.
63
+ - **Ambiguous prefixes** like `/a/:x` and `/a/:y` (same shape, different `:param` names) error at compile time. Strict super/sub-set relationships (e.g. `/event/:e` and `/event/:e/admin`) are fine — the harvester routes each action to the longest matching prefix.
64
+ - **Unused namespace warning** emits `[quickback:authz]` when no standalone action's path matches a declared prefix. Not a hard error — the namespace may be staged ahead of the actions.
65
+
66
+ #### Picking the right declaration site
67
+
68
+ The table-level v0.23 form is now the **single-feature shorthand**. The project-level v0.24 form is **canonical for cross-feature**.
69
+
70
+ - **Use `defineTable({ namespace })`** when every action under the prefix lives in the same feature directory. The namespace travels with the table that owns it; nothing to add to `quickback.config.ts`.
71
+ - **Use `authz.namespaces`** when the namespace spans features. The declaration sits next to your `authz.relationships` and `authz.roles` — the canonical home for cross-cutting authz config.
72
+
73
+ The two forms can't coexist for the same namespace name. If a v0.23 table-level namespace is starting to attract cross-feature actions, lift it to `authz.namespaces` — same shape, just at the project level, and the matching paths in other features will join automatically.
74
+
75
+ #### Migration
76
+
77
+ Zero breaking changes. Nothing in v0.23 needs to change for v0.24 to land. The new field is opt-in; existing projects pick it up the moment they declare an `authz.namespaces` entry.
78
+
79
+ The harvester runs after Zod schema validation but before route generation, so unused or misconfigured namespaces surface immediately as errors or warnings rather than as silently-broken routes.
80
+
81
+ ---
82
+
83
+ ## v0.23.0 — May 19, 2026
84
+
85
+ ### Authz relationships: compile-time guarantees, less boilerplate, hoisted middleware
86
+
87
+ This release closes the gap between what `authz.relationships` *promised* in v0.19 and what it actually enforced. Every documented invariant is now a real compile-time check; every per-action ergonomic friction has a fix. Net effect: relationship-based authorization feels native — declare the relationship once, use the role anywhere, the compiler does the wiring.
88
+
89
+ #### Compile-time guarantees (the authz `firewall` parity)
90
+
91
+ The org/owner/team firewall has always been compile-time-checked: a routed resource without a scope fails the compile, full stop. As of this release, `authz.relationships` carries the same guarantees:
92
+
93
+ - **Bad `via:` names fail at parse time.** A typo in a firewall predicate (`firewall: [{ field: 'eventId', via: 'guestOff' }]`) used to surface deep inside the firewall generator after most validation had passed. It's now caught alongside the `authz.roles` `via:` validation, same layer, same error format.
94
+ - **Relationship-from tables can't opt out.** The doc at `define/types/authz.ts:73-74` always said a relationship `from:` table with `firewall: { exception: true }` "refuses to compile" — that's now enforced. Without this check, every `via:` subquery that pivots through an exception-marked table loses tenant isolation and can return rows from other tenants.
95
+ - **`allowResourceMigration` is now mandatory** when the relationship's `resource.column` is on a writable update endpoint. A guest doing `PATCH /messages/:id { eventId: <other-event-id> }` to migrate a row out of their access scope used to slip past the runtime — it now fails compile with a three-option remediation (set the flag, mark the column immutable, or drop it from the guards.updatable allowlist).
96
+ - **`via: string[]` in firewall predicates.** "Member of attendees OR speakers" no longer requires inventing a composite role just to use it once in a firewall — `firewall: [{ field: 'eventId', via: ['attendeeOf', 'speakerOf'] }]` lowers to an OR-combined subquery.
97
+
98
+ #### Less boilerplate: auto-derivation + realtime resolver
99
+
100
+ - **`resource.column` auto-derives from FKs.** Omit it and the compiler scans the relationship's `from:` table for foreign-key columns, drops the `subject.column`, and picks the remaining FK. One match → auto; zero or many → error with the candidate list. Pattern mirrors the existing firewall auto-detection.
101
+ - **`realtime.requiredRoles` accepts authz roles.** Previously a relationship-role in `realtime.requiredRoles` fell through with a misleading "unknown role" error. The compiler now flattens declared authz roles into their composing Better Auth roles before the realtime ticket-handshake sees them. Relationship-only roles (no static BA fallback) emit a `[quickback:authz]` warning and fail-close at handshake — the row-stream firewall continues to enforce the relationship dimension on the data side.
102
+
103
+ #### Record-based actions can finally use relationship-roles
104
+
105
+ The v0.19 fail-closed hardening had an unintended side effect: a record-based action with `access: { roles: ['attendee'] }` (where `attendee` was a relationship-role) 403'd every caller, including the legitimate ones. The runtime helper couldn't evaluate `relationship:` arms, so it fail-closed correctly — but the inline match expression that *would* evaluate the relationship was never wired up for record-based actions.
106
+
107
+ This release routes record-based actions with relationship arms through the same inline access generator the resource CRUD path already uses. `roles: ['attendee']` on `/applications/:id/recap` now actually checks whether the caller is an attendee, with the loaded record in scope. Non-relationship access trees keep the runtime path unchanged.
108
+
109
+ #### Typed `ctx.<exposeAs>` in action handlers
110
+
111
+ When a relationship declares `loads: 'events', exposeAs: 'event'`, the runtime hydrates `ctx.event` with the loaded row — but the static type was always `any`, so handlers had to write `const event = ctx.event as typeof events.$inferSelect`. As of this release, when an action's access references **exactly one** relationship with `loads + exposeAs`, the compiler emits the cast for you at the execute() call site. Handlers read `ctx.event` with the right shape; no per-handler boilerplate.
112
+
113
+ Multi-arm OR actions (referencing two relationships with hydration) keep the `any` shape — we can't statically know which arm matched.
114
+
115
+ #### New: `defineNamespace` — one mount, one resolver, many actions
116
+
117
+ The marquee Wave 3 change. Today's pattern for "five standalone actions under `/event/:eventId/*` all gated by `attendeeOf`" requires writing the same inline relationship resolver in each action — and pays the resolver cost (one subquery, one row-load) on every request, multiplied by N actions. The new `namespace` field on `defineTable` hoists the resolver into a single Hono middleware mount:
118
+
119
+ ```ts
120
+ // features/events/events.ts
121
+ export default defineTable(events, {
122
+ firewall: [...],
123
+ crud: { ... },
124
+ namespace: {
125
+ prefix: '/event/:eventId', // absolute URL path the mount covers
126
+ via: 'attendeeOf', // relationship gate
127
+ },
128
+ });
129
+
130
+ // features/events/actions/post-announcement.ts
131
+ export default defineAction({
132
+ path: '/event/:eventId/announcements',
133
+ method: 'POST',
134
+ // No relationship-gate boilerplate. ctx.event is typed
135
+ // `typeof events.$inferSelect` inside execute().
136
+ });
137
+ ```
138
+
139
+ The compiler:
140
+ 1. Emits one `app.use('/:eventId/*', async (c, next) => { /* relationship resolver */; await next(); })` at the head of the feature's standalone-routes file (path-prefix stripping handles the feature mount).
141
+ 2. Skips the inline relationship resolver in every per-action handler under the prefix — the middleware already ran it.
142
+ 3. Hydrates `ctx.event` once per request and threads the typed cast into every namespace action's execute() call.
143
+
144
+ **Validation guardrails:**
145
+ - `namespace.via` must point at a declared `authz.relationships[*]` entry.
146
+ - The referenced relationship must declare `loads + exposeAs` — without `loads` there's nothing for the middleware to hydrate, and the namespace gate would be indistinguishable from a per-action access rule.
147
+ - `namespace.prefix` must contain at least one `:param` segment — the middleware reads the relationship key from `c.req.param()`, not from request body (body parsing hasn't run at middleware time).
148
+
149
+ **Scope (v1):**
150
+ - Namespace lives within a single feature's Hono `app`; cross-feature shared namespaces are deferred to v2.
151
+ - One namespace per `defineTable` declaration; multiple namespaces in a feature mount as siblings.
152
+ - For namespace actions whose access references additional relationships beyond the namespace's via, the inline resolver still fires for those — namespace handles only its own.
153
+
154
+ #### Migration
155
+
156
+ Nothing in v0.20 → v0.23 breaks existing code that compiles cleanly. The new errors fire only against patterns that were already latent bugs:
157
+
158
+ - A `via:` typo that previously surfaced as a deep codegen error now surfaces at parse time, same message.
159
+ - A `firewall: { exception: true }` on a relationship-from table now errors; this configuration was always documented as unsupported.
160
+ - A relationship's `resource.column` writable on the resource's UPDATE endpoint now errors unless `allowResourceMigration: true` is set; previously this was a runtime escape hatch.
161
+ - Record-based actions with `roles: ['<relationship-role>']` previously 403'd every caller; they now work as the v0.19 docs originally promised.
162
+
163
+ #### Why this matters
164
+
165
+ Authz relationships are how Quickback expresses "the caller is allowed to touch this resource because of a row in *that* table" — guest-of-event, member-of-organization, scorer-of-interview. Until now, the feature worked but had sharp edges: typos surfaced late, the documented exception-not-allowed constraint wasn't enforced, and the namespace pattern (which most apps with nested resources end up wanting) required repeating the same gate in every action. This release brings authz to parity with the org/owner/team firewall: declare it once, the compiler enforces it everywhere, the runtime emits exactly one query per request.
166
+
167
+ ---
168
+
169
+ ## v0.22.0 — May 19, 2026
170
+
171
+ ### Quickback Stack is Cloudflare-only: one runtime, two databases, one auth provider
172
+
173
+ We've focused the platform on the stack we actually believe in: **Cloudflare Workers + Hono + Better Auth**, with **Cloudflare D1** or **Neon** as the database. Providers and modes that targeted non-Cloudflare backends are gone. The result is a smaller concept set, fewer footguns, and clearer docs.
174
+
175
+ #### What's been removed
176
+
177
+ - **Runtimes**: `bun` and `supabase-edge` are no longer supported. The only runtime is `cloudflare`. Local development for compiled projects has always used `wrangler dev` — that's unchanged.
178
+ - **Databases**: `supabase`, `libsql`, `better-sqlite3`, `bun-sqlite` are removed. Use `cloudflare-d1` for SQLite at the edge or `neon` for PostgreSQL via Hyperdrive.
179
+ - **Auth providers**: `supabase-auth` is removed. `better-auth` is the default; `external` (Cloudflare service binding) remains for advanced setups.
180
+ - **Template**: `template: 'nextjs'` is removed from the public config type. It was never fully implemented. The only template is `'hono'`. If you need a Next.js frontend, bring it as a separate deploy and call the Quickback API, or drop a static export into the `apps:` mount.
181
+ - **Quickback for Supabase RLS** product line is retired. The compiler no longer emits Supabase Row Level Security policies. The `/products/quickback-supabase-rls/` and `/for/supabase-users/` pages have been removed from the marketing site, and the `compiler/targets/supabase-rls/` docs section has been deleted.
182
+
183
+ #### Account UI: one delivery mode
184
+
185
+ The standalone `quickback-better-auth-account-ui` npm package has been **deprecated** and the upstream GitHub repo (`Kardoe-com/quickback-better-auth-account-ui`) has been **archived**. Account UI is now exclusively delivered the way 99% of projects already use it: the compiler builds it from source and bundles it into your Worker.
186
+
187
+ - `account: { domain: 'auth.example.com', ... }` in `quickback.config.ts` — that's the entire integration story.
188
+ - The compiler builds the SPA inside Docker with your branding and feature flags baked in, emits hostname-based routing, and wires cross-subdomain cookies automatically.
189
+ - The three standalone delivery-mode docs (`stack/account-ui/standalone`, `library-usage`, `worker`) are removed; the remaining pages explain the compiler-bundled flow.
190
+
191
+ If you previously deployed the standalone Account UI Worker against a Quickback backend, switch to `account: { domain }` in the config — same end result, one less deploy.
192
+
193
+ #### `VITE_AUTH_ROUTE` hardcoded to Quickback
194
+
195
+ The `VITE_AUTH_ROUTE` env var (which used to switch between `quickback` and `better-auth` routing dialects) is gone. The auth-client always uses Quickback's namespaced routes (`/auth/v1`, `/api/v1`, `/storage/v1`). Generic Better Auth backends are no longer a supported target. Removing the var also closes a known footgun where setting the wrong value silently 404'd every auth call.
196
+
197
+ #### New: every config option is now discoverable
198
+
199
+ When you bootstrap a project, the kitchen-sink marker block in `quickback.config.ts` lists every option Quickback supports — with descriptions and sensible defaults — commented out for you to copy above the marker as needed. Three top-level options were missing from this discovery surface and are now included:
200
+
201
+ - **`apps`** — mount your own prebuilt SPA on its own hostname (`apps: { www: { domain: 'www.example.com', aliasDomains: ['example.com'] } }`). Drop the build at `quickback/apps/<name>/` and the compiler serves it from your Worker alongside the API. Reserved names: `cms`, `account`, `public`.
202
+ - **`security`** — HTTP security headers (CSP, COOP, COEP, HSTS, Referrer-Policy, Permissions-Policy, X-Frame-Options). Set `security: false` to suppress everything; defaults are sensible for the embedded SPAs.
203
+ - **`authz`** — relationship-based authorization roles. Declare joins between the caller and a resource column, then bind role names to those joins for use in `access: { roles: [...] }`.
204
+
205
+ #### Migration
206
+
207
+ Projects that compile cleanly against v0.21 and use any of these providers will hit a clear error at compile time:
208
+
209
+ ```
210
+ Unknown database provider: "supabase". Available: cloudflare-d1, neon
211
+ ```
212
+
213
+ To migrate:
214
+
215
+ 1. **From Supabase**: switch `providers.database` to `cloudflare-d1` or `neon`, and `providers.auth` to `better-auth`. Your `defineTable()` definitions transfer as-is; the security DSL (firewall, access, guards, masking) compiles to Better Auth + Drizzle queries instead of RLS policies.
216
+ 2. **From Bun runtime / `bun-sqlite`**: switch `providers.runtime` to `cloudflare` and `providers.database` to `cloudflare-d1`. Local dev becomes `wrangler dev`.
217
+ 3. **From libsql / Turso**: switch to `cloudflare-d1` or `neon`. Both run natively from Cloudflare Workers via the right binding.
218
+ 4. **From `template: 'nextjs'`**: deploy Next.js separately and call the Quickback API, or drop a static export into `apps:`.
219
+
220
+ #### Why this matters
221
+
222
+ The Quickback Stack is the Supabase alternative for Cloudflare. Every Quickback project ships a Hono API, an Account SPA, a CMS SPA, optional realtime/storage/queues — all built from one config and bundled into one Worker. Keeping that promise focused is more valuable than supporting deployment targets that don't share the runtime.
223
+
224
+ ---
225
+
226
+ ## v0.21.0 — May 19, 2026
227
+
228
+ ### Auto-firewall column swap: `ownerId` is now canonical on feature tables, `userId` warns
229
+
230
+ The compiler's default auto-firewall column for feature tables flips from `userId` to `ownerId`. This closes a long-standing footgun where a `userId` column meaning "a user this row references" (a member, a contact, an invitee) got silently clobbered with `ctx.userId` on insert, because the wrapper matched purely on column name across every table in the project.
231
+
232
+ **What changed in the compiler**
233
+
234
+ - `BETTER_AUTH_DEFAULTS.owner.column`: `'userId'` → `'ownerId'`. Schemas with an `ownerId` column auto-resolve to `firewall: [{ field: 'ownerId', equals: 'ctx.userId' }]` and have `ownerId` auto-stamped on insert.
235
+ - The generated `OWNER_SCOPE_RULES` in `src/lib/scoped-db.ts` is seeded with `ownerId` instead of `userId`. Schemas that don't explicitly name `userId` in a `firewall:` block no longer trigger the global `userId`-stamping rule — the most common collision goes away without renames.
236
+ - A new compile-time warning fires when a feature table carries both an auto-resolved isolation column AND a `userId` column. The warning recommends renaming the column to `linkedUserId` (or similar) if it's informational, or declaring `firewall: [{ field: 'userId', equals: 'ctx.userId' }]` if it really is the access boundary on that table.
237
+ - The targeted compile-time error for "the only candidate column is `userId`" now points users at `ownerId` and the explicit-firewall escape hatch. The previous error wording (which assumed `ownerId` was business-logic) is removed.
238
+
239
+ **What stayed the same**
240
+
241
+ - Better Auth's own internal tables (`session`, `account`, `member`, `passkey`, `subscriptions`) still use `userId` by convention. They aren't feature tables and don't pass through the auto-firewall.
242
+ - Explicit `firewall: [{ field: 'userId', equals: 'ctx.userId' }]` declarations continue to work and are still recognized as the "owner" pattern in the generated comment header.
243
+ - The `USER` pseudo-role validator behaviour is unchanged; only the error-message wording flips to lead with `ownerId` and list `userId` as the explicit fallback.
244
+ - Audit-wrapper (`createdBy` / `modifiedBy`) behavior is untouched.
245
+
246
+ **Migration**
247
+
248
+ Projects that auto-firewalled on a `userId` column will see a hard error on next compile telling them which table is affected, with two suggested fixes:
249
+
250
+ 1. **Recommended**: rename the column to `ownerId` in the schema. Cleanest semantics — readers immediately understand the column is access-control.
251
+ 2. **Explicit firewall**: keep the `userId` column and add `firewall: [{ field: 'userId', equals: 'ctx.userId' }]` to the resource. The auto-stamping and auto-scoping still happen; you've just opted in by name.
252
+
253
+ Projects that have a `userId` column meaning "a user this row references" no longer need the `linkedUserId` rename workaround — auto-stamping won't touch the column unless you name it in a firewall block. The new warning makes this audit-discoverable.
254
+
255
+ **Caveat (deferred)**: explicit `firewall: { owner: { column: 'X' } }` declarations still populate the project-global `OWNER_SCOPE_RULES` list, so a hand-named owner column on one resource will still match by name on every other table that happens to have a column called `X`. A future release will make scope-rule resolution per-table rather than project-global. The warning text calls this out so callers know what to expect.
256
+
257
+ ---
258
+
259
+ ## v0.20.0 — May 19, 2026
260
+
261
+ ### CMS + Account SPAs: shadcn base-ui migration, central Tailwind config
262
+
263
+ Both first-party SPAs are now on the shadcn **base-ui** variants (`@base-ui/react`) instead of the Radix-based primitives, applied via shadcn preset **`bdvxIkMq`** (style `base-mira`, `baseColor: zinc`, `iconLibrary: remixicon`, Inter Variable font). The migration also collapses the previously duplicated per-SPA theme + `components.json` into a single source at `packages/ui/`.
264
+
265
+ #### Single source of truth in `packages/ui/`
266
+
267
+ Both SPAs were independently declaring the same `@theme` / `:root` / `.dark` token blocks in their own `app.css`, and each had its own `components.json` pointing at non-existent local component directories. That's gone:
268
+
269
+ - `packages/ui/styles/theme.css` — the only place tokens live. Includes the base-mira palette, sidebar + chart tokens, and the Inter font import.
270
+ - `packages/ui/components.json` — the only shadcn config in the repo. Future `pnpm dlx shadcn@latest add <name>` runs from `packages/ui/`.
271
+ - `packages/cms/app/app.css` and `packages/account/app/app.css` reduce to two imports plus SPA-specific layers (CMS keeps its AG Grid + richtext-display overrides). `packages/{cms,account}/components.json` deleted.
272
+
273
+ #### Components, icons, deps
274
+
275
+ - All 22 shadcn primitives regenerated against `@base-ui/react` (`@radix-ui/*` removed everywhere). `Drawer` stays on `vaul` — base-ui has no Drawer primitive.
276
+ - Icons migrated from `lucide-react` to `@remixicon/react` line variants across ~100 source files (`Plus → RiAddLine`, `ChevronDown → RiArrowDownSLine`, `X → RiCloseLine`, etc.). `lucide-react` removed from all `package.json` + `deps-spa-*` files.
277
+ - `pnpm.overrides` pin `@types/react ^19.2.0` workspace-wide to resolve the duplicate-React-types conflict introduced by `@base-ui/react`'s bundled type peer.
278
+ - Per-SPA deps and the Docker build mirrors (`apps/compiler/deps-spa-{cms,account}-package.json`) both gain `@base-ui/react`, `@remixicon/react`, `@fontsource-variable/inter`, and bump `shadcn` to `^4.7.0`.
279
+
280
+ #### Backwards-compat `asChild` shim
281
+
282
+ Base-ui replaces Radix's `asChild` boolean with a `render={<X />}` prop. To avoid rewriting ~44 caller sites, the shadcn-generated wrappers for `Button`, `DropdownMenuTrigger`, `DropdownMenuItem`, and `PopoverTrigger` carry an `asChild?: boolean` prop that delegates to base-ui's `render` API when set:
283
+
284
+ ```tsx
285
+ // Caller code keeps working as-is:
286
+ <Button asChild>
287
+ <Link to="/foo">Click</Link>
288
+ </Button>
289
+ ```
290
+
291
+ `ResponsiveModal` survived the migration unchanged — it composes the higher-level Dialog + Drawer wrappers (preserved public API), not the underlying primitives.
292
+
293
+ #### Caller-side API changes worth noting
294
+
295
+ Base-ui ships some real behavioural changes the Radix variants didn't:
296
+
297
+ - `<Select onValueChange>` now receives `(value: string | null, eventDetails) => void` (was `(value: string) => void`). Existing `Dispatch<SetStateAction<string>>` setters reject `null` — wrap callbacks defensively: `onValueChange={(v) => v != null && setX(v)}`.
298
+ - `<DropdownMenuContent forceMount>` removed (base-ui has no `forceMount`). Use base-ui's `keepMounted` on the Popup/Positioner if you need to preserve unmounted state.
299
+ - Component sub-names shifted (`Dialog.Content` → `Dialog.Popup`, `Dialog.Overlay` → `Dialog.Backdrop`). Data attributes are now `data-open` / `data-closed` (no more `data-state="open"`).
300
+
301
+ #### Adding a new primitive after this release
302
+
303
+ ```bash
304
+ cd packages/ui
305
+ pnpm dlx shadcn@latest add <component> --overwrite --yes
306
+ # Sweep generated `@/` imports to relative paths — the SPAs' vite-tsconfig-paths
307
+ # plugin doesn't see packages/ui's @/* mapping at bundle time:
308
+ sed -i.bak \
309
+ -e 's|"@/lib/utils"|"../lib/utils"|g' \
310
+ -e 's|"@/components/|"./|g' \
311
+ -e 's|"@/hooks/|"../hooks/|g' \
312
+ components/<component>.tsx && rm components/<component>.tsx.bak
313
+ ```
314
+
315
+ If the new primitive pulls in fresh deps, mirror them into `apps/compiler/deps-spa-{cms,account}-package.json` per the SPA build pipeline or Docker SPA builds will fail.
316
+
317
+ ---
318
+
319
+ ## v0.18.1 — May 18, 2026
320
+
321
+ ### Account SPA — teams, active-team picker, permission-aware UI
322
+
323
+ The Account SPA's organization surface is now feature-parity with Better Auth's `organization` plugin for the basic team workflow, and replaces the long-standing hardcoded `role === 'owner' || 'admin'` checks with `checkRolePermission` so projects that ship custom roles get a UI that respects them.
324
+
325
+ #### Teams (opt-in)
326
+
327
+ When the BA config enables teams — `organization({ teams: { enabled: true } })` — the compiler emits `VITE_ENABLE_ORG_TEAMS=true` and the Account SPA exposes a Teams tab on each organization:
328
+
329
+ - **Teams index** (`/$slug/teams`) — splits into "Your teams" (from `listUserTeams`) and "Other teams" so non-admins land on what's relevant. Create / rename / delete from the list, gated on `team:create` / `team:update` / `team:delete`.
330
+ - **Team detail** (`/$slug/teams/$teamId`) — member roster with add / remove, joining `listTeamMembers` against the org's full member list for display.
331
+ - **Active-team picker** in the org header — calls `setActiveTeam` and exposes the choice via `OrganizationContext.activeTeamId` so downstream routes (and the BA `session.activeTeamId` server-side) stay in sync.
332
+ - **Team-aware invites** — `InviteMemberDialog` shows an optional team picker when teams are on and forwards `teamId` to `inviteMember`, so accepting the invite drops the new member straight into the right team.
333
+
334
+ Teams are loaded once by the `$slug` layout (`listTeams` + `listUserTeams`) and exposed via `OrganizationContext.teams` / `userTeamIds` / `refreshTeams`, so individual team routes don't re-fetch the list.
335
+
336
+ #### Permission-aware UI via `checkRolePermission`
337
+
338
+ `OrganizationContext.isOwnerOrAdmin` is gone. Routes now read `can(resource, action)` from context, which delegates to `authClient.organization.checkRolePermission` — synchronous, no roundtrip, and aware of any custom roles registered via the BA `ac` option. Multi-role users (BA stores multiple roles comma-separated) are handled by checking each role; the action is allowed if any role grants it.
339
+
340
+ Migrated sites:
341
+
342
+ - `$slug.tsx` tab gates → `can('invitation', 'create')`, `can('organization', 'update')`
343
+ - `members.tsx` action menu → `can('member', 'update' | 'delete')`; the owner-hierarchy guard (non-owners can't touch owner-role members) is preserved as a client-side mirror of BA's server enforcement
344
+ - `invitations.tsx` → `can('invitation', 'create' | 'cancel')` gates the Invite button, resend, and cancel separately
345
+ - `settings.tsx` → `can('organization', 'update')` for the form, `can('organization', 'delete')` for the danger zone (was owner-only)
346
+ - `teams.tsx` / `teams.$teamId.tsx` → `can('team', 'create' | 'update' | 'delete')`
347
+
348
+ Projects on the default three-role hierarchy see no behaviour change; projects that defined `admin`/`member` overrides via BA's access-control API now get a UI that matches what the server will actually authorize.
349
+
350
+ #### Editable slug + metadata on organization settings
351
+
352
+ The `$slug/settings.tsx` form now edits two more `organization.update` fields:
353
+
354
+ - **URL slug** — full debounced `checkSlug` flow (mirroring the create-org form); on rename, the SPA navigates to `/${newSlug}/settings` and the layout re-fetches with the new slug.
355
+ - **Metadata** — single `Record<string, any> | null` JSON textarea, parsed on submit with inline error messaging. Empty clears the field.
356
+
357
+ Slug rename is non-breaking for the SPA itself, but every external link / bookmark that references the old slug becomes a 404 — the form warns about this before saving.
358
+
359
+ #### Auth client wiring
360
+
361
+ When `VITE_ENABLE_ORG_TEAMS=true`, the SPA's `organizationClient(...)` is instantiated with `teams: { enabled: true }` so the team APIs are typed end-to-end. When the flag is off, team methods aren't surfaced — and the Teams tab is hidden — keeping the bundle and UI honest about what the server actually supports.
362
+
363
+ ---
364
+
3
365
  ## v0.18.0 — May 17, 2026
4
366
 
5
367
  ### `config.apps` — mount user-authored SPAs on dedicated hostnames
@@ -4,11 +4,7 @@ Providers configure which services your compiled backend targets.
4
4
 
5
5
  ## Runtime Providers
6
6
 
7
- | Provider | Description |
8
- |----------|-------------|
9
- | `cloudflare` | Cloudflare Workers (Hono) |
10
- | `bun` | Bun runtime (Hono) |
11
- | `node` | Node.js runtime (Hono) |
7
+ The Quickback Stack is **Cloudflare-only**. `cloudflare` is the single supported runtime.
12
8
 
13
9
  ```typescript
14
10
  import { defineRuntime } from "@quickback/compiler";
@@ -63,13 +59,12 @@ providers: {
63
59
 
64
60
  ## Database Providers
65
61
 
62
+ Two databases are supported, both Cloudflare-native:
63
+
66
64
  | Provider | Description |
67
65
  |----------|-------------|
68
- | `cloudflare-d1` | Cloudflare D1 (SQLite) |
69
- | `better-sqlite3` | SQLite via better-sqlite3 (Bun/Node) |
70
- | `libsql` | LibSQL / Turso |
71
- | `neon` | Neon (PostgreSQL) |
72
- | `supabase` | Supabase (PostgreSQL) |
66
+ | `cloudflare-d1` | Cloudflare D1 (SQLite at the edge) |
67
+ | `neon` | Neon (PostgreSQL over Hyperdrive) |
73
68
 
74
69
  ```typescript
75
70
  import { defineDatabase } from "@quickback/compiler";
@@ -235,8 +230,7 @@ See [Realtime](/stack/realtime) for the client-side connection flow and helper e
235
230
 
236
231
  | Provider | Description |
237
232
  |----------|-------------|
238
- | `better-auth` | Better Auth with plugins |
239
- | `supabase-auth` | Supabase Auth |
233
+ | `better-auth` | Better Auth with plugins (default) |
240
234
  | `external` | External auth via Cloudflare service binding |
241
235
 
242
236
  ```typescript
@@ -107,36 +107,6 @@ For running remote migrations with `drizzle-kit`, set these in `.env`:
107
107
  | `CLOUDFLARE_AUDIT_DATABASE_ID` | Security audit D1 database ID (unsafe cross-tenant actions) |
108
108
  | `CLOUDFLARE_DATABASE_ID` | Database ID (single DB mode) |
109
109
 
110
- ## Bun Variables
111
-
112
- Set these in a `.env` file in your project root:
113
-
114
- | Variable | Description | Default |
115
- |----------|-------------|---------|
116
- | `NODE_ENV` | Runtime environment | `development` |
117
- | `PORT` | Server port | `3000` |
118
- | `BETTER_AUTH_SECRET` | Auth encryption secret | — (required) |
119
- | `BETTER_AUTH_URL` | Public URL of your server | `http://localhost:3000` |
120
- | `DATABASE_PATH` | Path to SQLite file | `./data/app.db` |
121
-
122
- ## Turso (LibSQL) Variables
123
-
124
- In addition to the Bun variables above:
125
-
126
- | Variable | Description | Default |
127
- |----------|-------------|---------|
128
- | `DATABASE_URL` | LibSQL connection URL | `file:./data/app.db` |
129
- | `DATABASE_AUTH_TOKEN` | Turso auth token (required for remote) | — |
130
-
131
- ```bash
132
- # Local development
133
- DATABASE_URL=file:./data/app.db
134
-
135
- # Production (Turso cloud)
136
- DATABASE_URL=libsql://your-db-slug.turso.io
137
- DATABASE_AUTH_TOKEN=eyJhbGciOi...
138
- ```
139
-
140
110
  ## Social Login Providers
141
111
 
142
112
  When social login is configured in your auth provider: