@quickback-dev/cli 0.69.0 → 0.70.2

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 (40) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/audit-canon.js +3 -3
  3. package/dist/lib/audit-canon.js.map +1 -1
  4. package/dist/skill/docs/api/query-params.md +7 -1
  5. package/dist/skill/docs/api/typescript.md +17 -5
  6. package/dist/skill/docs/configure/domains.md +17 -27
  7. package/dist/skill/docs/configure/index.md +9 -10
  8. package/dist/skill/docs/configure/security.md +1 -1
  9. package/dist/skill/docs/define/areas.md +1 -1
  10. package/dist/skill/docs/define/bundles.md +23 -3
  11. package/dist/skill/docs/define/escape-hatches.md +2 -2
  12. package/dist/skill/docs/define/schema.md +12 -2
  13. package/dist/skill/docs/define/scopes.md +7 -1
  14. package/dist/skill/docs/define/triggers.md +5 -1
  15. package/dist/skill/docs/platform/auth/plugins/index.md +1 -1
  16. package/dist/skill/docs/platform/auth/security.md +2 -1
  17. package/dist/skill/docs/platform/database/d1.md +2 -2
  18. package/dist/skill/docs/platform/database/neon.md +12 -7
  19. package/dist/skill/docs/platform/database/planetscale-postgres.md +10 -4
  20. package/dist/skill/docs/tooling/claude-skill.md +1 -1
  21. package/dist/skill/docs/ui/admin/index.md +1 -1
  22. package/package.json +1 -1
  23. package/src/skill/docs/api/query-params.md +7 -1
  24. package/src/skill/docs/api/typescript.md +17 -5
  25. package/src/skill/docs/configure/domains.md +17 -27
  26. package/src/skill/docs/configure/index.md +9 -10
  27. package/src/skill/docs/configure/security.md +1 -1
  28. package/src/skill/docs/define/areas.md +1 -1
  29. package/src/skill/docs/define/bundles.md +23 -3
  30. package/src/skill/docs/define/escape-hatches.md +2 -2
  31. package/src/skill/docs/define/schema.md +12 -2
  32. package/src/skill/docs/define/scopes.md +7 -1
  33. package/src/skill/docs/define/triggers.md +5 -1
  34. package/src/skill/docs/platform/auth/plugins/index.md +1 -1
  35. package/src/skill/docs/platform/auth/security.md +2 -1
  36. package/src/skill/docs/platform/database/d1.md +2 -2
  37. package/src/skill/docs/platform/database/neon.md +12 -7
  38. package/src/skill/docs/platform/database/planetscale-postgres.md +10 -4
  39. package/src/skill/docs/tooling/claude-skill.md +1 -1
  40. package/src/skill/docs/ui/admin/index.md +1 -1
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import pc from "picocolors";
12
12
  // Version injected at build time by scripts/inject-version.ts
13
- const CLI_VERSION = "0.69.0";
13
+ const CLI_VERSION = "0.70.2";
14
14
  function getPackageVersion() {
15
15
  return CLI_VERSION;
16
16
  }
@@ -15,14 +15,14 @@ export const MANAGED_COLUMN_CANON = [
15
15
  jsName: 'createdAt',
16
16
  snakeName: 'created_at',
17
17
  audit: true,
18
- pgLine: `createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),`,
18
+ pgLine: `createdAt: timestamp("created_at", { withTimezone: true, precision: 3 }).notNull().defaultNow(),`,
19
19
  sqliteLine: `createdAt: text("created_at").notNull().default(${EPOCH}).$defaultFn(${ISO_NOW}),`,
20
20
  },
21
21
  {
22
22
  jsName: 'modifiedAt',
23
23
  snakeName: 'modified_at',
24
24
  audit: true,
25
- pgLine: `modifiedAt: timestamp("modified_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),`,
25
+ pgLine: `modifiedAt: timestamp("modified_at", { withTimezone: true, precision: 3 }).notNull().defaultNow().$onUpdate(() => new Date()),`,
26
26
  sqliteLine: `modifiedAt: text("modified_at").notNull().default(${EPOCH}).$defaultFn(${ISO_NOW}).$onUpdate(${ISO_NOW}),`,
27
27
  },
28
28
  {
@@ -43,7 +43,7 @@ export const MANAGED_COLUMN_CANON = [
43
43
  jsName: 'deletedAt',
44
44
  snakeName: 'deleted_at',
45
45
  audit: false,
46
- pgLine: `deletedAt: timestamp("deleted_at", { withTimezone: true }),`,
46
+ pgLine: `deletedAt: timestamp("deleted_at", { withTimezone: true, precision: 3 }),`,
47
47
  sqliteLine: `deletedAt: text("deleted_at"),`,
48
48
  },
49
49
  {
@@ -1 +1 @@
1
- {"version":3,"file":"audit-canon.js","sourceRoot":"","sources":["../../src/lib/audit-canon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,MAAM,KAAK,GAAG,4BAA4B,CAAC;AAC3C,MAAM,OAAO,GAAG,gCAAgC,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACrE;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,oFAAoF;QAC5F,UAAU,EAAE,mDAAmD,KAAK,gBAAgB,OAAO,IAAI;KAChG;IACD;QACE,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,kHAAkH;QAC1H,UAAU,EAAE,qDAAqD,KAAK,gBAAgB,OAAO,eAAe,OAAO,IAAI;KACxH;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,gCAAgC;QACxC,UAAU,EAAE,gCAAgC;KAC7C;IACD;QACE,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,kCAAkC;QAC1C,UAAU,EAAE,kCAAkC;KAC/C;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,6DAA6D;QACrE,UAAU,EAAE,gCAAgC;KAC7C;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,gCAAgC;QACxC,UAAU,EAAE,gCAAgC;KAC7C;CACF,CAAC"}
1
+ {"version":3,"file":"audit-canon.js","sourceRoot":"","sources":["../../src/lib/audit-canon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,MAAM,KAAK,GAAG,4BAA4B,CAAC;AAC3C,MAAM,OAAO,GAAG,gCAAgC,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACrE;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,kGAAkG;QAC1G,UAAU,EAAE,mDAAmD,KAAK,gBAAgB,OAAO,IAAI;KAChG;IACD;QACE,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,gIAAgI;QACxI,UAAU,EAAE,qDAAqD,KAAK,gBAAgB,OAAO,eAAe,OAAO,IAAI;KACxH;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,gCAAgC;QACxC,UAAU,EAAE,gCAAgC;KAC7C;IACD;QACE,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,kCAAkC;QAC1C,UAAU,EAAE,kCAAkC;KAC/C;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,2EAA2E;QACnF,UAAU,EAAE,gCAAgC;KAC7C;IACD;QACE,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,gCAAgC;QACxC,UAAU,EAAE,gCAAgC;KAC7C;CACF,CAAC"}
@@ -45,6 +45,12 @@ It is never dropped:
45
45
  | `?resolvedAt.gte=yesterday` on a Postgres timestamp column | `400` — `"yesterday" is not an ISO 8601 timestamp` |
46
46
  | `?resolvedAt.like=2026` on a Postgres timestamp column | `400` — use `eq`, `ne`, `gt`, `gte`, `lt`, `lte` or `in` |
47
47
 
48
+ A column named like a list parameter (`sort`, `order`, `limit`, `offset`,
49
+ `search`, `fields`, `total`, `include`, `starting_after`, `ending_before`) is
50
+ not filterable: `?sort=` is always the sort control, and the OpenAPI spec omits
51
+ the column filter rather than declaring the parameter twice. Filter it through
52
+ a view or rename the column.
53
+
48
54
  Silently dropping a predicate would return **every row the firewall allows**
49
55
  while still reading as a scoped list — a typo'd or join-table field turns a
50
56
  narrow query into a full dump. The same rule closes `?search=` and `?sort=`.
@@ -91,7 +97,7 @@ currently wired into the emitted route.
91
97
  - `count` — number of records returned on this page
92
98
  - `page` / `pageSize` — derived from `?offset=` and `?limit=`
93
99
  - `hasMore` — whether more rows exist in the queried direction. Without `?total=true` it comes from a `limit + 1` over-fetch probe, so it never lies on a final page that exactly fills the limit; with `?total=true` it is page arithmetic (`page < totalPages`) on offset pages, and the probe again on cursor pages.
94
- - `nextCursor` / `prevCursor` — keyset cursors; pass them back as `?starting_after=` and `?ending_before=`. Treat them as opaque, but they are encoded, not encrypted: they carry the boundary row's sort-key values. Either can be `null` — including when the sort includes a [masked](/define/masking) column the caller may sort by (`query.roles`) but not see (`show.roles`), or a column the response does not carry (a view sorting on a field it doesn't list, or `?fields=` without the sort key); page with `?offset=` in that case.
100
+ - `nextCursor` / `prevCursor` — keyset cursors; pass them back as `?starting_after=` and `?ending_before=`. Treat them as opaque, but they are encoded, not encrypted: they carry the boundary row's sort-key values. Either can be `null` — including when the sort includes a [masked](/define/masking) column the caller may sort by (`query.roles`) but not see (`show.roles`), or a column the response does not carry (a view sorting on a field it doesn't list, or `?fields=` without the sort key); page with `?offset=` in that case. A cursor carries a timestamp sort key at millisecond precision, so sort on a column that stores milliseconds: the managed `createdAt` / `modifiedAt` / `deletedAt` do on both dialects (Postgres stores them as `timestamptz(3)`). A Postgres timestamp column you declare with microsecond precision and fill with `now()` can repeat or skip rows across pages.
95
101
  - `total` / `totalPages` — present **only** when the request passed `?total=true` (see below)
96
102
 
97
103
  There is no `limit` or `offset` member in `pagination`.
@@ -36,7 +36,7 @@ Each resource table exposes:
36
36
  | `Insert` | Createable fields, with defaults and nullable fields optional |
37
37
  | `Update` | Updatable fields, all optional |
38
38
  | `ListResponse` | `Qb.Page<Row>` |
39
- | `columns.<name>` | Type of one row column |
39
+ | `columns.<name>` | Type of one row column. A column named like a TypeScript keyword or built-in type (`number`, `string`, `delete`, …) is prefixed: `columns._number` |
40
40
  | `views.<name>.Item` | A view's projected row |
41
41
  | `views.<name>.Response` | Page plus typed aggregations where declared |
42
42
  | `actions.<name>.Input` | The action's Zod input contract |
@@ -253,6 +253,15 @@ export default defineConfig({
253
253
  `types` output, and the compile fails if `types` is `false`. It is off by
254
254
  default.
255
255
 
256
+ > **TanStack Start denies `*.client.*` on the server**
257
+ >
258
+ > TanStack Start's import protection rejects any `**/*.client.*` module in the
259
+ > server environment, which includes the SPA prerender, so importing the default
260
+ > `quickback.client.ts` fails that build with `Import denied in server
261
+ > environment`. Give the client a name outside that pattern:
262
+ > `client: "src/lib/quickback-client.ts"`.
263
+
264
+
256
265
  ```typescript
257
266
  import { createClient, QuickbackError } from "./quickback.client";
258
267
 
@@ -419,9 +428,12 @@ export default defineConfig({
419
428
  });
420
429
  ```
421
430
 
422
- Use a custom path, fan out identical copies to colocated apps (a monorepo
423
- sibling such as `../packages/shared/src/quickback.gen.ts` is allowed; absolute
424
- paths are not), disable branding, or turn the artifact off:
431
+ Use a custom path, fan out identical copies to colocated apps, disable
432
+ branding, or turn the artifact off. Paths resolve inside the project root:
433
+ `..` segments and absolute paths fail the compile (`Path traversal is not
434
+ allowed`). A sibling package consumes the file through a path alias
435
+ (`"@api/*": ["../api/client/*"]` in its `tsconfig.json`), not by emitting
436
+ into it:
425
437
 
426
438
  ```typescript
427
439
  export default defineConfig({
@@ -440,7 +452,7 @@ export default defineConfig({
440
452
  | `true` or omitted | Write `quickback.gen.ts` |
441
453
  | `false` | Do not emit the first-party type tree |
442
454
  | `"src/lib/quickback.gen.ts"` | Write to one custom path |
443
- | `["quickback.gen.ts", "../packages/shared/src/quickback.gen.ts"]` | Fan out identical copies, including outside the project |
455
+ | `["quickback.gen.ts", "apps/web/src/lib/quickback.gen.ts"]` | Fan out identical copies inside the project |
444
456
  | `{ output, brandIds: false }` | Configure paths and use structural IDs |
445
457
 
446
458
  `api-types.gen.ts` remains available through `openapi.types` for `openapi-fetch` and third-party OpenAPI tools. The two artifacts are independent: disabling OpenAPI types does not disable the first-party tree.
@@ -9,7 +9,7 @@ When you configure custom domains for CMS, Account, Admin, or `apps`, the compil
9
9
  1. Adds `custom_domain` routes to `wrangler.toml`
10
10
  2. Generates hostname-based middleware in the Worker
11
11
  3. Auto-configures cross-subdomain cookies for shared authentication
12
- 4. Auto-infers a unified `quickback.{baseDomain}` fallback domain
12
+ 4. Requires an explicit `domain` — the all-in-one host — when only cms/api/auth hostnames are declared and the bundled CMS or Account SPA is enabled
13
13
 
14
14
  All configured domains point to the **same Worker** — there's only one deployment.
15
15
 
@@ -22,7 +22,7 @@ All configured domains point to the **same Worker** — there's only one deploym
22
22
  | `auth.example.com` | `account: { domain }` | Account SPA | Pass-through |
23
23
  | `admin.example.com` | `account: { adminDomain }` | Account SPA | Pass-through |
24
24
  | `www.example.com` | `apps: { <name>: { domain } }` | User-authored SPA | Pass-through |
25
- | `quickback.example.com` | Auto-inferred | Everything | All |
25
+ | `app.example.com` | `domain` | Everything | All |
26
26
 
27
27
  ### CMS Domain
28
28
 
@@ -64,9 +64,7 @@ The names `cms`, `account`, and `public` are reserved (they collide with compile
64
64
 
65
65
  ### Unified Domain
66
66
 
67
- The compiler auto-infers a `quickback.{baseDomain}` domain from your configured custom domains. For example, if you have `cms.example.com`, it creates `quickback.example.com`.
68
-
69
- On this domain, **everything is available** on a single origin:
67
+ Set `domain` to the host where **everything is available** on a single origin:
70
68
 
71
69
  | Path | Content |
72
70
  |------|---------|
@@ -80,7 +78,12 @@ On this domain, **everything is available** on a single origin:
80
78
  | `/health` | Health check |
81
79
  | `/openapi.json` | OpenAPI spec |
82
80
 
83
- The unified domain is useful for development and debugging. You can override it with an explicit `domain` field in your config.
81
+ `domain` is required when the project's only custom hostnames are `cms.domain`, `api.domain` or `auth.domain` and the CMS or Account SPA is enabled: each of those hosts blocks part of the surface the SPAs need, so without it they would call an origin that 404s. The compile fails with `config.domain: … Set \`domain\` to the all-in-one hostname`. A `providers.runtime.config.routes` entry, an `account.domain`/`adminDomain`, or an `apps.<name>.domain` already serves everything, so projects with one of those need no `domain`.
82
+
83
+ > **No longer inferred**
84
+ >
85
+ > Earlier compilers inferred this host as `quickback.{baseDomain}` from the first declared hostname, which emitted a `custom_domain` route in a zone the deploying account might not own and failed `wrangler deploy` after the upload. Only declared hostnames are emitted now.
86
+
84
87
 
85
88
  ## Configuration
86
89
 
@@ -122,7 +125,7 @@ routes = [
122
125
  { pattern = "admin.example.com", custom_domain = true },
123
126
  { pattern = "www.example.com", custom_domain = true },
124
127
  { pattern = "example.com", custom_domain = true },
125
- { pattern = "quickback.example.com", custom_domain = true }
128
+ { pattern = "app.example.com", custom_domain = true }
126
129
  ]
127
130
  ```
128
131
 
@@ -209,7 +212,7 @@ Each `domains` key maps 1:1 to a top-level source:
209
212
 
210
213
  | `domains` key | Claims |
211
214
  |---------------|--------|
212
- | `primary` | `domain` |
215
+ | `primary` | `domain`, or this target's own all-in-one host when there is no top-level `domain` |
213
216
  | `api` | `api.domain` |
214
217
  | `auth` | `auth.domain` |
215
218
  | `cms` | `cms.domain` |
@@ -227,31 +230,18 @@ The compile fails, naming the config path to fix, when an environment leaves a g
227
230
 
228
231
  ### The unified hostname per target
229
232
 
230
- The auto-inferred `quickback.{baseDomain}` host — where every surface coexists and `/` redirects to `/cms/` — is inferred for named-environment projects too, once **per target**:
231
-
232
- | Target | Claims | Inferred unified host |
233
- |--------|--------|-----------------------|
234
- | `dev` | `api-dev.attend.vip` | `quickback-dev.attend.vip` |
235
- | `prod` | `api.attend.vip` | `quickback-prod.attend.vip` |
236
-
237
- The single-target name can't carry over verbatim: every environment would infer the same `quickback.attend.vip` from a shared base domain, and one custom domain cannot belong to two Workers. The environment key is the only thing that makes the name unique by construction.
238
-
239
- It's a hyphen rather than a new label (`quickback-dev.attend.vip`, not `quickback.dev.attend.vip`) because Cloudflare's Universal SSL covers exactly one level of subdomain — the extra label would deploy without a certificate.
240
-
241
- Set `domains.primary` to override the name on any target. That's how one environment keeps the bare hostname a single-target project would have inferred:
233
+ Each target names its own all-in-one host with `domains.primary` — the host where every surface coexists and `/` redirects to `/cms/`:
242
234
 
243
235
  ```typescript
244
- prod: { domains: { api: "api.attend.vip", primary: "quickback.attend.vip" } },
236
+ dev: { domains: { api: "api-dev.attend.vip", primary: "app-dev.attend.vip" } },
237
+ prod: { domains: { api: "api.attend.vip", primary: "app.attend.vip" } },
245
238
  ```
246
239
 
247
- Inference is skipped when the project declares `domain` explicitly (that becomes a real `primary` source each target claims by hand), when the top level configures no domains at all, and for a `domains: 'none'` target.
248
-
249
- > **These are real custom domains**
250
- >
251
- > Every inferred hostname is emitted as a `custom_domain` route, so Wrangler provisions the DNS record on deploy — same as the single-target `quickback.{baseDomain}` has always done. The zone has to be on the deploying Cloudflare account.
240
+ One custom domain cannot belong to two Workers, so a project with named environments has no shared top-level `domain`; `domains.primary` is how each target claims its own. Keep it one label deep (`app-dev.attend.vip`, not `app.dev.attend.vip`): Cloudflare's Universal SSL covers exactly one level of subdomain.
252
241
 
242
+ A target whose claimed hostnames are all cms/api/auth roles fails the compile without `domains.primary` when the CMS or Account SPA is enabled (`dev claims custom hostnames but no \`domains.primary\``); an account, admin, app or `routes[i]` claim already serves everything. A `domains: 'none'` target needs none. When the project declares a top-level `domain`, that becomes a real `primary` source each target claims by hand instead.
253
243
 
254
- Each target's unified host joins `trustedOrigins` and the CSP origin list, but does **not** become the target's `BETTER_AUTH_URL` — that stays on the auth or API hostname, matching what a single-target project resolves.
244
+ Each target's `domains.primary` host joins `trustedOrigins` and the CSP origin list, but does **not** become the target's `BETTER_AUTH_URL` — that stays on the auth or API hostname, matching what a single-target project resolves.
255
245
 
256
246
  ### One bundle, several hostnames
257
247
 
@@ -34,7 +34,8 @@ export default defineConfig({
34
34
  // [quickback:options-start]
35
35
  // ── Project ──
36
36
  //
37
- // Primary custom domain (auto-inferred from cms/account/api domains if unset).
37
+ // Primary custom domain serving /cms, /account, /api and /auth together.
38
+ // Required when only cms/api/auth hostnames are declared and the CMS or Account SPA is enabled; never inferred.
38
39
  // domain: "example.com",
39
40
  //
40
41
  // ── Embedded UIs (CMS / Account) ──
@@ -93,7 +94,7 @@ Every optional top-level key the config accepts is listed below. You never have
93
94
 
94
95
  | Field | Type | Description |
95
96
  |-------|------|-------------|
96
- | `domain` | `string` | Primary custom domain (auto-inferred from `cms`/`account`/`api` domains if unset) — see [Domains](/configure/domains) |
97
+ | `domain` | `string` | Primary custom domain serving every surface. Required when only cms/api/auth hostnames are declared and the CMS or Account SPA is enabled; never inferred — see [Domains](/configure/domains) |
97
98
  | `contract` | `{ routes?: "v1" \| "v2" }` | `routes` selects the URL prefix and nothing else (default `"v1"`). See [API Contract](/platform/api-contract#one-axis-routes). |
98
99
  | `api` | `object` | Dedicated hostname for the selected feature API contract (`/api/v1/*` or `/api/v2/*`); additive alias — see [Domains](/configure/domains) |
99
100
  | `auth` | `object` | App-level auth settings (`roles`, `roleHierarchy`, `jwt`, delegated `principals`, `loginUrl`, `domain`) — see [Auth](/configure/auth), [Access](/define/access#role-hierarchy), and [Delegated principals](#delegated-principals) |
@@ -510,11 +511,11 @@ If `signature.required: true` and no key is available, compilation fails with a
510
511
 
511
512
  ## Hostname architecture
512
513
 
513
- A modern Quickback project runs on **one Cloudflare Worker** that serves multiple URL surfaces. By default, everything lives under a single unified backend hostname (auto-inferred as `quickback.{baseDomain}` from your other configured subdomains, or overridable via `config.domain`). For larger deployments, you can opt-in to **dedicated hostnames** for specific surfaces — they're additive aliases, never replacements.
514
+ A modern Quickback project runs on **one Cloudflare Worker** that serves multiple URL surfaces. Everything lives under a single unified backend hostname — `config.domain`, or the first `providers.runtime.config.routes` custom domain. For larger deployments, you can opt-in to **dedicated hostnames** for specific surfaces — they're additive aliases, never replacements.
514
515
 
515
516
  ### The unified backend contract
516
517
 
517
- When any subdomain is configured (`account.domain`, `cms.domain`, `auth.domain`, `api.domain`, `apps.<n>.domain`), the compiler always emits a unified backend host where **every compiler-emitted backend route** is reachable:
518
+ The unified backend host (`domain`) is where **every compiler-emitted backend route** is reachable:
518
519
 
519
520
  - `/api/v1/*` and `/auth/v1/*` by default, or `/api/v2/*` and `/auth/v2/*`
520
521
  when `contract.routes` is `"v2"` (the URL axis — the standard shape does
@@ -524,9 +525,7 @@ When any subdomain is configured (`account.domain`, `cms.domain`, `auth.domain`,
524
525
  - `/account/*`, `/cms/*` — bundled SPAs (when enabled)
525
526
  - `/broadcast/v1/*` (realtime; `/broadcast/v2/*` under `contract.routes: 'v2'`), `/mcp` (MCP), etc.
526
527
 
527
- The unified hostname is `quickback.{baseDomain}` by default (where baseDomain is extracted from your first configured subdomain). Override with `config.domain` if you prefer a different name.
528
-
529
- This contract is forward-pointing: it gives a stable URL pattern for future management tooling — `https://quickback.{baseDomain}/...` will always reach a Quickback backend regardless of how the operator splits their surfaces.
528
+ When the only configured hostnames are `cms.domain`, `auth.domain` or `api.domain` and the CMS or Account SPA is enabled, `domain` is required; the compile fails without it. An `account.domain`, `apps.<n>.domain` or runtime route already serves the whole surface. It is never inferred — an earlier `quickback.{baseDomain}` inference emitted a route in a zone the account might not own.
530
529
 
531
530
  ### Dedicated hostnames (optional, additive)
532
531
 
@@ -563,9 +562,9 @@ Dual-reach is preserved on the unified host:
563
562
 
564
563
  | URL on unified host | Handler | Notes |
565
564
  |---|---|---|
566
- | `https://quickback.example.com/api/{version}/users` | feature route | Works for the selected version whether `api.domain` is set or not |
567
- | `https://quickback.example.com/auth/{version}/sign-in/email` | Better Auth | Works for the selected version whether `auth.domain` is set or not |
568
- | `https://quickback.example.com/{version}/users` | **404** | Shortcut only applies on dedicated hostnames |
565
+ | `https://app.example.com/api/{version}/users` | feature route | Works for the selected version whether `api.domain` is set or not |
566
+ | `https://app.example.com/auth/{version}/sign-in/email` | Better Auth | Works for the selected version whether `auth.domain` is set or not |
567
+ | `https://app.example.com/{version}/users` | **404** | Shortcut only applies on dedicated hostnames |
569
568
 
570
569
  Each dedicated hostname also:
571
570
 
@@ -128,7 +128,7 @@ When you opt into a `csp` object, the compiler additively widens directives base
128
128
  | `cms: true` OR `account: true` | `https://fonts.googleapis.com` | `styleSrc` | Bundled SPAs `<link>` to Google Fonts CSS |
129
129
  | `cms: true` OR `account: true` | `https://fonts.gstatic.com` | `fontSrc` | The googleapis CSS loads `.woff2` from gstatic |
130
130
  | `csp` set (always) | `@trustedOrigins` | `connectSrc` | XHR/fetch must reach the same allowlist `cors()` permits — covers cross-subdomain APIs without re-listing them |
131
- | `cms: true` OR `account: true` | `https://${domain}` for each `cms.domain` / `account.domain` / `domain` / inferred unified domain | `connectSrc` | The Vite bundle hardcodes `VITE_QUICKBACK_API_URL` at compile time, so the SPA fetches that exact URL even when the page is served from a different origin (e.g. localhost dev hitting prod-baked SPA). Emitted with the host's first letter capitalised (`https://Api.example.com`) so `wrangler dev`'s response-header rewrite can't mangle it — see [the `wrangler dev` note below](#why-the-spa-baked-origin-shows-up-capitalised-in-csp). |
131
+ | `cms: true` OR `account: true` | `https://${domain}` for each `cms.domain` / `account.domain` / `domain` | `connectSrc` | The Vite bundle hardcodes `VITE_QUICKBACK_API_URL` at compile time, so the SPA fetches that exact URL even when the page is served from a different origin (e.g. localhost dev hitting prod-baked SPA). Emitted with the host's first letter capitalised (`https://Api.example.com`) so `wrangler dev`'s response-header rewrite can't mangle it — see [the `wrangler dev` note below](#why-the-spa-baked-origin-shows-up-capitalised-in-csp). |
132
132
  | `cms: true` OR `account: true` | `'sha256-…'` (one exact hash per bundled SPA) | `scriptSrc` | The worker injects `<script>window.__QUICKBACK_RUNTIME={...}</script>` into every served SPA shell (runtime-configured SPAs). The blob is fixed at compile time, so an exact script hash keeps strict `script-src` policies intact — no `'unsafe-inline'`. |
133
133
 
134
134
  **Scaffold rule:** if you set `defaultSrc` but omit the target directive (e.g. you wrote `defaultSrc: ['@self']` and nothing for `connectSrc`), auto-config creates the new directive seeded with your `defaultSrc` values plus the addition. `defaultSrc` itself stays clean. So `defaultSrc: ['@self']` + auto-config produces:
@@ -424,7 +424,7 @@ The compiler emits one synthetic `src/routes/__namespace-event-scope.routes.ts`
424
424
 
425
425
  ### Multi-lane via — first match wins
426
426
 
427
- When more than one relationship can authorize a caller for the namespaced resource, pass `via:` as an array. The middleware tries each lane in declaration order and stops at the first match — `ctx.<exposeAs>` is hydrated from whichever lane fired.
427
+ When more than one relationship can authorize a caller for the namespaced resource, pass `via:` as an array. The middleware starts every lane's probe at once and takes the first match in declaration order — a later lane never wins over an earlier lane that also matches, and `ctx.<exposeAs>` is hydrated from the lane that won. A probe that fails surfaces only when every earlier lane missed; a failure in a lane after the winner is ignored.
428
428
 
429
429
  ```typescript
430
430
  authz: {
@@ -42,10 +42,30 @@ export default defineBundle({
42
42
  soft-delete filter apply by construction — and the target table's REAL
43
43
  mask function is applied (the same read projection the CRUD list endpoint
44
44
  runs), so masked columns are safe to include. Every list slice lands as
45
- `{ data: rows }` (the per-resource cache-seed contract).
45
+ `{ data: rows, hasMore, nextCursor }` — `data` is the per-resource
46
+ cache-seed contract; `hasMore` and `nextCursor` are additive.
47
+ - **Ordering is deterministic.** `orderBy` keys apply in the order you list
48
+ them. The primary key `id` is appended ascending as the final tie-break
49
+ unless you already listed it, the same rule as the
50
+ [CRUD list](/api/query-params#pagination). Without a unique final key,
51
+ `LIMIT` picks among tied rows arbitrarily on Postgres.
52
+ - **Truncation is visible.** With `limit`, the section reads one extra row:
53
+ `hasMore: true` means more rows match than were returned. Without `limit`,
54
+ `hasMore` is always `false`.
55
+ - **`nextCursor` continues on the table's CRUD list.** When `hasMore` is
56
+ true, `nextCursor` is the same keyset cursor the CRUD list emits. Fetch
57
+ the next page with that list endpoint, passing the section's `where` as
58
+ equality filters, its `orderBy` as `?sort=`, and the cursor as
59
+ `?starting_after=`. For `orderBy: [{ createdAt: "desc" }]` and
60
+ `where: { eventId }`, that is
61
+ `GET /api/v1/guests?eventId=<id>&sort=-createdAt&starting_after=<nextCursor>`.
62
+ The CRUD list appends the same `id` tie-break, so the cursor lines up.
63
+ `nextCursor` is `null` when there is nothing more, when `columns` omits a
64
+ sort key (or `id`), or when a sort key is [masked](/define/masking) for the
65
+ caller. In those cases, raise `limit` or page the CRUD list with `?offset=`.
46
66
  - **`sections` filter**: omitted/empty = all. An un-wanted list section
47
- returns `{ data: [] }` (drop-in compatible with existing clients);
48
- un-wanted `custom` sections are absent.
67
+ returns `{ data: [], hasMore: false, nextCursor: null }` (drop-in
68
+ compatible with existing clients); un-wanted `custom` sections are absent.
49
69
  - **All sections run in one `Promise.all`.**
50
70
  - **ETag**: SHA-1 hex over `{ scopeSeed: <path params>, userId, payload }`.
51
71
  An `ifNoneMatch` match returns `{ success: true, etag, notModified: true }`
@@ -157,9 +157,9 @@ Reference implementations, both ports of the same table:
157
157
  - `examples/recruitment/quickback/features/interviews/interview_scores.ts` (SQLite)
158
158
  - `examples/recruitment-neon/quickback/features/interviews/interview_scores.ts` (Postgres)
159
159
 
160
- Postgres uses `timestamp("…", { withTimezone: true }).notNull().defaultNow()` for the
160
+ Postgres uses `timestamp("…", { withTimezone: true, precision: 3 }).notNull().defaultNow()` for the
161
161
  timestamps, `.$onUpdate(() => new Date())` on `modifiedAt`, plain `text(…)` for the
162
- actor columns, and `timestamp("deleted_at", { withTimezone: true })` for `deletedAt`.
162
+ actor columns, and `timestamp("deleted_at", { withTimezone: true, precision: 3 })` for `deletedAt`.
163
163
 
164
164
  ## Attaching pillars to a raw Drizzle table
165
165
 
@@ -535,7 +535,7 @@ Default to `feature()`. Drop to Drizzle only when:
535
535
 
536
536
  Features in the same project may mix freely — Quickback dispatches per feature — so one interop table doesn't force the rest of the project off `feature()`.
537
537
 
538
- One dialect rule: interop files **without** a `defineTable(...)` default export (internal child tables) are not dialect-translated — author them in the target database's dialect. On Postgres providers (`neon`, `planetscale-postgres`), a `sqliteTable` interop source without `defineTable` is a compile-time error; write it with `pgTable` from `drizzle-orm/pg-core` instead. Sources **with** `defineTable(...)` keep compiling across dialects automatically. On Postgres, managed audit timestamps a `sqliteTable` source declares in the SQLite shape (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as `timestamptz`, the same as every other Postgres table; API responses still carry the same ISO-8601 string.
538
+ One dialect rule: interop files **without** a `defineTable(...)` default export (internal child tables) are not dialect-translated — author them in the target database's dialect. On Postgres providers (`neon`, `planetscale-postgres`), a `sqliteTable` interop source without `defineTable` is a compile-time error; write it with `pgTable` from `drizzle-orm/pg-core` instead. Sources **with** `defineTable(...)` keep compiling across dialects automatically. On Postgres, managed audit timestamps a `sqliteTable` source declares in the SQLite shape (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as `timestamptz(3)`, the same as every other Postgres table; API responses still carry the same ISO-8601 string.
539
539
 
540
540
  ### Drizzle Column Types
541
541
 
@@ -765,7 +765,7 @@ The scoped `db` an action receives types every managed key as `?: never` on `.in
765
765
 
766
766
  The runtime layer **hard-stamps** every audit field on every write, so the audit log can never be forged by a crafted request body or by a client echoing a row back into a PATCH.
767
767
 
768
- On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `BEFORE UPDATE` triggers on every feature table (`public.set_audit_fields_on_insert()` / `_on_update()`). They set `created_at` / `modified_at` to the database's `now()` and apply the same actor rule as the wrapper — the actor column always names whoever did the write:
768
+ On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `BEFORE UPDATE` triggers on every feature table (`public.set_audit_fields_on_insert()` / `_on_update()`). They set `created_at` / `modified_at` to the database's `now()` truncated to the millisecond (`date_trunc('milliseconds', now())`) and apply the same actor rule as the wrapper — the actor column always names whoever did the write:
769
769
 
770
770
  - a verified caller (`auth.user_id()`) always wins, so no request can write someone else's id;
771
771
  - with no verified caller — a `scope:` principal, a delegated principal, the service lane, a `system:` actor — the actor the Worker already stamped is kept;
@@ -773,6 +773,16 @@ On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `
773
773
 
774
774
  `created_at` / `created_by` never change on update.
775
775
 
776
+ **Postgres stores managed timestamps at millisecond precision.** `createdAt` / `modifiedAt` / `deletedAt` are `timestamp(3) with time zone`, the same precision as D1's ISO text, a JS `Date`, and the wire format (`.sssZ`). A keyset cursor carries its boundary value through a `Date`, so a microsecond column would never compare equal to the cursor: ascending pages repeated rows and descending pages skipped rows that shared a millisecond (#602). The triggers truncate rather than round, so a stamp never lands after the transaction's `now()`. The column `DEFAULT now()` (reached only by raw SQL on a table without the triggers) is rounded to the millisecond by Postgres. Timestamp columns you declare yourself keep the precision you give them.
777
+
778
+ Recompiling a Postgres project last compiled by 0.69.0 or earlier adds a migration that changes each managed column's type:
779
+
780
+ ```sql
781
+ ALTER TABLE "app"."notes" ALTER COLUMN "created_at" SET DATA TYPE timestamp (3) with time zone USING "created_at"::timestamp (3) with time zone;
782
+ ```
783
+
784
+ Existing values are **rounded** to the nearest millisecond (`…08.624500` becomes `…08.625`). The type change rewrites the table under an `ACCESS EXCLUSIVE` lock, so apply it in a quiet window on large tables. The same compile re-emits the trigger functions (`CREATE OR REPLACE`) in a new RLS migration.
785
+
776
786
  Because the value would be discarded anyway, the generated `db` handle refuses it at the type level: on the scoped `db`, `.insert().values()` types `createdAt` / `modifiedAt` / `createdBy` / `modifiedBy` / `deletedAt` / `deletedBy` as `?: never`, and `.update().set()` types the audit quartet plus `deletedBy` the same way. Supplying one is a **compile error** — not a silent discard.
777
787
 
778
788
  ```ts
@@ -349,7 +349,7 @@ so it can only ever carry the role the caller actually proved this request.
349
349
  - A **bulk-grant lane** (`{ roles: [...] }` or `{ team: true }`) mints **no** scope role — it opens the gate via the caller's org role without proving a relationship. The gate passes; the caller carries their org role, not a minted scope role.
350
350
  - **The org claim is only ever signed beside a membership role.** Every mint site — `/scope/v1/enter`, the namespace resolver, `/api/v1/token` — writes `orgId` into the token only when a membership `role` accompanies it, and the auth middleware ignores an `orgId` claim that arrives without a `role`. A relationship-promoted tenant (the in-request `ctx.activeOrgId` stamped from the proven row so the firewall resolves) is never persisted as a bare tenant grant.
351
351
  - **`/scope/v1/enter` drops the org claims for a foreign-tenant instance.** When the relationship's `from` table carries an organization column, the enter route reads it off the proven row (the same row the probe already fetched — no extra query) and compares it with `ctx.activeOrgId`. A mismatch — an org-B member entering an org-A event — mints the token **without** `orgId` / `role`: a relationship-only principal, exactly the state the namespace resolver gives the same caller. The caller keeps their org seat for org-B requests by using their session or a plain `/api/v1/token`; the scope token is for the scope. A `from` table with no organization column (a global reference relationship) leaves the claim untouched.
352
- - **Every mint tenant-binds the instance.** A relationship row is matched without tenant scoping (a cross-tenant attendee has no `activeOrgId`), so the row alone can't prove which tenant's instance it names. When the relationship's `from` table carries an organization column, every site that mints from a relationship row — `/scope/v1/enter`, [`ctx.mintScope`](#sessionless-scope-mint--ctxmintscope), and this namespace resolver (the in-memory stamp **and** the `mintScope` token) — also loads the **instance** row, through its own firewall with tenant scopes stripped so soft-delete still applies, and grants the role only when the instance's organization equals the proving row's. A row created in org B naming org A's event proves nothing about org A and grants nothing; a deleted instance grants nothing. (The namespace gate itself still passes on the proven row; the caller just carries no scope for the foreign instance.) The instance table is `authz.scopes.<kind>.instance` when declared (`instance: 'events'`), else the target of the relationship's `resource.column` foreign key, else the one table whose firewall pins its primary key to `ctx.scope.<kind>` (`{ field: 'id', equals: 'ctx.scope.event' }`). Several such tables is a compile error naming them — set `instance`. If nothing resolves, the compiler warns: set `instance` (or declare the FK) so the instance can be bound. A `from` table with no organization column has no tenant to compare, so it gets no binding.
352
+ - **Every mint tenant-binds the instance.** A relationship row is matched without tenant scoping (a cross-tenant attendee has no `activeOrgId`), so the row alone can't prove which tenant's instance it names. When the relationship's `from` table carries an organization column, every site that mints from a relationship row — `/scope/v1/enter`, [`ctx.mintScope`](#sessionless-scope-mint--ctxmintscope), and this namespace resolver (the in-memory stamp **and** the `mintScope` token) — also loads the **instance** row, through its own firewall with tenant scopes stripped so soft-delete still applies, and grants the role only when the instance's organization equals the proving row's. A row created in org B naming org A's event proves nothing about org A and grants nothing; a deleted instance grants nothing. (The namespace gate itself still passes on the proven row; the caller just carries no scope for the foreign instance.) The instance table is `authz.scopes.<kind>.instance` when declared (`instance: 'events'`), else the target of the relationship's `resource.column` foreign key, else the one table whose firewall pins its primary key to `ctx.scope.<kind>` (`{ field: 'id', equals: 'ctx.scope.event' }`). Several such tables is a compile error naming them — set `instance`. If nothing resolves, the compiler warns: set `instance` (or declare the FK) so the instance can be bound. A `from` table with no organization column has no tenant to compare, so it gets no binding. When the namespace gate already hydrated the instance table by the same path param, the resolver takes the instance's organization from `ctx.<exposeAs>` instead of reading it again — that row passed the table's full firewall, and any row the full firewall admits, the tenant-stripped one admits too.
353
353
 
354
354
  ### The bulk-grant lane is tenant-bound
355
355
 
@@ -365,6 +365,12 @@ gets). No relationship → `403`. Any `ctx.roles`-based check in the action then
365
365
  fails for them, scoped-db inserts stamp the *instance's* org, and the
366
366
  namespace re-mint carries no org claim.
367
367
 
368
+ The check and the hydration are one read for a caller in their own org: the
369
+ resolver loads the row by id, `ctx.activeOrgId`, and the table's firewall, and
370
+ uses it as `ctx.<exposeAs>`. A miss falls back to the tenant-only check, so a
371
+ foreign instance still re-evaluates through the relationship lanes and an
372
+ own-tenant row the firewall hides (soft-deleted, say) still `404`s.
373
+
368
374
  Multi-target namespaces (lanes that hydrate *different* tables) hydrate nothing
369
375
  for a role caller, so there is nothing to bind there — put the tenant check in
370
376
  the firewall of each table instead (an org arm in an [`any` group tenant-binds
@@ -89,7 +89,11 @@ What is the same on every provider:
89
89
  - `OLD.column` / `NEW.column` references use **SQL column names**
90
90
  (`deleted_at`, not `deletedAt`) and are validated against the table at
91
91
  compile time.
92
- - Optional `when:` is a SQL expression guard (`WHEN` clause).
92
+ - Optional `when:` is a SQL expression guard (`WHEN` clause). On Postgres it
93
+ cannot contain a subquery (`EXISTS (SELECT …)`, `IN (SELECT …)`, or a scalar
94
+ `(SELECT …)`) — Postgres refuses that at `CREATE TRIGGER` time, so the
95
+ compile fails instead. Keep the subquery-free conjuncts in `when:` and move
96
+ the subquery into `sql:` as `IF EXISTS (SELECT …) THEN RAISE EXCEPTION '…'; END IF;`.
93
97
  - SQL triggers run inside the triggering statement, so they are atomic with
94
98
  the write, and a rejection rolls the whole statement back.
95
99
  - Names are `qb_trg_<table>_<event-code>_<name>` and are the compiler's, not
@@ -203,7 +203,7 @@ WebAuthn needs a relying party ID and origin. The generated plugin resolves them
203
203
 
204
204
  1. `advanced.crossSubDomainCookies.domain` (leading dot stripped) becomes the `rpID` when configured — credentials then work across sibling subdomains.
205
205
  2. The `ACCOUNT_URL` env var, when set on the deploy target: `rpID` is its registrable hostname (`account.example.com` → `example.com`; a two-label host like `example.com` is kept whole) and the origin is its **bare origin** — a path suffix such as `/account` is dropped, so the same variable can keep serving as the email link base.
206
- 3. The compile-time account origin — `account.domain` when configured, else the project's unified host. Baked automatically; no env var required.
206
+ 3. The compile-time account origin — `account.domain` when configured, else `domain` (or the first `routes` custom domain). Baked automatically; no env var required.
207
207
 
208
208
  `rpID: 'localhost'` applies only when the project has no configured domain at all (pure local dev). If passkey registration returns 500 on a deployed worker, check that one of the three sources above resolves to the hostname the Account UI is actually served from.
209
209
 
@@ -202,7 +202,7 @@ The compiler always emits a per-route rule for **every** credential endpoint
202
202
  Better Auth mounts — not just password sign-in — so an OTP verify door (a
203
203
  6-digit, 10<sup>6</sup>-space code) is never left under the 100/min general
204
204
  limit. Your `customRules` **merge on top**: declare a path to change its limit,
205
- or add paths for project plugins.
205
+ `false` to exempt it, or add paths for project plugins.
206
206
 
207
207
  | Route(s) | Default | Reasoning |
208
208
  |----------|---------|-----------|
@@ -214,6 +214,7 @@ or add paths for project plugins.
214
214
  | `/phone-number/send-otp`, `/phone-number/verify`, `/phone-number/request-password-reset`, `/phone-number/reset-password` | 5/min per IP | SMS OTP brute force + SMS cost |
215
215
  | `/two-factor/send-otp`, `/two-factor/verify-otp`, `/two-factor/verify-totp`, `/two-factor/verify-backup-code` | 5/min per IP | Second-factor brute force |
216
216
  | `/device/init` / `/device/poll` / `/device/token` | 5 / 30 / 10 per min per IP | Device-code enumeration, polling, token exchange |
217
+ | `/get-session`, `/token` | **exempt** | Read-only, called on every page load; not credential doors. With database storage each limited call is a counter read and write in front of the session check. Declare the path in `customRules` to limit it again |
217
218
  | Everything else under `/auth/v1` | `max` (100/min per IP) | General abuse prevention |
218
219
 
219
220
  Set an edge rate-limit binding as well for defence in depth
@@ -302,8 +302,8 @@ The contract fails closed:
302
302
  `domains` (`{ api: "api-dev.example.com" }`, or the bare `domain` shorthand
303
303
  for a single-hostname project). Quickback emits no top-level `routes` block
304
304
  here — Wrangler inherits that key, so a shared one would rebind production's
305
- hostname on a dev deploy. The unified `quickback.{baseDomain}` host is
306
- inferred per target as `quickback-<env>.{baseDomain}`. See
305
+ hostname on a dev deploy. Each target names its own all-in-one host with
306
+ `domains.primary`; none is inferred. See
307
307
  [Named Environments](/configure/domains#named-environments).
308
308
 
309
309
  Set secrets per target: `wrangler secret put BETTER_AUTH_SECRET --env dev`.
@@ -246,9 +246,8 @@ The environment contract is intentionally exact and fails closed:
246
246
  hostname — and every generated source (`providers.runtime.config.routes`,
247
247
  `domain`, CMS/Account/Admin domains, `auth.domain`, `api.domain`, app domains
248
248
  and their aliases, and the derived `webhook.{baseDomain}` route) must be
249
- claimed by each environment through `domains`. The unified
250
- `quickback.{baseDomain}` host is inferred per target as
251
- `quickback-<env>.{baseDomain}`, overridable with `domains.primary`. See
249
+ claimed by each environment through `domains`. Each target names its own
250
+ all-in-one host with `domains.primary`; none is inferred. See
252
251
  [Named Environments](/configure/domains#named-environments) for the key-by-key
253
252
  mapping, the single-hostname `domain` shorthand, and the `domains: 'none'`
254
253
  workers.dev-only opt-out.
@@ -1460,11 +1459,11 @@ export const interviewScores = pgTable('interview_scores', {
1460
1459
  interviewId: text('interview_id').notNull(),
1461
1460
  rating: integer('rating').notNull(),
1462
1461
  // ── quickback:audit (compiler-managed — edits are validated, not merged) ──
1463
- createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
1464
- modifiedAt: timestamp('modified_at', { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),
1462
+ createdAt: timestamp('created_at', { withTimezone: true, precision: 3 }).notNull().defaultNow(),
1463
+ modifiedAt: timestamp('modified_at', { withTimezone: true, precision: 3 }).notNull().defaultNow().$onUpdate(() => new Date()),
1465
1464
  createdBy: text('created_by'),
1466
1465
  modifiedBy: text('modified_by'),
1467
- deletedAt: timestamp('deleted_at', { withTimezone: true }),
1466
+ deletedAt: timestamp('deleted_at', { withTimezone: true, precision: 3 }),
1468
1467
  deletedBy: text('deleted_by'),
1469
1468
  });
1470
1469
  ```
@@ -1482,10 +1481,16 @@ Tables **with** `defineTable(...)` are unaffected — existing `sqliteTable`
1482
1481
  sources with a resource config still compile to the Postgres dialect
1483
1482
  automatically. Managed audit timestamps declared in the SQLite shape
1484
1483
  (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as
1485
- `timestamptz`, like every other Postgres table — the audit wrapper and the RLS
1484
+ `timestamptz(3)`, like every other Postgres table — the audit wrapper and the RLS
1486
1485
  audit triggers both stamp timestamps, not strings. API responses carry the same
1487
1486
  ISO-8601 string as on D1.
1488
1487
 
1488
+ Managed audit timestamps are stored at millisecond precision (`timestamptz(3)`),
1489
+ and the audit triggers stamp `date_trunc('milliseconds', now())`, so keyset
1490
+ cursors page them exactly. Projects last compiled by 0.69.0 or earlier get a
1491
+ type-change migration on the next compile that rounds existing values — see
1492
+ [How auto-injection works](/define/schema#how-auto-injection-works-two-layers).
1493
+
1489
1494
  ## When to choose Neon vs D1
1490
1495
 
1491
1496
  | Factor | Neon | D1 |
@@ -253,10 +253,16 @@ postgres.js 3.4.9, drizzle-orm 0.45.2; sanitized record in the repository's
253
253
  declares them.
254
254
 
255
255
  Still to prove, and the reason this page keeps a qualifier: the deployed
256
- Hyperdrive run, and one provider-independent item — the generated RLS helper
257
- functions end up owned by the migrating actor rather than `quickback_owner`,
258
- which is why a changed security migration currently needs the setup-owner
259
- credential (see [Neon](/platform/database/neon#upgrading-an-existing-database)).
256
+ Hyperdrive run.
257
+
258
+ Objects a routine `db:migrate` creates as `quickback_admin` (trigger functions,
259
+ later tables) are re-owned to `quickback_owner` by the next security migration.
260
+ That works when the setup owner applies it: the bootstrap grants the setup owner
261
+ `quickback_admin` **WITH INHERIT TRUE** (PostgreSQL 16+ gives a role's creator
262
+ membership without INHERIT, which used to fail the re-own loop with
263
+ `must be owner of function qb_trgfn_…`). A changed security migration still
264
+ needs the setup-owner credential because of the role timeouts it sets (see
265
+ [Neon](/platform/database/neon#upgrading-an-existing-database)).
260
266
 
261
267
  ## Deploying to workers.dev only
262
268
 
@@ -187,7 +187,7 @@ Claude generates correct syntax for your database:
187
187
  createdAt: text("created_at").notNull().default('1970-01-01T00:00:00.000Z').$defaultFn(() => new Date().toISOString())
188
188
 
189
189
  // PostgreSQL / Neon
190
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
190
+ createdAt: timestamp("created_at", { withTimezone: true, precision: 3 }).notNull().defaultNow()
191
191
  ```
192
192
 
193
193
  In the `q` DSL you write `...q.audit()` instead and the compiler emits the
@@ -161,7 +161,7 @@ Open your Worker URL in a browser — the CMS is served at the root. API routes
161
161
  cms: { domain: "cms.example.com" }
162
162
  ```
163
163
 
164
- This adds a custom domain route to `wrangler.toml`. Both domains serve the same Worker — `api.example.com` for the API, `cms.example.com` for the CMS. The compiler also auto-infers a unified `quickback.example.com` domain where everything is available. See [Multi-Domain Architecture](/configure/domains).
164
+ This adds a custom domain route to `wrangler.toml`. Both domains serve the same Worker — `api.example.com` for the API, `cms.example.com` for the CMS. Set `domain` to the host where everything is available together — required when the CMS has its own hostname. See [Multi-Domain Architecture](/configure/domains).
165
165
 
166
166
  ### Access gate
167
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quickback-dev/cli",
3
- "version": "0.69.0",
3
+ "version": "0.70.2",
4
4
  "description": "CLI for Quickback — define your backend in TypeScript, compile to a fully wired Cloudflare Worker (or Bun / Node) with auth, database, migrations, security, CMS, and Account UI.",
5
5
  "author": "Kardoe Incorporated <paul@kardoe.com>",
6
6
  "license": "MIT",
@@ -45,6 +45,12 @@ It is never dropped:
45
45
  | `?resolvedAt.gte=yesterday` on a Postgres timestamp column | `400` — `"yesterday" is not an ISO 8601 timestamp` |
46
46
  | `?resolvedAt.like=2026` on a Postgres timestamp column | `400` — use `eq`, `ne`, `gt`, `gte`, `lt`, `lte` or `in` |
47
47
 
48
+ A column named like a list parameter (`sort`, `order`, `limit`, `offset`,
49
+ `search`, `fields`, `total`, `include`, `starting_after`, `ending_before`) is
50
+ not filterable: `?sort=` is always the sort control, and the OpenAPI spec omits
51
+ the column filter rather than declaring the parameter twice. Filter it through
52
+ a view or rename the column.
53
+
48
54
  Silently dropping a predicate would return **every row the firewall allows**
49
55
  while still reading as a scoped list — a typo'd or join-table field turns a
50
56
  narrow query into a full dump. The same rule closes `?search=` and `?sort=`.
@@ -91,7 +97,7 @@ currently wired into the emitted route.
91
97
  - `count` — number of records returned on this page
92
98
  - `page` / `pageSize` — derived from `?offset=` and `?limit=`
93
99
  - `hasMore` — whether more rows exist in the queried direction. Without `?total=true` it comes from a `limit + 1` over-fetch probe, so it never lies on a final page that exactly fills the limit; with `?total=true` it is page arithmetic (`page < totalPages`) on offset pages, and the probe again on cursor pages.
94
- - `nextCursor` / `prevCursor` — keyset cursors; pass them back as `?starting_after=` and `?ending_before=`. Treat them as opaque, but they are encoded, not encrypted: they carry the boundary row's sort-key values. Either can be `null` — including when the sort includes a [masked](/define/masking) column the caller may sort by (`query.roles`) but not see (`show.roles`), or a column the response does not carry (a view sorting on a field it doesn't list, or `?fields=` without the sort key); page with `?offset=` in that case.
100
+ - `nextCursor` / `prevCursor` — keyset cursors; pass them back as `?starting_after=` and `?ending_before=`. Treat them as opaque, but they are encoded, not encrypted: they carry the boundary row's sort-key values. Either can be `null` — including when the sort includes a [masked](/define/masking) column the caller may sort by (`query.roles`) but not see (`show.roles`), or a column the response does not carry (a view sorting on a field it doesn't list, or `?fields=` without the sort key); page with `?offset=` in that case. A cursor carries a timestamp sort key at millisecond precision, so sort on a column that stores milliseconds: the managed `createdAt` / `modifiedAt` / `deletedAt` do on both dialects (Postgres stores them as `timestamptz(3)`). A Postgres timestamp column you declare with microsecond precision and fill with `now()` can repeat or skip rows across pages.
95
101
  - `total` / `totalPages` — present **only** when the request passed `?total=true` (see below)
96
102
 
97
103
  There is no `limit` or `offset` member in `pagination`.
@@ -36,7 +36,7 @@ Each resource table exposes:
36
36
  | `Insert` | Createable fields, with defaults and nullable fields optional |
37
37
  | `Update` | Updatable fields, all optional |
38
38
  | `ListResponse` | `Qb.Page<Row>` |
39
- | `columns.<name>` | Type of one row column |
39
+ | `columns.<name>` | Type of one row column. A column named like a TypeScript keyword or built-in type (`number`, `string`, `delete`, …) is prefixed: `columns._number` |
40
40
  | `views.<name>.Item` | A view's projected row |
41
41
  | `views.<name>.Response` | Page plus typed aggregations where declared |
42
42
  | `actions.<name>.Input` | The action's Zod input contract |
@@ -253,6 +253,15 @@ export default defineConfig({
253
253
  `types` output, and the compile fails if `types` is `false`. It is off by
254
254
  default.
255
255
 
256
+ > **TanStack Start denies `*.client.*` on the server**
257
+ >
258
+ > TanStack Start's import protection rejects any `**/*.client.*` module in the
259
+ > server environment, which includes the SPA prerender, so importing the default
260
+ > `quickback.client.ts` fails that build with `Import denied in server
261
+ > environment`. Give the client a name outside that pattern:
262
+ > `client: "src/lib/quickback-client.ts"`.
263
+
264
+
256
265
  ```typescript
257
266
  import { createClient, QuickbackError } from "./quickback.client";
258
267
 
@@ -419,9 +428,12 @@ export default defineConfig({
419
428
  });
420
429
  ```
421
430
 
422
- Use a custom path, fan out identical copies to colocated apps (a monorepo
423
- sibling such as `../packages/shared/src/quickback.gen.ts` is allowed; absolute
424
- paths are not), disable branding, or turn the artifact off:
431
+ Use a custom path, fan out identical copies to colocated apps, disable
432
+ branding, or turn the artifact off. Paths resolve inside the project root:
433
+ `..` segments and absolute paths fail the compile (`Path traversal is not
434
+ allowed`). A sibling package consumes the file through a path alias
435
+ (`"@api/*": ["../api/client/*"]` in its `tsconfig.json`), not by emitting
436
+ into it:
425
437
 
426
438
  ```typescript
427
439
  export default defineConfig({
@@ -440,7 +452,7 @@ export default defineConfig({
440
452
  | `true` or omitted | Write `quickback.gen.ts` |
441
453
  | `false` | Do not emit the first-party type tree |
442
454
  | `"src/lib/quickback.gen.ts"` | Write to one custom path |
443
- | `["quickback.gen.ts", "../packages/shared/src/quickback.gen.ts"]` | Fan out identical copies, including outside the project |
455
+ | `["quickback.gen.ts", "apps/web/src/lib/quickback.gen.ts"]` | Fan out identical copies inside the project |
444
456
  | `{ output, brandIds: false }` | Configure paths and use structural IDs |
445
457
 
446
458
  `api-types.gen.ts` remains available through `openapi.types` for `openapi-fetch` and third-party OpenAPI tools. The two artifacts are independent: disabling OpenAPI types does not disable the first-party tree.
@@ -9,7 +9,7 @@ When you configure custom domains for CMS, Account, Admin, or `apps`, the compil
9
9
  1. Adds `custom_domain` routes to `wrangler.toml`
10
10
  2. Generates hostname-based middleware in the Worker
11
11
  3. Auto-configures cross-subdomain cookies for shared authentication
12
- 4. Auto-infers a unified `quickback.{baseDomain}` fallback domain
12
+ 4. Requires an explicit `domain` — the all-in-one host — when only cms/api/auth hostnames are declared and the bundled CMS or Account SPA is enabled
13
13
 
14
14
  All configured domains point to the **same Worker** — there's only one deployment.
15
15
 
@@ -22,7 +22,7 @@ All configured domains point to the **same Worker** — there's only one deploym
22
22
  | `auth.example.com` | `account: { domain }` | Account SPA | Pass-through |
23
23
  | `admin.example.com` | `account: { adminDomain }` | Account SPA | Pass-through |
24
24
  | `www.example.com` | `apps: { <name>: { domain } }` | User-authored SPA | Pass-through |
25
- | `quickback.example.com` | Auto-inferred | Everything | All |
25
+ | `app.example.com` | `domain` | Everything | All |
26
26
 
27
27
  ### CMS Domain
28
28
 
@@ -64,9 +64,7 @@ The names `cms`, `account`, and `public` are reserved (they collide with compile
64
64
 
65
65
  ### Unified Domain
66
66
 
67
- The compiler auto-infers a `quickback.{baseDomain}` domain from your configured custom domains. For example, if you have `cms.example.com`, it creates `quickback.example.com`.
68
-
69
- On this domain, **everything is available** on a single origin:
67
+ Set `domain` to the host where **everything is available** on a single origin:
70
68
 
71
69
  | Path | Content |
72
70
  |------|---------|
@@ -80,7 +78,12 @@ On this domain, **everything is available** on a single origin:
80
78
  | `/health` | Health check |
81
79
  | `/openapi.json` | OpenAPI spec |
82
80
 
83
- The unified domain is useful for development and debugging. You can override it with an explicit `domain` field in your config.
81
+ `domain` is required when the project's only custom hostnames are `cms.domain`, `api.domain` or `auth.domain` and the CMS or Account SPA is enabled: each of those hosts blocks part of the surface the SPAs need, so without it they would call an origin that 404s. The compile fails with `config.domain: … Set \`domain\` to the all-in-one hostname`. A `providers.runtime.config.routes` entry, an `account.domain`/`adminDomain`, or an `apps.<name>.domain` already serves everything, so projects with one of those need no `domain`.
82
+
83
+ > **No longer inferred**
84
+ >
85
+ > Earlier compilers inferred this host as `quickback.{baseDomain}` from the first declared hostname, which emitted a `custom_domain` route in a zone the deploying account might not own and failed `wrangler deploy` after the upload. Only declared hostnames are emitted now.
86
+
84
87
 
85
88
  ## Configuration
86
89
 
@@ -122,7 +125,7 @@ routes = [
122
125
  { pattern = "admin.example.com", custom_domain = true },
123
126
  { pattern = "www.example.com", custom_domain = true },
124
127
  { pattern = "example.com", custom_domain = true },
125
- { pattern = "quickback.example.com", custom_domain = true }
128
+ { pattern = "app.example.com", custom_domain = true }
126
129
  ]
127
130
  ```
128
131
 
@@ -209,7 +212,7 @@ Each `domains` key maps 1:1 to a top-level source:
209
212
 
210
213
  | `domains` key | Claims |
211
214
  |---------------|--------|
212
- | `primary` | `domain` |
215
+ | `primary` | `domain`, or this target's own all-in-one host when there is no top-level `domain` |
213
216
  | `api` | `api.domain` |
214
217
  | `auth` | `auth.domain` |
215
218
  | `cms` | `cms.domain` |
@@ -227,31 +230,18 @@ The compile fails, naming the config path to fix, when an environment leaves a g
227
230
 
228
231
  ### The unified hostname per target
229
232
 
230
- The auto-inferred `quickback.{baseDomain}` host — where every surface coexists and `/` redirects to `/cms/` — is inferred for named-environment projects too, once **per target**:
231
-
232
- | Target | Claims | Inferred unified host |
233
- |--------|--------|-----------------------|
234
- | `dev` | `api-dev.attend.vip` | `quickback-dev.attend.vip` |
235
- | `prod` | `api.attend.vip` | `quickback-prod.attend.vip` |
236
-
237
- The single-target name can't carry over verbatim: every environment would infer the same `quickback.attend.vip` from a shared base domain, and one custom domain cannot belong to two Workers. The environment key is the only thing that makes the name unique by construction.
238
-
239
- It's a hyphen rather than a new label (`quickback-dev.attend.vip`, not `quickback.dev.attend.vip`) because Cloudflare's Universal SSL covers exactly one level of subdomain — the extra label would deploy without a certificate.
240
-
241
- Set `domains.primary` to override the name on any target. That's how one environment keeps the bare hostname a single-target project would have inferred:
233
+ Each target names its own all-in-one host with `domains.primary` — the host where every surface coexists and `/` redirects to `/cms/`:
242
234
 
243
235
  ```typescript
244
- prod: { domains: { api: "api.attend.vip", primary: "quickback.attend.vip" } },
236
+ dev: { domains: { api: "api-dev.attend.vip", primary: "app-dev.attend.vip" } },
237
+ prod: { domains: { api: "api.attend.vip", primary: "app.attend.vip" } },
245
238
  ```
246
239
 
247
- Inference is skipped when the project declares `domain` explicitly (that becomes a real `primary` source each target claims by hand), when the top level configures no domains at all, and for a `domains: 'none'` target.
248
-
249
- > **These are real custom domains**
250
- >
251
- > Every inferred hostname is emitted as a `custom_domain` route, so Wrangler provisions the DNS record on deploy — same as the single-target `quickback.{baseDomain}` has always done. The zone has to be on the deploying Cloudflare account.
240
+ One custom domain cannot belong to two Workers, so a project with named environments has no shared top-level `domain`; `domains.primary` is how each target claims its own. Keep it one label deep (`app-dev.attend.vip`, not `app.dev.attend.vip`): Cloudflare's Universal SSL covers exactly one level of subdomain.
252
241
 
242
+ A target whose claimed hostnames are all cms/api/auth roles fails the compile without `domains.primary` when the CMS or Account SPA is enabled (`dev claims custom hostnames but no \`domains.primary\``); an account, admin, app or `routes[i]` claim already serves everything. A `domains: 'none'` target needs none. When the project declares a top-level `domain`, that becomes a real `primary` source each target claims by hand instead.
253
243
 
254
- Each target's unified host joins `trustedOrigins` and the CSP origin list, but does **not** become the target's `BETTER_AUTH_URL` — that stays on the auth or API hostname, matching what a single-target project resolves.
244
+ Each target's `domains.primary` host joins `trustedOrigins` and the CSP origin list, but does **not** become the target's `BETTER_AUTH_URL` — that stays on the auth or API hostname, matching what a single-target project resolves.
255
245
 
256
246
  ### One bundle, several hostnames
257
247
 
@@ -34,7 +34,8 @@ export default defineConfig({
34
34
  // [quickback:options-start]
35
35
  // ── Project ──
36
36
  //
37
- // Primary custom domain (auto-inferred from cms/account/api domains if unset).
37
+ // Primary custom domain serving /cms, /account, /api and /auth together.
38
+ // Required when only cms/api/auth hostnames are declared and the CMS or Account SPA is enabled; never inferred.
38
39
  // domain: "example.com",
39
40
  //
40
41
  // ── Embedded UIs (CMS / Account) ──
@@ -93,7 +94,7 @@ Every optional top-level key the config accepts is listed below. You never have
93
94
 
94
95
  | Field | Type | Description |
95
96
  |-------|------|-------------|
96
- | `domain` | `string` | Primary custom domain (auto-inferred from `cms`/`account`/`api` domains if unset) — see [Domains](/configure/domains) |
97
+ | `domain` | `string` | Primary custom domain serving every surface. Required when only cms/api/auth hostnames are declared and the CMS or Account SPA is enabled; never inferred — see [Domains](/configure/domains) |
97
98
  | `contract` | `{ routes?: "v1" \| "v2" }` | `routes` selects the URL prefix and nothing else (default `"v1"`). See [API Contract](/platform/api-contract#one-axis-routes). |
98
99
  | `api` | `object` | Dedicated hostname for the selected feature API contract (`/api/v1/*` or `/api/v2/*`); additive alias — see [Domains](/configure/domains) |
99
100
  | `auth` | `object` | App-level auth settings (`roles`, `roleHierarchy`, `jwt`, delegated `principals`, `loginUrl`, `domain`) — see [Auth](/configure/auth), [Access](/define/access#role-hierarchy), and [Delegated principals](#delegated-principals) |
@@ -510,11 +511,11 @@ If `signature.required: true` and no key is available, compilation fails with a
510
511
 
511
512
  ## Hostname architecture
512
513
 
513
- A modern Quickback project runs on **one Cloudflare Worker** that serves multiple URL surfaces. By default, everything lives under a single unified backend hostname (auto-inferred as `quickback.{baseDomain}` from your other configured subdomains, or overridable via `config.domain`). For larger deployments, you can opt-in to **dedicated hostnames** for specific surfaces — they're additive aliases, never replacements.
514
+ A modern Quickback project runs on **one Cloudflare Worker** that serves multiple URL surfaces. Everything lives under a single unified backend hostname — `config.domain`, or the first `providers.runtime.config.routes` custom domain. For larger deployments, you can opt-in to **dedicated hostnames** for specific surfaces — they're additive aliases, never replacements.
514
515
 
515
516
  ### The unified backend contract
516
517
 
517
- When any subdomain is configured (`account.domain`, `cms.domain`, `auth.domain`, `api.domain`, `apps.<n>.domain`), the compiler always emits a unified backend host where **every compiler-emitted backend route** is reachable:
518
+ The unified backend host (`domain`) is where **every compiler-emitted backend route** is reachable:
518
519
 
519
520
  - `/api/v1/*` and `/auth/v1/*` by default, or `/api/v2/*` and `/auth/v2/*`
520
521
  when `contract.routes` is `"v2"` (the URL axis — the standard shape does
@@ -524,9 +525,7 @@ When any subdomain is configured (`account.domain`, `cms.domain`, `auth.domain`,
524
525
  - `/account/*`, `/cms/*` — bundled SPAs (when enabled)
525
526
  - `/broadcast/v1/*` (realtime; `/broadcast/v2/*` under `contract.routes: 'v2'`), `/mcp` (MCP), etc.
526
527
 
527
- The unified hostname is `quickback.{baseDomain}` by default (where baseDomain is extracted from your first configured subdomain). Override with `config.domain` if you prefer a different name.
528
-
529
- This contract is forward-pointing: it gives a stable URL pattern for future management tooling — `https://quickback.{baseDomain}/...` will always reach a Quickback backend regardless of how the operator splits their surfaces.
528
+ When the only configured hostnames are `cms.domain`, `auth.domain` or `api.domain` and the CMS or Account SPA is enabled, `domain` is required; the compile fails without it. An `account.domain`, `apps.<n>.domain` or runtime route already serves the whole surface. It is never inferred — an earlier `quickback.{baseDomain}` inference emitted a route in a zone the account might not own.
530
529
 
531
530
  ### Dedicated hostnames (optional, additive)
532
531
 
@@ -563,9 +562,9 @@ Dual-reach is preserved on the unified host:
563
562
 
564
563
  | URL on unified host | Handler | Notes |
565
564
  |---|---|---|
566
- | `https://quickback.example.com/api/{version}/users` | feature route | Works for the selected version whether `api.domain` is set or not |
567
- | `https://quickback.example.com/auth/{version}/sign-in/email` | Better Auth | Works for the selected version whether `auth.domain` is set or not |
568
- | `https://quickback.example.com/{version}/users` | **404** | Shortcut only applies on dedicated hostnames |
565
+ | `https://app.example.com/api/{version}/users` | feature route | Works for the selected version whether `api.domain` is set or not |
566
+ | `https://app.example.com/auth/{version}/sign-in/email` | Better Auth | Works for the selected version whether `auth.domain` is set or not |
567
+ | `https://app.example.com/{version}/users` | **404** | Shortcut only applies on dedicated hostnames |
569
568
 
570
569
  Each dedicated hostname also:
571
570
 
@@ -128,7 +128,7 @@ When you opt into a `csp` object, the compiler additively widens directives base
128
128
  | `cms: true` OR `account: true` | `https://fonts.googleapis.com` | `styleSrc` | Bundled SPAs `<link>` to Google Fonts CSS |
129
129
  | `cms: true` OR `account: true` | `https://fonts.gstatic.com` | `fontSrc` | The googleapis CSS loads `.woff2` from gstatic |
130
130
  | `csp` set (always) | `@trustedOrigins` | `connectSrc` | XHR/fetch must reach the same allowlist `cors()` permits — covers cross-subdomain APIs without re-listing them |
131
- | `cms: true` OR `account: true` | `https://${domain}` for each `cms.domain` / `account.domain` / `domain` / inferred unified domain | `connectSrc` | The Vite bundle hardcodes `VITE_QUICKBACK_API_URL` at compile time, so the SPA fetches that exact URL even when the page is served from a different origin (e.g. localhost dev hitting prod-baked SPA). Emitted with the host's first letter capitalised (`https://Api.example.com`) so `wrangler dev`'s response-header rewrite can't mangle it — see [the `wrangler dev` note below](#why-the-spa-baked-origin-shows-up-capitalised-in-csp). |
131
+ | `cms: true` OR `account: true` | `https://${domain}` for each `cms.domain` / `account.domain` / `domain` | `connectSrc` | The Vite bundle hardcodes `VITE_QUICKBACK_API_URL` at compile time, so the SPA fetches that exact URL even when the page is served from a different origin (e.g. localhost dev hitting prod-baked SPA). Emitted with the host's first letter capitalised (`https://Api.example.com`) so `wrangler dev`'s response-header rewrite can't mangle it — see [the `wrangler dev` note below](#why-the-spa-baked-origin-shows-up-capitalised-in-csp). |
132
132
  | `cms: true` OR `account: true` | `'sha256-…'` (one exact hash per bundled SPA) | `scriptSrc` | The worker injects `<script>window.__QUICKBACK_RUNTIME={...}</script>` into every served SPA shell (runtime-configured SPAs). The blob is fixed at compile time, so an exact script hash keeps strict `script-src` policies intact — no `'unsafe-inline'`. |
133
133
 
134
134
  **Scaffold rule:** if you set `defaultSrc` but omit the target directive (e.g. you wrote `defaultSrc: ['@self']` and nothing for `connectSrc`), auto-config creates the new directive seeded with your `defaultSrc` values plus the addition. `defaultSrc` itself stays clean. So `defaultSrc: ['@self']` + auto-config produces:
@@ -424,7 +424,7 @@ The compiler emits one synthetic `src/routes/__namespace-event-scope.routes.ts`
424
424
 
425
425
  ### Multi-lane via — first match wins
426
426
 
427
- When more than one relationship can authorize a caller for the namespaced resource, pass `via:` as an array. The middleware tries each lane in declaration order and stops at the first match — `ctx.<exposeAs>` is hydrated from whichever lane fired.
427
+ When more than one relationship can authorize a caller for the namespaced resource, pass `via:` as an array. The middleware starts every lane's probe at once and takes the first match in declaration order — a later lane never wins over an earlier lane that also matches, and `ctx.<exposeAs>` is hydrated from the lane that won. A probe that fails surfaces only when every earlier lane missed; a failure in a lane after the winner is ignored.
428
428
 
429
429
  ```typescript
430
430
  authz: {
@@ -42,10 +42,30 @@ export default defineBundle({
42
42
  soft-delete filter apply by construction — and the target table's REAL
43
43
  mask function is applied (the same read projection the CRUD list endpoint
44
44
  runs), so masked columns are safe to include. Every list slice lands as
45
- `{ data: rows }` (the per-resource cache-seed contract).
45
+ `{ data: rows, hasMore, nextCursor }` — `data` is the per-resource
46
+ cache-seed contract; `hasMore` and `nextCursor` are additive.
47
+ - **Ordering is deterministic.** `orderBy` keys apply in the order you list
48
+ them. The primary key `id` is appended ascending as the final tie-break
49
+ unless you already listed it, the same rule as the
50
+ [CRUD list](/api/query-params#pagination). Without a unique final key,
51
+ `LIMIT` picks among tied rows arbitrarily on Postgres.
52
+ - **Truncation is visible.** With `limit`, the section reads one extra row:
53
+ `hasMore: true` means more rows match than were returned. Without `limit`,
54
+ `hasMore` is always `false`.
55
+ - **`nextCursor` continues on the table's CRUD list.** When `hasMore` is
56
+ true, `nextCursor` is the same keyset cursor the CRUD list emits. Fetch
57
+ the next page with that list endpoint, passing the section's `where` as
58
+ equality filters, its `orderBy` as `?sort=`, and the cursor as
59
+ `?starting_after=`. For `orderBy: [{ createdAt: "desc" }]` and
60
+ `where: { eventId }`, that is
61
+ `GET /api/v1/guests?eventId=<id>&sort=-createdAt&starting_after=<nextCursor>`.
62
+ The CRUD list appends the same `id` tie-break, so the cursor lines up.
63
+ `nextCursor` is `null` when there is nothing more, when `columns` omits a
64
+ sort key (or `id`), or when a sort key is [masked](/define/masking) for the
65
+ caller. In those cases, raise `limit` or page the CRUD list with `?offset=`.
46
66
  - **`sections` filter**: omitted/empty = all. An un-wanted list section
47
- returns `{ data: [] }` (drop-in compatible with existing clients);
48
- un-wanted `custom` sections are absent.
67
+ returns `{ data: [], hasMore: false, nextCursor: null }` (drop-in
68
+ compatible with existing clients); un-wanted `custom` sections are absent.
49
69
  - **All sections run in one `Promise.all`.**
50
70
  - **ETag**: SHA-1 hex over `{ scopeSeed: <path params>, userId, payload }`.
51
71
  An `ifNoneMatch` match returns `{ success: true, etag, notModified: true }`
@@ -157,9 +157,9 @@ Reference implementations, both ports of the same table:
157
157
  - `examples/recruitment/quickback/features/interviews/interview_scores.ts` (SQLite)
158
158
  - `examples/recruitment-neon/quickback/features/interviews/interview_scores.ts` (Postgres)
159
159
 
160
- Postgres uses `timestamp("…", { withTimezone: true }).notNull().defaultNow()` for the
160
+ Postgres uses `timestamp("…", { withTimezone: true, precision: 3 }).notNull().defaultNow()` for the
161
161
  timestamps, `.$onUpdate(() => new Date())` on `modifiedAt`, plain `text(…)` for the
162
- actor columns, and `timestamp("deleted_at", { withTimezone: true })` for `deletedAt`.
162
+ actor columns, and `timestamp("deleted_at", { withTimezone: true, precision: 3 })` for `deletedAt`.
163
163
 
164
164
  ## Attaching pillars to a raw Drizzle table
165
165
 
@@ -535,7 +535,7 @@ Default to `feature()`. Drop to Drizzle only when:
535
535
 
536
536
  Features in the same project may mix freely — Quickback dispatches per feature — so one interop table doesn't force the rest of the project off `feature()`.
537
537
 
538
- One dialect rule: interop files **without** a `defineTable(...)` default export (internal child tables) are not dialect-translated — author them in the target database's dialect. On Postgres providers (`neon`, `planetscale-postgres`), a `sqliteTable` interop source without `defineTable` is a compile-time error; write it with `pgTable` from `drizzle-orm/pg-core` instead. Sources **with** `defineTable(...)` keep compiling across dialects automatically. On Postgres, managed audit timestamps a `sqliteTable` source declares in the SQLite shape (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as `timestamptz`, the same as every other Postgres table; API responses still carry the same ISO-8601 string.
538
+ One dialect rule: interop files **without** a `defineTable(...)` default export (internal child tables) are not dialect-translated — author them in the target database's dialect. On Postgres providers (`neon`, `planetscale-postgres`), a `sqliteTable` interop source without `defineTable` is a compile-time error; write it with `pgTable` from `drizzle-orm/pg-core` instead. Sources **with** `defineTable(...)` keep compiling across dialects automatically. On Postgres, managed audit timestamps a `sqliteTable` source declares in the SQLite shape (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as `timestamptz(3)`, the same as every other Postgres table; API responses still carry the same ISO-8601 string.
539
539
 
540
540
  ### Drizzle Column Types
541
541
 
@@ -765,7 +765,7 @@ The scoped `db` an action receives types every managed key as `?: never` on `.in
765
765
 
766
766
  The runtime layer **hard-stamps** every audit field on every write, so the audit log can never be forged by a crafted request body or by a client echoing a row back into a PATCH.
767
767
 
768
- On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `BEFORE UPDATE` triggers on every feature table (`public.set_audit_fields_on_insert()` / `_on_update()`). They set `created_at` / `modified_at` to the database's `now()` and apply the same actor rule as the wrapper — the actor column always names whoever did the write:
768
+ On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `BEFORE UPDATE` triggers on every feature table (`public.set_audit_fields_on_insert()` / `_on_update()`). They set `created_at` / `modified_at` to the database's `now()` truncated to the millisecond (`date_trunc('milliseconds', now())`) and apply the same actor rule as the wrapper — the actor column always names whoever did the write:
769
769
 
770
770
  - a verified caller (`auth.user_id()`) always wins, so no request can write someone else's id;
771
771
  - with no verified caller — a `scope:` principal, a delegated principal, the service lane, a `system:` actor — the actor the Worker already stamped is kept;
@@ -773,6 +773,16 @@ On Postgres the RLS migration adds a database-side backstop: `BEFORE INSERT` / `
773
773
 
774
774
  `created_at` / `created_by` never change on update.
775
775
 
776
+ **Postgres stores managed timestamps at millisecond precision.** `createdAt` / `modifiedAt` / `deletedAt` are `timestamp(3) with time zone`, the same precision as D1's ISO text, a JS `Date`, and the wire format (`.sssZ`). A keyset cursor carries its boundary value through a `Date`, so a microsecond column would never compare equal to the cursor: ascending pages repeated rows and descending pages skipped rows that shared a millisecond (#602). The triggers truncate rather than round, so a stamp never lands after the transaction's `now()`. The column `DEFAULT now()` (reached only by raw SQL on a table without the triggers) is rounded to the millisecond by Postgres. Timestamp columns you declare yourself keep the precision you give them.
777
+
778
+ Recompiling a Postgres project last compiled by 0.69.0 or earlier adds a migration that changes each managed column's type:
779
+
780
+ ```sql
781
+ ALTER TABLE "app"."notes" ALTER COLUMN "created_at" SET DATA TYPE timestamp (3) with time zone USING "created_at"::timestamp (3) with time zone;
782
+ ```
783
+
784
+ Existing values are **rounded** to the nearest millisecond (`…08.624500` becomes `…08.625`). The type change rewrites the table under an `ACCESS EXCLUSIVE` lock, so apply it in a quiet window on large tables. The same compile re-emits the trigger functions (`CREATE OR REPLACE`) in a new RLS migration.
785
+
776
786
  Because the value would be discarded anyway, the generated `db` handle refuses it at the type level: on the scoped `db`, `.insert().values()` types `createdAt` / `modifiedAt` / `createdBy` / `modifiedBy` / `deletedAt` / `deletedBy` as `?: never`, and `.update().set()` types the audit quartet plus `deletedBy` the same way. Supplying one is a **compile error** — not a silent discard.
777
787
 
778
788
  ```ts
@@ -349,7 +349,7 @@ so it can only ever carry the role the caller actually proved this request.
349
349
  - A **bulk-grant lane** (`{ roles: [...] }` or `{ team: true }`) mints **no** scope role — it opens the gate via the caller's org role without proving a relationship. The gate passes; the caller carries their org role, not a minted scope role.
350
350
  - **The org claim is only ever signed beside a membership role.** Every mint site — `/scope/v1/enter`, the namespace resolver, `/api/v1/token` — writes `orgId` into the token only when a membership `role` accompanies it, and the auth middleware ignores an `orgId` claim that arrives without a `role`. A relationship-promoted tenant (the in-request `ctx.activeOrgId` stamped from the proven row so the firewall resolves) is never persisted as a bare tenant grant.
351
351
  - **`/scope/v1/enter` drops the org claims for a foreign-tenant instance.** When the relationship's `from` table carries an organization column, the enter route reads it off the proven row (the same row the probe already fetched — no extra query) and compares it with `ctx.activeOrgId`. A mismatch — an org-B member entering an org-A event — mints the token **without** `orgId` / `role`: a relationship-only principal, exactly the state the namespace resolver gives the same caller. The caller keeps their org seat for org-B requests by using their session or a plain `/api/v1/token`; the scope token is for the scope. A `from` table with no organization column (a global reference relationship) leaves the claim untouched.
352
- - **Every mint tenant-binds the instance.** A relationship row is matched without tenant scoping (a cross-tenant attendee has no `activeOrgId`), so the row alone can't prove which tenant's instance it names. When the relationship's `from` table carries an organization column, every site that mints from a relationship row — `/scope/v1/enter`, [`ctx.mintScope`](#sessionless-scope-mint--ctxmintscope), and this namespace resolver (the in-memory stamp **and** the `mintScope` token) — also loads the **instance** row, through its own firewall with tenant scopes stripped so soft-delete still applies, and grants the role only when the instance's organization equals the proving row's. A row created in org B naming org A's event proves nothing about org A and grants nothing; a deleted instance grants nothing. (The namespace gate itself still passes on the proven row; the caller just carries no scope for the foreign instance.) The instance table is `authz.scopes.<kind>.instance` when declared (`instance: 'events'`), else the target of the relationship's `resource.column` foreign key, else the one table whose firewall pins its primary key to `ctx.scope.<kind>` (`{ field: 'id', equals: 'ctx.scope.event' }`). Several such tables is a compile error naming them — set `instance`. If nothing resolves, the compiler warns: set `instance` (or declare the FK) so the instance can be bound. A `from` table with no organization column has no tenant to compare, so it gets no binding.
352
+ - **Every mint tenant-binds the instance.** A relationship row is matched without tenant scoping (a cross-tenant attendee has no `activeOrgId`), so the row alone can't prove which tenant's instance it names. When the relationship's `from` table carries an organization column, every site that mints from a relationship row — `/scope/v1/enter`, [`ctx.mintScope`](#sessionless-scope-mint--ctxmintscope), and this namespace resolver (the in-memory stamp **and** the `mintScope` token) — also loads the **instance** row, through its own firewall with tenant scopes stripped so soft-delete still applies, and grants the role only when the instance's organization equals the proving row's. A row created in org B naming org A's event proves nothing about org A and grants nothing; a deleted instance grants nothing. (The namespace gate itself still passes on the proven row; the caller just carries no scope for the foreign instance.) The instance table is `authz.scopes.<kind>.instance` when declared (`instance: 'events'`), else the target of the relationship's `resource.column` foreign key, else the one table whose firewall pins its primary key to `ctx.scope.<kind>` (`{ field: 'id', equals: 'ctx.scope.event' }`). Several such tables is a compile error naming them — set `instance`. If nothing resolves, the compiler warns: set `instance` (or declare the FK) so the instance can be bound. A `from` table with no organization column has no tenant to compare, so it gets no binding. When the namespace gate already hydrated the instance table by the same path param, the resolver takes the instance's organization from `ctx.<exposeAs>` instead of reading it again — that row passed the table's full firewall, and any row the full firewall admits, the tenant-stripped one admits too.
353
353
 
354
354
  ### The bulk-grant lane is tenant-bound
355
355
 
@@ -365,6 +365,12 @@ gets). No relationship → `403`. Any `ctx.roles`-based check in the action then
365
365
  fails for them, scoped-db inserts stamp the *instance's* org, and the
366
366
  namespace re-mint carries no org claim.
367
367
 
368
+ The check and the hydration are one read for a caller in their own org: the
369
+ resolver loads the row by id, `ctx.activeOrgId`, and the table's firewall, and
370
+ uses it as `ctx.<exposeAs>`. A miss falls back to the tenant-only check, so a
371
+ foreign instance still re-evaluates through the relationship lanes and an
372
+ own-tenant row the firewall hides (soft-deleted, say) still `404`s.
373
+
368
374
  Multi-target namespaces (lanes that hydrate *different* tables) hydrate nothing
369
375
  for a role caller, so there is nothing to bind there — put the tenant check in
370
376
  the firewall of each table instead (an org arm in an [`any` group tenant-binds
@@ -89,7 +89,11 @@ What is the same on every provider:
89
89
  - `OLD.column` / `NEW.column` references use **SQL column names**
90
90
  (`deleted_at`, not `deletedAt`) and are validated against the table at
91
91
  compile time.
92
- - Optional `when:` is a SQL expression guard (`WHEN` clause).
92
+ - Optional `when:` is a SQL expression guard (`WHEN` clause). On Postgres it
93
+ cannot contain a subquery (`EXISTS (SELECT …)`, `IN (SELECT …)`, or a scalar
94
+ `(SELECT …)`) — Postgres refuses that at `CREATE TRIGGER` time, so the
95
+ compile fails instead. Keep the subquery-free conjuncts in `when:` and move
96
+ the subquery into `sql:` as `IF EXISTS (SELECT …) THEN RAISE EXCEPTION '…'; END IF;`.
93
97
  - SQL triggers run inside the triggering statement, so they are atomic with
94
98
  the write, and a rejection rolls the whole statement back.
95
99
  - Names are `qb_trg_<table>_<event-code>_<name>` and are the compiler's, not
@@ -203,7 +203,7 @@ WebAuthn needs a relying party ID and origin. The generated plugin resolves them
203
203
 
204
204
  1. `advanced.crossSubDomainCookies.domain` (leading dot stripped) becomes the `rpID` when configured — credentials then work across sibling subdomains.
205
205
  2. The `ACCOUNT_URL` env var, when set on the deploy target: `rpID` is its registrable hostname (`account.example.com` → `example.com`; a two-label host like `example.com` is kept whole) and the origin is its **bare origin** — a path suffix such as `/account` is dropped, so the same variable can keep serving as the email link base.
206
- 3. The compile-time account origin — `account.domain` when configured, else the project's unified host. Baked automatically; no env var required.
206
+ 3. The compile-time account origin — `account.domain` when configured, else `domain` (or the first `routes` custom domain). Baked automatically; no env var required.
207
207
 
208
208
  `rpID: 'localhost'` applies only when the project has no configured domain at all (pure local dev). If passkey registration returns 500 on a deployed worker, check that one of the three sources above resolves to the hostname the Account UI is actually served from.
209
209
 
@@ -202,7 +202,7 @@ The compiler always emits a per-route rule for **every** credential endpoint
202
202
  Better Auth mounts — not just password sign-in — so an OTP verify door (a
203
203
  6-digit, 10<sup>6</sup>-space code) is never left under the 100/min general
204
204
  limit. Your `customRules` **merge on top**: declare a path to change its limit,
205
- or add paths for project plugins.
205
+ `false` to exempt it, or add paths for project plugins.
206
206
 
207
207
  | Route(s) | Default | Reasoning |
208
208
  |----------|---------|-----------|
@@ -214,6 +214,7 @@ or add paths for project plugins.
214
214
  | `/phone-number/send-otp`, `/phone-number/verify`, `/phone-number/request-password-reset`, `/phone-number/reset-password` | 5/min per IP | SMS OTP brute force + SMS cost |
215
215
  | `/two-factor/send-otp`, `/two-factor/verify-otp`, `/two-factor/verify-totp`, `/two-factor/verify-backup-code` | 5/min per IP | Second-factor brute force |
216
216
  | `/device/init` / `/device/poll` / `/device/token` | 5 / 30 / 10 per min per IP | Device-code enumeration, polling, token exchange |
217
+ | `/get-session`, `/token` | **exempt** | Read-only, called on every page load; not credential doors. With database storage each limited call is a counter read and write in front of the session check. Declare the path in `customRules` to limit it again |
217
218
  | Everything else under `/auth/v1` | `max` (100/min per IP) | General abuse prevention |
218
219
 
219
220
  Set an edge rate-limit binding as well for defence in depth
@@ -302,8 +302,8 @@ The contract fails closed:
302
302
  `domains` (`{ api: "api-dev.example.com" }`, or the bare `domain` shorthand
303
303
  for a single-hostname project). Quickback emits no top-level `routes` block
304
304
  here — Wrangler inherits that key, so a shared one would rebind production's
305
- hostname on a dev deploy. The unified `quickback.{baseDomain}` host is
306
- inferred per target as `quickback-<env>.{baseDomain}`. See
305
+ hostname on a dev deploy. Each target names its own all-in-one host with
306
+ `domains.primary`; none is inferred. See
307
307
  [Named Environments](/configure/domains#named-environments).
308
308
 
309
309
  Set secrets per target: `wrangler secret put BETTER_AUTH_SECRET --env dev`.
@@ -246,9 +246,8 @@ The environment contract is intentionally exact and fails closed:
246
246
  hostname — and every generated source (`providers.runtime.config.routes`,
247
247
  `domain`, CMS/Account/Admin domains, `auth.domain`, `api.domain`, app domains
248
248
  and their aliases, and the derived `webhook.{baseDomain}` route) must be
249
- claimed by each environment through `domains`. The unified
250
- `quickback.{baseDomain}` host is inferred per target as
251
- `quickback-<env>.{baseDomain}`, overridable with `domains.primary`. See
249
+ claimed by each environment through `domains`. Each target names its own
250
+ all-in-one host with `domains.primary`; none is inferred. See
252
251
  [Named Environments](/configure/domains#named-environments) for the key-by-key
253
252
  mapping, the single-hostname `domain` shorthand, and the `domains: 'none'`
254
253
  workers.dev-only opt-out.
@@ -1460,11 +1459,11 @@ export const interviewScores = pgTable('interview_scores', {
1460
1459
  interviewId: text('interview_id').notNull(),
1461
1460
  rating: integer('rating').notNull(),
1462
1461
  // ── quickback:audit (compiler-managed — edits are validated, not merged) ──
1463
- createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
1464
- modifiedAt: timestamp('modified_at', { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),
1462
+ createdAt: timestamp('created_at', { withTimezone: true, precision: 3 }).notNull().defaultNow(),
1463
+ modifiedAt: timestamp('modified_at', { withTimezone: true, precision: 3 }).notNull().defaultNow().$onUpdate(() => new Date()),
1465
1464
  createdBy: text('created_by'),
1466
1465
  modifiedBy: text('modified_by'),
1467
- deletedAt: timestamp('deleted_at', { withTimezone: true }),
1466
+ deletedAt: timestamp('deleted_at', { withTimezone: true, precision: 3 }),
1468
1467
  deletedBy: text('deleted_by'),
1469
1468
  });
1470
1469
  ```
@@ -1482,10 +1481,16 @@ Tables **with** `defineTable(...)` are unaffected — existing `sqliteTable`
1482
1481
  sources with a resource config still compile to the Postgres dialect
1483
1482
  automatically. Managed audit timestamps declared in the SQLite shape
1484
1483
  (`createdAt` / `modifiedAt` / `deletedAt` as `text`) are emitted as
1485
- `timestamptz`, like every other Postgres table — the audit wrapper and the RLS
1484
+ `timestamptz(3)`, like every other Postgres table — the audit wrapper and the RLS
1486
1485
  audit triggers both stamp timestamps, not strings. API responses carry the same
1487
1486
  ISO-8601 string as on D1.
1488
1487
 
1488
+ Managed audit timestamps are stored at millisecond precision (`timestamptz(3)`),
1489
+ and the audit triggers stamp `date_trunc('milliseconds', now())`, so keyset
1490
+ cursors page them exactly. Projects last compiled by 0.69.0 or earlier get a
1491
+ type-change migration on the next compile that rounds existing values — see
1492
+ [How auto-injection works](/define/schema#how-auto-injection-works-two-layers).
1493
+
1489
1494
  ## When to choose Neon vs D1
1490
1495
 
1491
1496
  | Factor | Neon | D1 |
@@ -253,10 +253,16 @@ postgres.js 3.4.9, drizzle-orm 0.45.2; sanitized record in the repository's
253
253
  declares them.
254
254
 
255
255
  Still to prove, and the reason this page keeps a qualifier: the deployed
256
- Hyperdrive run, and one provider-independent item — the generated RLS helper
257
- functions end up owned by the migrating actor rather than `quickback_owner`,
258
- which is why a changed security migration currently needs the setup-owner
259
- credential (see [Neon](/platform/database/neon#upgrading-an-existing-database)).
256
+ Hyperdrive run.
257
+
258
+ Objects a routine `db:migrate` creates as `quickback_admin` (trigger functions,
259
+ later tables) are re-owned to `quickback_owner` by the next security migration.
260
+ That works when the setup owner applies it: the bootstrap grants the setup owner
261
+ `quickback_admin` **WITH INHERIT TRUE** (PostgreSQL 16+ gives a role's creator
262
+ membership without INHERIT, which used to fail the re-own loop with
263
+ `must be owner of function qb_trgfn_…`). A changed security migration still
264
+ needs the setup-owner credential because of the role timeouts it sets (see
265
+ [Neon](/platform/database/neon#upgrading-an-existing-database)).
260
266
 
261
267
  ## Deploying to workers.dev only
262
268
 
@@ -187,7 +187,7 @@ Claude generates correct syntax for your database:
187
187
  createdAt: text("created_at").notNull().default('1970-01-01T00:00:00.000Z').$defaultFn(() => new Date().toISOString())
188
188
 
189
189
  // PostgreSQL / Neon
190
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
190
+ createdAt: timestamp("created_at", { withTimezone: true, precision: 3 }).notNull().defaultNow()
191
191
  ```
192
192
 
193
193
  In the `q` DSL you write `...q.audit()` instead and the compiler emits the
@@ -161,7 +161,7 @@ Open your Worker URL in a browser — the CMS is served at the root. API routes
161
161
  cms: { domain: "cms.example.com" }
162
162
  ```
163
163
 
164
- This adds a custom domain route to `wrangler.toml`. Both domains serve the same Worker — `api.example.com` for the API, `cms.example.com` for the CMS. The compiler also auto-infers a unified `quickback.example.com` domain where everything is available. See [Multi-Domain Architecture](/configure/domains).
164
+ This adds a custom domain route to `wrangler.toml`. Both domains serve the same Worker — `api.example.com` for the API, `cms.example.com` for the CMS. Set `domain` to the host where everything is available together — required when the CMS has its own hostname. See [Multi-Domain Architecture](/configure/domains).
165
165
 
166
166
  ### Access gate
167
167