@quickback-dev/cli 0.60.9 → 0.61.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +10 -1
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/docs/content.d.ts +7 -0
  5. package/dist/docs/content.d.ts.map +1 -0
  6. package/dist/docs/content.js +737 -0
  7. package/dist/docs/content.js.map +1 -0
  8. package/dist/index.js +1 -1
  9. package/dist/lib/compiler-stubs.d.ts +4 -0
  10. package/dist/lib/compiler-stubs.d.ts.map +1 -1
  11. package/dist/lib/compiler-stubs.js +4 -0
  12. package/dist/lib/compiler-stubs.js.map +1 -1
  13. package/dist/lib/file-loader.d.ts +11 -0
  14. package/dist/lib/file-loader.d.ts.map +1 -1
  15. package/dist/lib/file-loader.js +35 -0
  16. package/dist/lib/file-loader.js.map +1 -1
  17. package/dist/lib/helpers.d.ts +39 -0
  18. package/dist/lib/helpers.d.ts.map +1 -0
  19. package/dist/lib/helpers.js +299 -0
  20. package/dist/lib/helpers.js.map +1 -0
  21. package/dist/skill/SKILL.md +3 -0
  22. package/dist/skill/docs/api/errors.md +1 -0
  23. package/dist/skill/docs/api/query-params.md +26 -0
  24. package/dist/skill/docs/changelog/index.md +85 -0
  25. package/dist/skill/docs/configure/auth.md +17 -12
  26. package/dist/skill/docs/configure/domains.md +1 -1
  27. package/dist/skill/docs/configure/index.md +6 -6
  28. package/dist/skill/docs/define/actions/defining.md +37 -1
  29. package/dist/skill/docs/define/actions/index.md +18 -0
  30. package/dist/skill/docs/define/areas.md +90 -7
  31. package/dist/skill/docs/define/feature.md +88 -27
  32. package/dist/skill/docs/define/index.md +7 -1
  33. package/dist/skill/docs/define/scopes.md +1 -1
  34. package/dist/skill/docs/define/security.md +10 -0
  35. package/dist/skill/docs/define/transitions.md +11 -35
  36. package/dist/skill/docs/platform/auth/jwt-optimization.md +15 -3
  37. package/dist/skill/docs/platform/database/d1.md +6 -1
  38. package/dist/skill/docs/platform/email/index.md +112 -0
  39. package/dist/skill/docs/platform/index.md +1 -0
  40. package/dist/skill/docs/platform/realtime/index.md +17 -0
  41. package/dist/skill/docs/platform/webhooks/outbound.md +31 -6
  42. package/dist/skill/docs/start/deploy-browser.md +15 -6
  43. package/dist/skill/docs/start/first-api.md +16 -0
  44. package/dist/skill/docs/ui/account/features/admin.md +29 -5
  45. package/dist/skill/docs/ui/account/features/index.md +22 -0
  46. package/dist/skill/docs/ui/admin/connecting.md +6 -4
  47. package/dist/skill/docs/ui/admin/index.md +49 -10
  48. package/dist/skill/docs/ui/admin/security.md +6 -7
  49. package/package.json +2 -10
  50. package/src/skill/SKILL.md +3 -0
  51. package/src/skill/docs/api/errors.md +1 -0
  52. package/src/skill/docs/api/query-params.md +26 -0
  53. package/src/skill/docs/changelog/index.md +85 -0
  54. package/src/skill/docs/configure/auth.md +17 -12
  55. package/src/skill/docs/configure/domains.md +1 -1
  56. package/src/skill/docs/configure/index.md +6 -6
  57. package/src/skill/docs/define/actions/defining.md +37 -1
  58. package/src/skill/docs/define/actions/index.md +18 -0
  59. package/src/skill/docs/define/areas.md +90 -7
  60. package/src/skill/docs/define/feature.md +88 -27
  61. package/src/skill/docs/define/index.md +7 -1
  62. package/src/skill/docs/define/scopes.md +1 -1
  63. package/src/skill/docs/define/security.md +10 -0
  64. package/src/skill/docs/define/transitions.md +11 -35
  65. package/src/skill/docs/platform/auth/jwt-optimization.md +15 -3
  66. package/src/skill/docs/platform/database/d1.md +6 -1
  67. package/src/skill/docs/platform/email/index.md +112 -0
  68. package/src/skill/docs/platform/index.md +1 -0
  69. package/src/skill/docs/platform/realtime/index.md +17 -0
  70. package/src/skill/docs/platform/webhooks/outbound.md +31 -6
  71. package/src/skill/docs/start/deploy-browser.md +15 -6
  72. package/src/skill/docs/start/first-api.md +16 -0
  73. package/src/skill/docs/ui/account/features/admin.md +29 -5
  74. package/src/skill/docs/ui/account/features/index.md +22 -0
  75. package/src/skill/docs/ui/admin/connecting.md +6 -4
  76. package/src/skill/docs/ui/admin/index.md +49 -10
  77. package/src/skill/docs/ui/admin/security.md +6 -7
@@ -0,0 +1,299 @@
1
+ export function validateBindingName(name) {
2
+ if (!name || name.trim().length === 0)
3
+ return "Please enter a binding name";
4
+ if (!/^[A-Z0-9_]+$/.test(name))
5
+ return "Use ONLY A-Z, 0-9, and underscores";
6
+ return undefined;
7
+ }
8
+ export function updateJSON(filePath, mutator) {
9
+ const { readFileSync, writeFileSync } = require("fs");
10
+ const json = JSON.parse(readFileSync(filePath, "utf8"));
11
+ const next = mutator(json);
12
+ writeFileSync(filePath, JSON.stringify(next, null, 2));
13
+ }
14
+ export function extractFirstBlock(toml, header) {
15
+ const re = new RegExp(`(\\[\\[${header}\\]\\][\\s\\S]*?)(?=\\n\\[\\[|$)`);
16
+ const match = re.exec(toml);
17
+ if (!match)
18
+ return null;
19
+ return { block: match[1], start: match.index, end: match.index + match[1].length };
20
+ }
21
+ export function updateD1Block(toml, binding, dbName) {
22
+ const found = extractFirstBlock(toml, "d1_databases");
23
+ if (!found)
24
+ return toml;
25
+ let block = found.block;
26
+ if (/binding\s*=\s*"[^"]+"/.test(block)) {
27
+ block = block.replace(/binding\s*=\s*"[^"]+"/, `binding = "${binding}"`);
28
+ }
29
+ else {
30
+ block = block.replace(/\[\[d1_databases\]\]/, `[[d1_databases]]\nbinding = "${binding}"`);
31
+ }
32
+ if (/database_name\s*=\s*"[^"]+"/.test(block)) {
33
+ block = block.replace(/database_name\s*=\s*"[^"]+"/, `database_name = "${dbName}"`);
34
+ }
35
+ return toml.slice(0, found.start) + block + toml.slice(found.end);
36
+ }
37
+ export function appendOrReplaceKvNamespaceBlock(toml, binding, id) {
38
+ const kvBlockRegex = /\[\[kv_namespaces\]\][\s\S]*?(?=(\n\[\[|$))/g;
39
+ const blocks = toml.match(kvBlockRegex) || [];
40
+ const newBlock = [
41
+ "[[kv_namespaces]]",
42
+ `binding = "${binding}"`,
43
+ id ? `id = "${id}"` : `id = "YOUR_KV_NAMESPACE_ID"`,
44
+ ].join("\n");
45
+ const existingIndex = blocks.findIndex(b => b.includes(`binding = "${binding}"`));
46
+ if (existingIndex >= 0) {
47
+ const existing = blocks[existingIndex];
48
+ return toml.replace(existing, newBlock);
49
+ }
50
+ return toml.trimEnd() + "\n\n" + newBlock + "\n";
51
+ }
52
+ export function appendOrReplaceR2Block(toml, binding, bucketName) {
53
+ const r2BlockRegex = /\[\[r2_buckets\]\][\s\S]*?(?=(\n\[\[|$))/g;
54
+ const blocks = toml.match(r2BlockRegex) || [];
55
+ const newBlock = ["[[r2_buckets]]", `binding = "${binding}"`, `bucket_name = "${bucketName}"`].join("\n");
56
+ const existingIndex = blocks.findIndex(b => b.includes(`binding = "${binding}"`));
57
+ if (existingIndex >= 0) {
58
+ const existing = blocks[existingIndex];
59
+ return toml.replace(existing, newBlock);
60
+ }
61
+ return toml.trimEnd() + "\n\n" + newBlock + "\n";
62
+ }
63
+ export function appendOrReplaceHyperdriveBlock(toml, binding, id, database, connectionString) {
64
+ const blockRegex = /\[\[hyperdrive\]\][\s\S]*?(?=(\n\[\[|$))/g;
65
+ const blocks = toml.match(blockRegex) || [];
66
+ // Use provided connection string or fallback to proper local defaults
67
+ let localConnectionString = connectionString || "postgresql://postgres:password@localhost:5432/postgres";
68
+ if (!connectionString && database === "hyperdrive-mysql") {
69
+ localConnectionString = "mysql://root:password@localhost:3306/mysql";
70
+ }
71
+ const placeholderId = id || "YOUR_HYPERDRIVE_ID";
72
+ const newBlock = [
73
+ "[[hyperdrive]]",
74
+ `binding = "${binding}"`,
75
+ `id = "${placeholderId}"`,
76
+ `localConnectionString = "${localConnectionString}"`,
77
+ ].join("\n");
78
+ const existingIndex = blocks.findIndex(b => b.includes(`binding = "${binding}"`));
79
+ if (existingIndex >= 0) {
80
+ const existing = blocks[existingIndex];
81
+ return toml.replace(existing, newBlock);
82
+ }
83
+ return toml.trimEnd() + "\n\n" + newBlock + "\n";
84
+ }
85
+ export function parseWranglerToml(tomlContent) {
86
+ const databases = [];
87
+ // Parse D1 databases
88
+ const d1Regex = /\[\[d1_databases\]\]\s*\n([^[]*?)(?=\n\[|\n$|$)/g;
89
+ let d1Match;
90
+ while ((d1Match = d1Regex.exec(tomlContent)) !== null) {
91
+ const block = d1Match[1];
92
+ const bindingRegex = /binding\s*=\s*"([^"]+)"/;
93
+ const nameRegex = /database_name\s*=\s*"([^"]+)"/;
94
+ const idRegex = /database_id\s*=\s*"([^"]+)"/;
95
+ const bindingMatch = bindingRegex.exec(block);
96
+ const nameMatch = nameRegex.exec(block);
97
+ const idMatch = idRegex.exec(block);
98
+ if (bindingMatch) {
99
+ databases.push({
100
+ type: "d1",
101
+ binding: bindingMatch[1],
102
+ name: nameMatch?.[1],
103
+ id: idMatch?.[1],
104
+ });
105
+ }
106
+ }
107
+ // Parse Hyperdrive databases
108
+ const hyperdriveRegex = /\[\[hyperdrive\]\]\s*\n([^[]*?)(?=\n\[|\n$|$)/g;
109
+ let hyperdriveMatch;
110
+ while ((hyperdriveMatch = hyperdriveRegex.exec(tomlContent)) !== null) {
111
+ const block = hyperdriveMatch[1];
112
+ const bindingRegex = /binding\s*=\s*"([^"]+)"/;
113
+ const idRegex = /id\s*=\s*"([^"]+)"/;
114
+ const bindingMatch = bindingRegex.exec(block);
115
+ const idMatch = idRegex.exec(block);
116
+ if (bindingMatch) {
117
+ databases.push({
118
+ type: "hyperdrive",
119
+ binding: bindingMatch[1],
120
+ id: idMatch?.[1],
121
+ });
122
+ }
123
+ }
124
+ return {
125
+ databases,
126
+ hasMultipleDatabases: databases.length > 1,
127
+ };
128
+ }
129
+ // Functions to extract IDs from wrangler command responses
130
+ export function extractD1DatabaseId(wranglerOutput) {
131
+ try {
132
+ // Look for TOML format: database_id = "uuid"
133
+ const tomlRegex = /database_id\s*=\s*"([^"]+)"/;
134
+ const tomlMatch = tomlRegex.exec(wranglerOutput);
135
+ if (tomlMatch) {
136
+ return tomlMatch[1];
137
+ }
138
+ // Look for JSON response with database_id
139
+ const jsonRegex = /\{[\s\S]*"database_id":\s*"([^"]+)"[\s\S]*\}/;
140
+ const jsonMatch = jsonRegex.exec(wranglerOutput);
141
+ if (jsonMatch) {
142
+ return jsonMatch[1];
143
+ }
144
+ // Parse table format from `wrangler d1 info` command
145
+ // The ID appears in the first row of the table without a label
146
+ const lines = wranglerOutput.split("\n");
147
+ for (const line of lines) {
148
+ // Look for a line that contains a UUID (36 characters with hyphens)
149
+ const uuidRegex = /│\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*│/i;
150
+ const uuidMatch = uuidRegex.exec(line);
151
+ if (uuidMatch) {
152
+ return uuidMatch[1];
153
+ }
154
+ }
155
+ return null;
156
+ }
157
+ catch {
158
+ return null;
159
+ }
160
+ }
161
+ export function extractKvNamespaceId(wranglerOutput) {
162
+ try {
163
+ // Look for TOML format: id = "uuid"
164
+ const tomlRegex = /id\s*=\s*"([^"]+)"/;
165
+ const tomlMatch = tomlRegex.exec(wranglerOutput);
166
+ if (tomlMatch) {
167
+ return tomlMatch[1];
168
+ }
169
+ // Fallback: Look for JSON response with id field in KV context
170
+ const jsonRegex = /"id":\s*"([a-f0-9]+)"/;
171
+ const jsonMatch = jsonRegex.exec(wranglerOutput);
172
+ if (jsonMatch) {
173
+ return jsonMatch[1];
174
+ }
175
+ return null;
176
+ }
177
+ catch {
178
+ return null;
179
+ }
180
+ }
181
+ export function extractHyperdriveId(wranglerOutput) {
182
+ try {
183
+ // Look for TOML format: id = "uuid"
184
+ const tomlRegex = /id\s*=\s*"([^"]+)"/;
185
+ const tomlMatch = tomlRegex.exec(wranglerOutput);
186
+ if (tomlMatch) {
187
+ return tomlMatch[1];
188
+ }
189
+ // Fallback: Look for Hyperdrive ID in text format: "id: uuid"
190
+ const textRegex = /id:\s*([a-f0-9-]+)/i;
191
+ const textMatch = textRegex.exec(wranglerOutput);
192
+ if (textMatch) {
193
+ return textMatch[1];
194
+ }
195
+ // Fallback: Look for JSON response with id field
196
+ const jsonRegex = /\{[\s\S]*"id":\s*"([^"]+)"[\s\S]*\}/;
197
+ const jsonMatch = jsonRegex.exec(wranglerOutput);
198
+ if (jsonMatch) {
199
+ return jsonMatch[1];
200
+ }
201
+ return null;
202
+ }
203
+ catch {
204
+ return null;
205
+ }
206
+ }
207
+ // Functions to update TOML with extracted IDs
208
+ export function updateD1BlockWithId(toml, binding, dbName, databaseId) {
209
+ const found = extractFirstBlock(toml, "d1_databases");
210
+ if (!found)
211
+ return toml;
212
+ let block = found.block;
213
+ // Update binding
214
+ if (/binding\s*=\s*"[^"]+"/.test(block)) {
215
+ block = block.replace(/binding\s*=\s*"[^"]+"/, `binding = "${binding}"`);
216
+ }
217
+ else {
218
+ block = block.replace(/\[\[d1_databases\]\]/, `[[d1_databases]]\nbinding = "${binding}"`);
219
+ }
220
+ // Update database_name
221
+ if (/database_name\s*=\s*"[^"]+"/.test(block)) {
222
+ block = block.replace(/database_name\s*=\s*"[^"]+"/, `database_name = "${dbName}"`);
223
+ }
224
+ // Update database_id
225
+ if (/database_id\s*=\s*"[^"]+"/.test(block)) {
226
+ block = block.replace(/database_id\s*=\s*"[^"]+"/, `database_id = "${databaseId}"`);
227
+ }
228
+ else {
229
+ // Add database_id after database_name
230
+ block = block.replace(/database_name\s*=\s*"[^"]+"/, `database_name = "${dbName}"\ndatabase_id = "${databaseId}"`);
231
+ }
232
+ return toml.slice(0, found.start) + block + toml.slice(found.end);
233
+ }
234
+ export function updateKvBlockWithId(toml, binding, namespaceId) {
235
+ // Use the existing appendOrReplaceKvNamespaceBlock but ensure it updates the ID
236
+ return appendOrReplaceKvNamespaceBlock(toml, binding, namespaceId);
237
+ }
238
+ export function updateHyperdriveBlockWithId(toml, binding, hyperdriveId, connectionString) {
239
+ const found = extractFirstBlock(toml, "hyperdrive");
240
+ if (!found)
241
+ return toml;
242
+ let block = found.block;
243
+ // Update id field
244
+ if (/id\s*=\s*"[^"]+"/.test(block)) {
245
+ block = block.replace(/id\s*=\s*"[^"]+"/, `id = "${hyperdriveId}"`);
246
+ }
247
+ else {
248
+ // Add id after binding
249
+ block = block.replace(/binding\s*=\s*"[^"]+"/, `binding = "${binding}"\nid = "${hyperdriveId}"`);
250
+ }
251
+ // Update localConnectionString if provided
252
+ if (connectionString) {
253
+ if (/localConnectionString\s*=\s*"[^"]+"/.test(block)) {
254
+ block = block.replace(/localConnectionString\s*=\s*"[^"]+"/, `localConnectionString = "${connectionString}"`);
255
+ }
256
+ else {
257
+ // Add localConnectionString after id
258
+ block = block.replace(/id\s*=\s*"[^"]+"/, `id = "${hyperdriveId}"\nlocalConnectionString = "${connectionString}"`);
259
+ }
260
+ }
261
+ return toml.slice(0, found.start) + block + toml.slice(found.end);
262
+ }
263
+ export function initializeGitRepository(projectPath) {
264
+ const { spawnSync } = require("child_process");
265
+ // Check if git is available
266
+ const gitCheck = spawnSync("git", ["--version"], { stdio: "pipe", encoding: "utf8" });
267
+ if (gitCheck.status !== 0) {
268
+ return { success: false, error: "Git is not installed or not available in PATH" };
269
+ }
270
+ // Initialize git repository
271
+ const initResult = spawnSync("git", ["init"], {
272
+ cwd: projectPath,
273
+ stdio: "pipe",
274
+ encoding: "utf8",
275
+ });
276
+ if (initResult.status !== 0) {
277
+ return { success: false, error: `Failed to initialize git repository: ${initResult.stderr}` };
278
+ }
279
+ // Add all files to staging
280
+ const addResult = spawnSync("git", ["add", "."], {
281
+ cwd: projectPath,
282
+ stdio: "pipe",
283
+ encoding: "utf8",
284
+ });
285
+ if (addResult.status !== 0) {
286
+ return { success: false, error: `Failed to add files to git: ${addResult.stderr}` };
287
+ }
288
+ // Create initial commit
289
+ const commitResult = spawnSync("git", ["commit", "-m", "Initial commit"], {
290
+ cwd: projectPath,
291
+ stdio: "pipe",
292
+ encoding: "utf8",
293
+ });
294
+ if (commitResult.status !== 0) {
295
+ return { success: false, error: `Failed to create initial commit: ${commitResult.stderr}` };
296
+ }
297
+ return { success: true };
298
+ }
299
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC5C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,6BAA6B,CAAC;IAC5E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,oCAAoC,CAAC;IAC5E,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB,EAAE,OAAyC;IAClF,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAwB,CAAC;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAe,CAAC;IACtE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,MAAc;IAC1D,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,UAAU,MAAM,kCAAkC,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AAC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AAE,EAAE,CAAC;IAChG,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC"}
@@ -29,6 +29,8 @@ Everything you need around the compiled API for a complete Supabase alternative
29
29
  | **Storage** | KV (sessions, cache) and R2 (files) | Cloudflare KV + R2 |
30
30
  | **Realtime** | WebSocket for live updates | Durable Objects |
31
31
  | **Queues** | Background jobs, webhook delivery | Cloudflare Queues |
32
+ | **Schedules** | Cron jobs via `defineSchedule` | Cron Triggers |
33
+ | **Email** | Inbound handlers via `defineEmail` | Email Workers |
32
34
  | **Vector & AI** | Embeddings, semantic search | Workers AI |
33
35
  | **Webhooks** | Signed inbound, retried outbound | Hono + Queues |
34
36
  | **CMS** | Schema-driven admin UI | Embedded SPA |
@@ -402,6 +404,7 @@ The path layout mirrors the public docs site (https://docs.quickback.dev). Open
402
404
  - `api-contract` — the HTTP contract layer: RFC 9457 Problem Details, keyset cursors, `Idempotency-Key`, `?include=`/sparse fields, the contract `v1`→`v2` matrix
403
405
  - `push` — Web Push (VAPID + aes128gcm), queue fan-out, identity-tag targeting, hardened subscriptions schema
404
406
  - `schedules` — `defineSchedule` cron jobs
407
+ - `email` — `defineEmail` inbound Email Worker handlers
405
408
 
406
409
  **Bundled UIs** (`docs/ui/<topic>.md`)
407
410
  - `admin` — schema-driven admin UI, dashboard, record layouts, table views, schema registry
@@ -98,6 +98,7 @@ Missing or invalid authentication tokens.
98
98
  | `AUTH_EXPIRED` | Token has expired |
99
99
  | `AUTH_RATE_LIMITED` | Too many auth attempts |
100
100
  | `AUTH_SESSION_REQUIRED` | The endpoint requires session (cookie) authentication — returned by `POST /api/v1/token` when called with a JWT, API key, or OAuth bearer, so a stolen or revoked token can't mint its own replacement |
101
+ | `AUTH_REVOCATION_UNAVAILABLE` | **503, retryable.** Only with [`revocationCheck: 'kv'`](/configure/auth#revocationcheck-none--kv--token-revocation-strategy): the bearer's signature verified, but its revocation state could not be read (KV binding missing or unreachable), so it was not trusted. Retry, or authenticate with a session cookie |
101
102
 
102
103
  ### Firewall (403)
103
104
 
@@ -31,6 +31,27 @@ GET /api/v1/jobs?title.like=Engineer
31
31
  GET /api/v1/jobs?department.in=Engineering,Design,Product
32
32
  ```
33
33
 
34
+ ### Unknown filters are rejected, not ignored
35
+
36
+ A filter the handler cannot apply returns `400` (`VALIDATION_INVALID_INPUT`).
37
+ It is never dropped:
38
+
39
+ | Request | Result |
40
+ |---------|--------|
41
+ | `?guestId=g_1` where `guestId` isn't a column | `400` — `Unknown filter field "guestId"` |
42
+ | `?status=open` on a view whose `query.filterable` omits `status` | `400` — `Field "status" is not filterable on this view` |
43
+ | `?title.matches=x` (no such operator) | `400` — `Unknown filter operator "matches"` |
44
+ | `?ssn=123` where `ssn` is masked for your role | `400` — see [Masking](/define/masking) |
45
+
46
+ Silently dropping a predicate would return **every row the firewall allows**
47
+ while still reading as a scoped list — a typo'd or join-table field turns a
48
+ narrow query into a full dump. The same rule closes `?search=` and `?sort=`.
49
+
50
+ > Filtering on a relationship that lives in a join table is not a column filter.
51
+ > `GET /travel-bookings?guestId=...` cannot work when membership is
52
+ > `travel_booking_guests` — expose a view or an `include` for it instead.
53
+
54
+
34
55
  ## Pagination
35
56
 
36
57
  | Parameter | Default | Description |
@@ -110,6 +131,11 @@ GET /api/v1/jobs?sort=title&order=asc
110
131
 
111
132
  When the multi-sort format is detected (comma or `-` prefix), the `order` parameter is ignored.
112
133
 
134
+ A client-supplied `?sort=` naming an unknown column — or one outside a view's
135
+ `query.sortable` — returns `400`, for the same reason unknown filters do: rows
136
+ would come back in some other order that reads as the requested one. A view's
137
+ own `defaultSort` fallback is config, not caller input, and is never rejected.
138
+
113
139
  ## Field Selection
114
140
 
115
141
  Select which columns to return using `?fields=`. Available on LIST and GET routes (not Views — they define their own field set).
@@ -8,6 +8,91 @@ The current release series. Older entries are archived by version range:
8
8
  - [v0.20 – v0.29](/changelog/v0.2x)
9
9
  - [v0.18 and earlier](/changelog/v0.1x)
10
10
 
11
+ ## Unreleased
12
+
13
+ ### `defineEmail` — inbound mail, provider-agnostic execute
14
+
15
+ Declare an inbound handler in `services/email/*.ts`. The compiler emits a shared `deliverInboundEmail()` dispatcher plus a Cloudflare Worker `email()` adapter. **Execute sees a portable `InboundEmailMessage`** (`from`, `to`, `headers`, `raw: ArrayBuffer`) — the same body runs for Cloudflare Email Routing and Amazon SES (Receipt → S3 → SNS calling `deliverInboundEmail`). Optional `to` matches the envelope recipient. Unmatched messages log a warning and are **not** rejected. Audit actor is `system:email-<name>`. See [Email](/platform/email).
16
+
17
+ ## v0.61.0 — August 12, 2026
18
+
19
+ ### Security: JWT revocation now fails closed when KV is unreachable
20
+
21
+ **Affects projects using `auth.jwt.revocationCheck: 'kv'`** — including every
22
+ project with a `.sealed()` column, which force-enables it.
23
+
24
+ Setting `revocationCheck: 'kv'` asks the verifier to consult current security
25
+ state before trusting a signed bearer. It did the opposite under failure: a
26
+ missing `KV` binding, a failed read, or a corrupt entry all returned "not
27
+ revoked," so a token was accepted during exactly the outage that hid its
28
+ revocation. A banned user's bearer kept working for the rest of its TTL, and
29
+ the one signal that would have caught it was the thing that had broken.
30
+
31
+ The check now returns `active` / `revoked` / `unavailable`, and only `active`
32
+ authenticates the bearer. A corrupt stamp is `unavailable` too — it used to
33
+ parse as `NaN` and compare as "not revoked."
34
+
35
+ **What changes operationally.** A bearer whose revocation state can't be read
36
+ gets a retryable `503 AUTH_REVOCATION_UNAVAILABLE` ([RFC 9457](/api/errors))
37
+ instead of being let through. Recovery is a separate cookie-only request: a
38
+ request carrying `Authorization` has its cookie stripped before session auth,
39
+ so during a KV outage every JWT-bearer request gets the 503 until the client
40
+ retries on its session cookie. One reason-only log line per occurrence carries
41
+ the cause (`missing-binding` / `read-error`) with no token, claim, or KV key in
42
+ it — **alert on it.**
43
+
44
+ This ties bearer-token availability to KV. That is the trade the opt-in now
45
+ makes honestly, and it is the right way round: a revocation check that gives
46
+ up under load is worth nothing. If you want the TTL bound *without* the
47
+ coupling, leave `revocationCheck` at `'none'` and set `expiresIn: 30`.
48
+
49
+ Because the binding is now load-bearing, a project with named `environments`
50
+ must declare `bindings.kv` on **every** target — a compile error naming the
51
+ environment, rather than a 503 discovered after deploy.
52
+
53
+ `revocationCheck: 'none'` output is byte-identical. See
54
+ [`revocationCheck`](/configure/auth#revocationcheck-none--kv--token-revocation-strategy).
55
+
56
+ ### Security: revocation was off by one second
57
+
58
+ **Also affects projects using `auth.jwt.revocationCheck: 'kv'`.**
59
+
60
+ Revocation markers and token mint timestamps were both whole seconds, and the
61
+ check rejected only a token stamped *strictly before* the marker. A token
62
+ minted earlier in the same second as the revocation therefore compared **equal**
63
+ and survived — a sub-second hole in a mechanism whose whole promise is
64
+ "revoked within seconds." Whether an attacker landed in it was a coin flip on
65
+ clock alignment, not on anything defensible.
66
+
67
+ Markers are now epoch milliseconds, tokens carry millisecond companions
68
+ (`iatMs`, and `sctMs` for the relationship-scope proof), and the comparison
69
+ denies a tie. A token minted milliseconds before the revocation is rejected; one
70
+ legitimately re-minted *after* it in that same second is still accepted, which
71
+ is why simply flipping `<` to `<=` on seconds was not the fix.
72
+
73
+ `iat` and `sct` remain standards-compatible unix **seconds** for external
74
+ tooling — the millisecond claims are internal ordering metadata, set by the
75
+ signer from the same clock sample and never accepted from a caller.
76
+
77
+ **Rollout is conservative, not clever.** Marker format is read from an explicit
78
+ version marker, never guessed from magnitude. Where one side is from v0.60.4 or
79
+ earlier — an old token against a new marker, or any token against an old marker
80
+ — there is no sub-second information to compare, so the **entire marker second**
81
+ is revoked. That over-revocation is bounded (old tokens expire within their TTL,
82
+ old markers within the entry lifetime), and it costs the caller a `401` and a
83
+ re-authentication, exactly as any other rejected token does. No action is needed
84
+ upgrading forward.
85
+
86
+ **Do not straddle this release, though.** A worker from before v0.61.0 reads a
87
+ millisecond marker as `NaN` and concludes *not revoked* — it does not recognise
88
+ it as corrupt, so the fail-closed path added above never fires. Rolling back
89
+ across this release, or running two differently-versioned deploy targets against
90
+ one shared KV namespace, means every revocation written by the new version is
91
+ **silently unenforced** by the old one until the entry expires (~19 minutes at
92
+ default settings). Upgrade targets that share a namespace together. If you must
93
+ roll back, treat outstanding bearers as unrevoked for that window: lower
94
+ `expiresIn`, or purge the `qbrev:` keys and re-stamp from the old version.
95
+
11
96
  ## v0.60.4 — August 4, 2026
12
97
 
13
98
  ### Fix: retired-path cleanup was inert in v0.60.1–v0.60.3
@@ -45,7 +45,7 @@ The short version, before the knob-by-knob detail:
45
45
  - **Default: 180-second TTL, auto-refreshed.** Every authenticated call returns a fresh token via the `set-auth-token` header, so the low TTL is invisible to logged-in users. The worst-case window for a stolen or pre-revocation token is 3 minutes — and you can shrink it to 30 seconds with one config line.
46
46
  - **Need revocation faster than the TTL?** Set [`revocationCheck: 'kv'`](#revocationcheck-none--kv--token-revocation-strategy). Revoked tokens are rejected within seconds; revocation stamps are written automatically on user ban, org-member removal, role change, and changes to scope-conferring relationship rows.
47
47
 
48
- Those two knobs — `expiresIn` and `revocationCheck` — cover the vast majority of deployments. The honest residual for the strictest threat models: the KV check revokes per-principal (not per-session), fails open if KV is unreachable (degrading to the TTL bound), and propagates cross-PoP in ~60s. If you need fail-closed, per-session kill semantics, set `expiresIn: 30` for a hard 30-second ceiling — and [tell us about your use case](https://github.com/kardoe/quickback/issues); an opaque-session mode is under consideration.
48
+ Those two knobs — `expiresIn` and `revocationCheck` — cover the vast majority of deployments. The honest residual for the strictest threat models: the KV check revokes per-principal (not per-session) and propagates cross-PoP in ~60s. It **fails closed** — if KV can't be read, the bearer isn't trusted and a bearer-only caller gets a retryable `503`, so enabling it ties bearer availability to KV. If you need per-session kill semantics, set `expiresIn: 30` for a hard 30-second ceiling — and [tell us about your use case](https://github.com/kardoe/quickback/issues); an opaque-session mode is under consideration.
49
49
 
50
50
  ### Behavior recap
51
51
 
@@ -105,11 +105,11 @@ Default `'none'`.
105
105
  | Value | Behavior | Cost per verify |
106
106
  |---|---|---|
107
107
  | `'none'` | No revocation check. Stolen / pre-revocation tokens valid until TTL expires (scope claims: until the carry-forward cap). Use a low `expiresIn` to bound the replay window. | 0 |
108
- | `'kv'` | Fast-path checks per-principal revocation timestamps in the project's existing `KV` binding before trusting a verified token. | 2+ KV reads (~5-15ms, edge-cached) |
108
+ | `'kv'` | Fast-path checks per-principal revocation timestamps in the project's existing `KV` binding before trusting a verified token. Fails closed: an unreadable store means the bearer is not trusted. | 2+ KV reads (~5-15ms, edge-cached) |
109
109
 
110
110
  `'kv'` (v0.45+, **Cloudflare runtime only**) keeps the fast-path stateless against the auth DB (still 0 D1 queries). There is nothing extra to provision — entries ride the `KV` binding every project already has, prefixed `qbrev:` and self-expiring after the maximum token lifetime, so the store never accumulates.
111
111
 
112
- A token is rejected when its mint timestamp (`iat`, or `sct` for the relationship-scope claim) predates the stored timestamp for any principal key it rides on:
112
+ A token is rejected when its mint timestamp (`iat`/`iatMs`, or `sct`/`sctMs` for the relationship-scope claim) is **at or before** the stored timestamp for any principal key it rides on:
113
113
 
114
114
  | Key | Revokes | Written automatically on |
115
115
  |---|---|---|
@@ -122,8 +122,12 @@ A token is rejected when its mint timestamp (`iat`, or `sct` for the relationshi
122
122
  Semantics worth knowing:
123
123
 
124
124
  - **Revoke-on-touch for scopes:** any update or delete of a conferring row stamps the revocation, without evaluating whether the change actually ended the relationship. A false positive just forces a cheap re-prove (`/scope/v1/enter` or a minting namespace route).
125
- - **Fails open:** a missing binding or KV outage skips the check (logged) — revocation degrades to the TTL / carry-forward-cap bound rather than locking every bearer out.
125
+ - **No same-second gap:** markers are stored in epoch milliseconds (written `m<ms>` — an explicit format version, not a magnitude the reader guesses at) and tokens carry millisecond companions (`iatMs` / `sctMs`) alongside the standards-compatible seconds claims, so a token minted a few milliseconds before the revocation is rejected — while one legitimately re-minted *after* it in that same second is still accepted. Tokens and markers written by v0.60.4 or earlier are handled **conservatively**: with no sub-second information on one side, the whole marker second is revoked. That over-revocation is bounded — the last old token expires within its TTL, and the last old marker within the entry lifetime. Like any rejected token it costs the caller a `401`, not a silent recovery: the bearer falls through unauthenticated (its cookie having been stripped, per the next bullet), and the client re-authenticates for a fresh token.
126
+ - **Do not straddle the v0.61.0 upgrade.** A worker from **before** v0.61.0 reads `m<ms>` markers as `NaN` and treats them as *no revocation at all* — not as a corrupt entry. So rolling back across this release, or pointing two differently-versioned deploy targets at one shared KV namespace, means every revocation written by the new version is **silently unenforced** by the old one until the entry expires (`ENTRY_TTL_SECONDS`, ~19 minutes at default settings). Upgrade all targets sharing a namespace together; if you must roll back, treat outstanding bearer tokens as unrevoked for that window — lower `expiresIn`, or purge the `qbrev:` keys and re-stamp from the old version.
127
+ - **Fails closed:** a missing binding, a failed read, or a corrupt entry means the token's revocation state is *unknown* — and an unknown bearer is not authenticated. The caller gets `503 AUTH_REVOCATION_UNAVAILABLE` (RFC 9457, retryable). Recovery is a **separate cookie-only request**: a request carrying `Authorization` has its cookie stripped before session auth, so within that one request there is nothing left to fall back to. Reads are never silently skipped, because the outage that hides a revocation is exactly the moment this check exists for.
128
+ - **Availability coupling:** the flip side of the above. Bearer-token auth now depends on KV being readable. Alert on `AUTH_REVOCATION_UNAVAILABLE`; a sustained rate means the binding is missing on some deployment target, or KV is degraded. Every named environment must declare `bindings.kv` — the compiler rejects a target that doesn't.
126
129
  - **Eventual consistency:** KV propagates cross-PoP in ~60s. "Immediate" means seconds at the writing location, bounded-seconds globally — still far inside the 15-minute carry-forward cap that bounds revocation without this check.
130
+ - **Writes stay best-effort:** the *stamps* are written after the authorization change has already committed (the ban row, the removed membership, the deleted conferring row). A failed stamp does not fail that write — the DB state is the durable cut. It is only the *read* side that fails closed.
127
131
  - **Coverage gap:** batch *hard* deletes don't return rows through the chokepoint; call `revokeScopeTokens` explicitly if you bulk-hard-delete conferring rows.
128
132
 
129
133
  ## Defaults when the JWT surface is enabled
@@ -145,34 +149,35 @@ missing field falls back to its hardcoded value:
145
149
  - **B2C SaaS, mostly browser traffic:** keep defaults. The 180s TTL + auto-refresh model just works.
146
150
  - **Pentest engagement / enterprise compliance:** set `expiresIn: 30`. Tokens stay invisible to logged-in users (auto-refreshed every authed call) but stolen-token windows shrink to 30s.
147
151
  - **CLI-heavy / long-running CI tokens:** `expiresIn: 3600` for one-hour bearer tokens. Pair with `issuer` / `audience` if multiple services consume the same JWT.
148
- - **Need immediate revocation:** set `revocationCheck: 'kv'` (Cloudflare runtime) — revoked tokens are rejected within seconds, and stamps are written automatically on user ban, member removal, role change, and scope-conferring row changes (see the [scope revocation notes](/define/scopes#revocation--ttl)). Or drop TTL to ~30s — similar effect with bounded delay and zero KV reads.
152
+ - **Need immediate revocation:** set `revocationCheck: 'kv'` (Cloudflare runtime) — revoked tokens are rejected within seconds, and stamps are written automatically on user ban, member removal, role change, and scope-conferring row changes (see the [scope revocation notes](/define/scopes#revocation--ttl)). It fails closed, so bearer auth then depends on KV being readable — declare `bindings.kv` on every environment and alert on `AUTH_REVOCATION_UNAVAILABLE`. Or drop TTL to ~30s — similar effect with bounded delay, zero KV reads, and no availability coupling.
149
153
 
150
- ## `auth.loginUrl` / `auth.profileUrl` — external sign-in for consumer Workers
154
+ ## `auth.loginUrl` — external sign-in for consumer Workers
151
155
 
152
- When a Quickback Worker doesn't host its own Account SPA — e.g. an internal-app mesh where one Worker on the parent domain owns identity (`auth.example.com`) and other Workers share cookies — the compiler-emitted CMS access gates need to redirect unauthenticated visitors to the central sign-in surface, not the local `/account/login` (which doesn't exist there).
156
+ When a Quickback Worker doesn't host its own Account SPA — e.g. an internal-app mesh where one Worker on the parent domain owns identity (`auth.example.com`) and other Workers share cookies — the compiler-emitted CMS access gate needs to redirect unauthenticated visitors to the central sign-in surface, not the local `/account/login` (which doesn't exist there).
153
157
 
154
158
  ```ts title="quickback.config.ts"
155
159
  export default defineConfig({
156
160
  // ...
157
161
  auth: {
158
162
  loginUrl: 'https://auth.example.com/login',
159
- profileUrl: 'https://auth.example.com/profile',
160
163
  },
161
164
  });
162
165
  ```
163
166
 
164
- Both fields override compiler-emitted browser redirects in the CMS shell:
165
-
166
167
  - **Unauthenticated visitor hits a CMS route** → `302 → <loginUrl>?redirect=<original-url>`
167
- - **Authenticated user fails the `cms.access: 'admin'` platform-role check** → `302 → <profileUrl>`
168
168
 
169
169
  The `?redirect=…` query param is preserved unchanged so the central sign-in surface can bounce the user back after authentication.
170
170
 
171
+ Signing in is the *only* thing the CMS gate redirects for. A signed-in caller who isn't admitted is served the CMS shell and shown a screen naming what they'd need — see [CMS access](/ui/admin#access-gate). There is no wrong-role redirect, and no `auth.profileUrl`.
172
+
173
+ > **Removed in v0.62:** `auth.profileUrl`. Its only consumer was the CMS wrong-role redirect. The config schema is strict, so a leftover `profileUrl` key now fails the compile — delete it.
174
+
175
+
171
176
  ### Resolution precedence
172
177
 
173
178
  Most-specific wins:
174
179
 
175
- 1. Explicit `auth.loginUrl` / `auth.profileUrl` — the cookie-trusting consumer-Worker case (this section).
180
+ 1. Explicit `auth.loginUrl` — the cookie-trusting consumer-Worker case (this section).
176
181
  2. `https://<account.domain>/login` — inferred when this project hosts its own Account SPA on a custom domain.
177
182
  3. `/account/login` — built-in fallback, when neither knob is set.
178
183
 
@@ -88,7 +88,7 @@ The unified domain is useful for development and debugging. You can override it
88
88
  export default {
89
89
  name: "my-app",
90
90
  template: "hono",
91
- cms: { domain: "cms.example.com", access: "admin" },
91
+ cms: { domain: "cms.example.com", access: "sysadmin" },
92
92
  account: {
93
93
  domain: "auth.example.com",
94
94
  adminDomain: "admin.example.com",
@@ -96,7 +96,7 @@ Every optional top-level key the config accepts is listed below. You never have
96
96
  | `domain` | `string` | Primary custom domain (auto-inferred from `cms`/`account`/`api` domains if unset) — see [Domains](/configure/domains) |
97
97
  | `contract` | `{ version?: "v1" \| "v2" }` | Public API/auth contract version. Omit for the backward-compatible v1 default; select v2 for `/api/v2/*` and `/auth/v2/*` across generated routes, Better Auth, OpenAPI, MCP, and discovery. |
98
98
  | `api` | `object` | Dedicated hostname for the selected feature API contract (`/api/v1/*` or `/api/v2/*`); additive alias — see [Domains](/configure/domains) |
99
- | `auth` | `object` | App-level auth settings (`roleHierarchy`, `jwt`, delegated `principals`, `loginUrl`/`profileUrl`, `domain`) — see [Access](/define/access#role-hierarchy) and [Delegated principals](#delegated-principals-contract-v2) |
99
+ | `auth` | `object` | App-level auth settings (`roleHierarchy`, `jwt`, delegated `principals`, `loginUrl`, `domain`) — see [Access](/define/access#role-hierarchy) and [Delegated principals](#delegated-principals-contract-v2) |
100
100
  | `authz` | `object` | Relationship-based authorization (`relationships`, `roles`, `rules`, `tenants`, `permissions`, `arrows`) — see [Access](/define/authz-roles#centrally-defined-access-rules) and [Permissions](/define/permissions). `rules` = named gates (who + `record:` + firewall lanes under one name); `tenants` = named tenant anchors (`{ column, equals }`, referenced as `{ tenant: '<name>' }` in firewalls and `tenant: '<name>'` in auth-view includes). Root `authz` is the GLOBAL vocabulary level — names scoped to one concept belong in that concept's [feature area](/define/areas) (`_area.ts`), and root bodies may reference root-declared names only |
101
101
  | `requires` | `string[]` | Capability floor (fail-closed guard). Declare `['feature-areas']` when the project uses `features/**/_area.ts` — an area-unaware CLI/compiler then refuses the compile instead of silently dropping nested features. See [Feature areas](/define/areas#the-capability-floor-requires-feature-areas) |
102
102
  | `trustedOrigins` | `string[]` | CORS trusted origins for cross-domain auth |
@@ -574,7 +574,7 @@ cms: true,
574
574
  cms: { domain: "cms.example.com" },
575
575
 
576
576
  // With access control (only admins can access CMS)
577
- cms: { domain: "cms.example.com", access: "admin" },
577
+ cms: { domain: "cms.example.com", access: "sysadmin" },
578
578
 
579
579
  // Cross-tenant DB-admin tier — sysadmins see every tenant's data
580
580
  cms: { domain: "cms.example.com", sysadmin: true },
@@ -592,11 +592,11 @@ Quickback's default model assumes every CMS user belongs to at least one organiz
592
592
 
593
593
  `cms: { sysadmin: true }` introduces a separate role tier:
594
594
 
595
- - **Role**: `user.role === "sysadmin"` (set on the Better Auth user table). Distinct from `"appmanager"` — appmanagers keep platform control-plane access (CMS shell, Better Auth admin surfaces, support tooling), while sysadmins get true cross-tenant data access. `ADMIN` is now a rejected legacy pseudo-role; use `userRole: ["appmanager"]` for control-plane gates and `roles: ["SYSADMIN"]` for cross-tenant access.
595
+ - **Role**: `user.role === "sysadmin"` (set on the Better Auth user table). Distinct from `"appmanager"` — appmanagers keep platform control-plane access (Better Auth admin surfaces, organization and user management, support tooling — but NOT the CMS), while sysadmins get true cross-tenant data access. `ADMIN` is now a rejected legacy pseudo-role; use `userRole: ["appmanager"]` for control-plane gates and `roles: ["SYSADMIN"]` for cross-tenant access.
596
596
  - **Firewall**: every `buildFirewallConditions()` emits an `if (ctx.userRole === "sysadmin") return undefined` (or just the soft-delete predicate when present) at the top, so sysadmins see every tenant's rows. See [Firewall escape hatch](/define/firewall#sysadmin-escape-hatch).
597
597
  - **Org listing**: a `GET /auth/v1/admin/list-organizations` endpoint selects directly from the auth-schema `organization` table — every row, every tenant. Sits under Better Auth's admin URL namespace (sibling of `/auth/v1/admin/list-users`) so the URL shape matches BA convention; the handler is Quickback-emitted and gated to `user.role === "sysadmin"` only. For the membership-bound caller's-orgs listing, use BA's own `/auth/v1/organization/list`.
598
598
  - **CMS SPA**: when the user is a sysadmin, the header switcher loads from the cross-tenant endpoint, defaults to "All organizations" (which omits `?organizationId=` and reaches the firewall escape), and pins selected tenants via `?organizationId=` on every API call. Org admins keep the existing membership-based switcher.
599
- - **CMS HTML gate**: admits `userRole === "sysadmin"` alongside `"appmanager"`. Org admins are not locked out when you set `cms.access: "user"`; `cms.access: "admin"` is specifically the platform control-plane gate.
599
+ - **CMS gate**: `cms.access: "sysadmin"` (the default) admits the `sysadmin` tier only; `cms.access: "member"` also admits any caller with an organization membership. `appmanager` opens the CMS in neither mode — see [Access gate](/ui/admin#access-gate).
600
600
 
601
601
  Off by default. Projects that don't enable it get zero behavior change; setting `cms.sysadmin: true` and granting a user `user.role = "sysadmin"` is the only way to unlock the cross-tenant view.
602
602
 
@@ -697,7 +697,7 @@ dev: {
697
697
 
698
698
  ## Email Configuration
699
699
 
700
- Configure email delivery for authentication emails (verification, password reset, invitations).
700
+ Configure email delivery for authentication emails (verification, password reset, invitations). Inbound mail (Email Routing or SES → a Worker handler) is a separate surface — see [Email (Inbound)](/platform/email) (`defineEmail`). This section is outbound only.
701
701
 
702
702
  > **Cloudflare Email Sending is now in public beta** and is Quickback's default transport for Cloudflare deploys. The Workers `send_email` binding is zero-config — no API keys, no third-party accounts. AWS SES remains supported as an explicit opt-in (`email.provider: 'aws-ses'`) for non-Cloudflare runtimes or existing SES setups.
703
703
 
@@ -754,7 +754,7 @@ A complete config with CMS, Account UI, and Admin on separate subdomains:
754
754
  export default {
755
755
  name: "my-app",
756
756
  template: "hono",
757
- cms: { domain: "cms.example.com", access: "admin" },
757
+ cms: { domain: "cms.example.com", access: "sysadmin" },
758
758
  account: {
759
759
  domain: "auth.example.com",
760
760
  adminDomain: "admin.example.com",