@quickback-dev/cli 0.10.16 → 0.11.0

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 (253) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +40 -2
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/docs/content.d.ts.map +1 -1
  5. package/dist/docs/content.js +15 -10
  6. package/dist/docs/content.js.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/skill/SKILL.md +142 -1051
  10. package/dist/skill/agents/quickback-specialist/AGENT.md +36 -0
  11. package/dist/skill/docs/changelog.md +1225 -0
  12. package/dist/skill/docs/compiler/claude-code-skill.md +312 -0
  13. package/dist/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
  14. package/dist/skill/docs/compiler/cloud-compiler/cli.md +307 -0
  15. package/dist/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
  16. package/dist/skill/docs/compiler/cloud-compiler/index.md +65 -0
  17. package/dist/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
  18. package/dist/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
  19. package/dist/skill/docs/compiler/config/agents.md +144 -0
  20. package/dist/skill/docs/compiler/config/auth.md +109 -0
  21. package/dist/skill/docs/compiler/config/bindings.md +176 -0
  22. package/dist/skill/docs/compiler/config/domains.md +149 -0
  23. package/dist/skill/docs/compiler/config/index.md +419 -0
  24. package/dist/skill/docs/compiler/config/output.md +338 -0
  25. package/dist/skill/docs/compiler/config/providers.md +248 -0
  26. package/dist/skill/docs/compiler/config/security.md +255 -0
  27. package/dist/skill/docs/compiler/config/single-tenant.md +128 -0
  28. package/dist/skill/docs/compiler/config/variables.md +157 -0
  29. package/dist/skill/docs/compiler/definitions/access.md +445 -0
  30. package/dist/skill/docs/compiler/definitions/actions.md +884 -0
  31. package/dist/skill/docs/compiler/definitions/concepts.md +52 -0
  32. package/dist/skill/docs/compiler/definitions/feature.md +164 -0
  33. package/dist/skill/docs/compiler/definitions/firewall.md +285 -0
  34. package/dist/skill/docs/compiler/definitions/guards.md +241 -0
  35. package/dist/skill/docs/compiler/definitions/index.md +219 -0
  36. package/dist/skill/docs/compiler/definitions/masking.md +241 -0
  37. package/dist/skill/docs/compiler/definitions/read.md +220 -0
  38. package/dist/skill/docs/compiler/definitions/schema.md +697 -0
  39. package/dist/skill/docs/compiler/definitions/validation.md +35 -0
  40. package/dist/skill/docs/compiler/definitions/views.md +292 -0
  41. package/dist/skill/docs/compiler/getting-started/claude-code.md +126 -0
  42. package/dist/skill/docs/compiler/getting-started/full-example.md +431 -0
  43. package/dist/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
  44. package/dist/skill/docs/compiler/getting-started/index.md +192 -0
  45. package/dist/skill/docs/compiler/getting-started/patterns.md +225 -0
  46. package/dist/skill/docs/compiler/getting-started/template-blog.md +280 -0
  47. package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
  48. package/dist/skill/docs/compiler/getting-started/template-empty.md +112 -0
  49. package/dist/skill/docs/compiler/getting-started/templates.md +111 -0
  50. package/dist/skill/docs/compiler/index.md +85 -0
  51. package/dist/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
  52. package/dist/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
  53. package/dist/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
  54. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
  55. package/dist/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
  56. package/dist/skill/docs/compiler/targets/hono-api/index.md +37 -0
  57. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
  58. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
  59. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
  60. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
  61. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
  62. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
  63. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
  64. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
  65. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
  66. package/dist/skill/docs/compiler/targets/index.md +47 -0
  67. package/dist/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
  68. package/dist/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
  69. package/dist/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
  70. package/dist/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
  71. package/dist/skill/docs/compiler/troubleshooting.md +120 -0
  72. package/dist/skill/docs/index.md +77 -0
  73. package/dist/skill/docs/stack/account-ui/customization.md +378 -0
  74. package/dist/skill/docs/stack/account-ui/environment-variables.md +325 -0
  75. package/dist/skill/docs/stack/account-ui/features/admin.md +76 -0
  76. package/dist/skill/docs/stack/account-ui/features/api-keys.md +22 -0
  77. package/dist/skill/docs/stack/account-ui/features/avatars.md +37 -0
  78. package/dist/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
  79. package/dist/skill/docs/stack/account-ui/features/index.md +291 -0
  80. package/dist/skill/docs/stack/account-ui/features/organizations.md +29 -0
  81. package/dist/skill/docs/stack/account-ui/features/passkeys.md +31 -0
  82. package/dist/skill/docs/stack/account-ui/features/passwordless.md +28 -0
  83. package/dist/skill/docs/stack/account-ui/features/sessions.md +20 -0
  84. package/dist/skill/docs/stack/account-ui/hooks.md +209 -0
  85. package/dist/skill/docs/stack/account-ui/index.md +147 -0
  86. package/dist/skill/docs/stack/account-ui/library-usage.md +257 -0
  87. package/dist/skill/docs/stack/account-ui/standalone.md +149 -0
  88. package/dist/skill/docs/stack/account-ui/with-quickback.md +160 -0
  89. package/dist/skill/docs/stack/account-ui/worker.md +362 -0
  90. package/dist/skill/docs/stack/auth/api-keys.md +15 -0
  91. package/dist/skill/docs/stack/auth/device-auth.md +14 -0
  92. package/dist/skill/docs/stack/auth/index.md +64 -0
  93. package/dist/skill/docs/stack/auth/jwt-optimization.md +245 -0
  94. package/dist/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
  95. package/dist/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
  96. package/dist/skill/docs/stack/auth/plugins/index.md +340 -0
  97. package/dist/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
  98. package/dist/skill/docs/stack/auth/security.md +455 -0
  99. package/dist/skill/docs/stack/auth/using-auth.md +39 -0
  100. package/dist/skill/docs/stack/cms/actions.md +199 -0
  101. package/dist/skill/docs/stack/cms/components.md +479 -0
  102. package/dist/skill/docs/stack/cms/connecting.md +199 -0
  103. package/dist/skill/docs/stack/cms/dashboard.md +39 -0
  104. package/dist/skill/docs/stack/cms/index.md +158 -0
  105. package/dist/skill/docs/stack/cms/inline-editing.md +136 -0
  106. package/dist/skill/docs/stack/cms/pages.md +275 -0
  107. package/dist/skill/docs/stack/cms/record-layouts.md +151 -0
  108. package/dist/skill/docs/stack/cms/schema-format.md +437 -0
  109. package/dist/skill/docs/stack/cms/schema-registry.md +200 -0
  110. package/dist/skill/docs/stack/cms/security.md +203 -0
  111. package/dist/skill/docs/stack/cms/table-views.md +142 -0
  112. package/dist/skill/docs/stack/index.md +65 -0
  113. package/dist/skill/docs/stack/queues/handlers.md +317 -0
  114. package/dist/skill/docs/stack/queues/index.md +56 -0
  115. package/dist/skill/docs/stack/queues/using-queues.md +192 -0
  116. package/dist/skill/docs/stack/realtime/durable-objects.md +488 -0
  117. package/dist/skill/docs/stack/realtime/index.md +73 -0
  118. package/dist/skill/docs/stack/realtime/partyserver-rooms.md +146 -0
  119. package/dist/skill/docs/stack/realtime/using-realtime.md +211 -0
  120. package/dist/skill/docs/stack/storage/index.md +17 -0
  121. package/dist/skill/docs/stack/storage/kv.md +204 -0
  122. package/dist/skill/docs/stack/storage/r2.md +232 -0
  123. package/dist/skill/docs/stack/storage/using-kv.md +70 -0
  124. package/dist/skill/docs/stack/storage/using-r2.md +55 -0
  125. package/dist/skill/docs/stack/vector/embeddings.md +554 -0
  126. package/dist/skill/docs/stack/vector/index.md +44 -0
  127. package/dist/skill/docs/stack/vector/using-embeddings.md +186 -0
  128. package/dist/skill/docs/stack/webhooks/inbound.md +186 -0
  129. package/dist/skill/docs/stack/webhooks/index.md +36 -0
  130. package/dist/skill/docs/stack/webhooks/outbound.md +281 -0
  131. package/package.json +1 -1
  132. package/src/skill/SKILL.md +142 -1051
  133. package/src/skill/agents/quickback-specialist/AGENT.md +36 -0
  134. package/src/skill/docs/changelog.md +1225 -0
  135. package/src/skill/docs/compiler/claude-code-skill.md +312 -0
  136. package/src/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
  137. package/src/skill/docs/compiler/cloud-compiler/cli.md +307 -0
  138. package/src/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
  139. package/src/skill/docs/compiler/cloud-compiler/index.md +65 -0
  140. package/src/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
  141. package/src/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
  142. package/src/skill/docs/compiler/config/agents.md +144 -0
  143. package/src/skill/docs/compiler/config/auth.md +109 -0
  144. package/src/skill/docs/compiler/config/bindings.md +176 -0
  145. package/src/skill/docs/compiler/config/domains.md +149 -0
  146. package/src/skill/docs/compiler/config/index.md +419 -0
  147. package/src/skill/docs/compiler/config/output.md +338 -0
  148. package/src/skill/docs/compiler/config/providers.md +248 -0
  149. package/src/skill/docs/compiler/config/security.md +255 -0
  150. package/src/skill/docs/compiler/config/single-tenant.md +128 -0
  151. package/src/skill/docs/compiler/config/variables.md +157 -0
  152. package/src/skill/docs/compiler/definitions/access.md +445 -0
  153. package/src/skill/docs/compiler/definitions/actions.md +884 -0
  154. package/src/skill/docs/compiler/definitions/concepts.md +52 -0
  155. package/src/skill/docs/compiler/definitions/feature.md +164 -0
  156. package/src/skill/docs/compiler/definitions/firewall.md +285 -0
  157. package/src/skill/docs/compiler/definitions/guards.md +241 -0
  158. package/src/skill/docs/compiler/definitions/index.md +219 -0
  159. package/src/skill/docs/compiler/definitions/masking.md +241 -0
  160. package/src/skill/docs/compiler/definitions/read.md +220 -0
  161. package/src/skill/docs/compiler/definitions/schema.md +697 -0
  162. package/src/skill/docs/compiler/definitions/validation.md +35 -0
  163. package/src/skill/docs/compiler/definitions/views.md +292 -0
  164. package/src/skill/docs/compiler/getting-started/claude-code.md +126 -0
  165. package/src/skill/docs/compiler/getting-started/full-example.md +431 -0
  166. package/src/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
  167. package/src/skill/docs/compiler/getting-started/index.md +192 -0
  168. package/src/skill/docs/compiler/getting-started/patterns.md +225 -0
  169. package/src/skill/docs/compiler/getting-started/template-blog.md +280 -0
  170. package/src/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
  171. package/src/skill/docs/compiler/getting-started/template-empty.md +112 -0
  172. package/src/skill/docs/compiler/getting-started/templates.md +111 -0
  173. package/src/skill/docs/compiler/index.md +85 -0
  174. package/src/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
  175. package/src/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
  176. package/src/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
  177. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
  178. package/src/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
  179. package/src/skill/docs/compiler/targets/hono-api/index.md +37 -0
  180. package/src/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
  181. package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
  182. package/src/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
  183. package/src/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
  184. package/src/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
  185. package/src/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
  186. package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
  187. package/src/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
  188. package/src/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
  189. package/src/skill/docs/compiler/targets/index.md +47 -0
  190. package/src/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
  191. package/src/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
  192. package/src/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
  193. package/src/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
  194. package/src/skill/docs/compiler/troubleshooting.md +120 -0
  195. package/src/skill/docs/index.md +77 -0
  196. package/src/skill/docs/stack/account-ui/customization.md +378 -0
  197. package/src/skill/docs/stack/account-ui/environment-variables.md +325 -0
  198. package/src/skill/docs/stack/account-ui/features/admin.md +76 -0
  199. package/src/skill/docs/stack/account-ui/features/api-keys.md +22 -0
  200. package/src/skill/docs/stack/account-ui/features/avatars.md +37 -0
  201. package/src/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
  202. package/src/skill/docs/stack/account-ui/features/index.md +291 -0
  203. package/src/skill/docs/stack/account-ui/features/organizations.md +29 -0
  204. package/src/skill/docs/stack/account-ui/features/passkeys.md +31 -0
  205. package/src/skill/docs/stack/account-ui/features/passwordless.md +28 -0
  206. package/src/skill/docs/stack/account-ui/features/sessions.md +20 -0
  207. package/src/skill/docs/stack/account-ui/hooks.md +209 -0
  208. package/src/skill/docs/stack/account-ui/index.md +147 -0
  209. package/src/skill/docs/stack/account-ui/library-usage.md +257 -0
  210. package/src/skill/docs/stack/account-ui/standalone.md +149 -0
  211. package/src/skill/docs/stack/account-ui/with-quickback.md +160 -0
  212. package/src/skill/docs/stack/account-ui/worker.md +362 -0
  213. package/src/skill/docs/stack/auth/api-keys.md +15 -0
  214. package/src/skill/docs/stack/auth/device-auth.md +14 -0
  215. package/src/skill/docs/stack/auth/index.md +64 -0
  216. package/src/skill/docs/stack/auth/jwt-optimization.md +245 -0
  217. package/src/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
  218. package/src/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
  219. package/src/skill/docs/stack/auth/plugins/index.md +340 -0
  220. package/src/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
  221. package/src/skill/docs/stack/auth/security.md +455 -0
  222. package/src/skill/docs/stack/auth/using-auth.md +39 -0
  223. package/src/skill/docs/stack/cms/actions.md +199 -0
  224. package/src/skill/docs/stack/cms/components.md +479 -0
  225. package/src/skill/docs/stack/cms/connecting.md +199 -0
  226. package/src/skill/docs/stack/cms/dashboard.md +39 -0
  227. package/src/skill/docs/stack/cms/index.md +158 -0
  228. package/src/skill/docs/stack/cms/inline-editing.md +136 -0
  229. package/src/skill/docs/stack/cms/pages.md +275 -0
  230. package/src/skill/docs/stack/cms/record-layouts.md +151 -0
  231. package/src/skill/docs/stack/cms/schema-format.md +437 -0
  232. package/src/skill/docs/stack/cms/schema-registry.md +200 -0
  233. package/src/skill/docs/stack/cms/security.md +203 -0
  234. package/src/skill/docs/stack/cms/table-views.md +142 -0
  235. package/src/skill/docs/stack/index.md +65 -0
  236. package/src/skill/docs/stack/queues/handlers.md +317 -0
  237. package/src/skill/docs/stack/queues/index.md +56 -0
  238. package/src/skill/docs/stack/queues/using-queues.md +192 -0
  239. package/src/skill/docs/stack/realtime/durable-objects.md +488 -0
  240. package/src/skill/docs/stack/realtime/index.md +73 -0
  241. package/src/skill/docs/stack/realtime/partyserver-rooms.md +146 -0
  242. package/src/skill/docs/stack/realtime/using-realtime.md +211 -0
  243. package/src/skill/docs/stack/storage/index.md +17 -0
  244. package/src/skill/docs/stack/storage/kv.md +204 -0
  245. package/src/skill/docs/stack/storage/r2.md +232 -0
  246. package/src/skill/docs/stack/storage/using-kv.md +70 -0
  247. package/src/skill/docs/stack/storage/using-r2.md +55 -0
  248. package/src/skill/docs/stack/vector/embeddings.md +554 -0
  249. package/src/skill/docs/stack/vector/index.md +44 -0
  250. package/src/skill/docs/stack/vector/using-embeddings.md +186 -0
  251. package/src/skill/docs/stack/webhooks/inbound.md +186 -0
  252. package/src/skill/docs/stack/webhooks/index.md +36 -0
  253. package/src/skill/docs/stack/webhooks/outbound.md +281 -0
@@ -0,0 +1,200 @@
1
+ # Schema Registry
2
+
3
+ The schema registry is a static JSON file generated by the Quickback compiler. It contains full metadata about every table in your project — columns, types, guards, masking rules, views, actions, validation, and firewall config. The CMS reads this file to render its entire UI.
4
+
5
+ ## Generation
6
+
7
+ Schema registry generation is **enabled by default**. Run `quickback compile` and the compiler outputs `schema-registry.json` alongside your compiled API files.
8
+
9
+ To disable generation:
10
+
11
+ ```typescript title="quickback/quickback.config.ts"
12
+ export default defineConfig({
13
+ schemaRegistry: { generate: false },
14
+ // ... rest of your config
15
+ });
16
+ ```
17
+
18
+ ## Output Shape
19
+
20
+ The top-level structure of `schema-registry.json`:
21
+
22
+ ```json
23
+ {
24
+ "generatedAt": "2026-02-14T06:26:53.554Z",
25
+ "generatedBy": "quickback-compiler",
26
+ "version": "1.0.0",
27
+ "singleTenant": false,
28
+ "features": { ... },
29
+ "tables": { ... },
30
+ "tablesByFeature": { ... },
31
+ "pages": { ... },
32
+ "pagesByFeature": { ... }
33
+ }
34
+ ```
35
+
36
+ | Field | Type | Description |
37
+ |-------|------|-------------|
38
+ | `generatedAt` | `string` | ISO timestamp of generation |
39
+ | `generatedBy` | `string` | Always `"quickback-compiler"` |
40
+ | `version` | `string` | Compiler version used |
41
+ | `singleTenant` | `boolean?` | When `true`, no organization layer |
42
+ | `features` | `Record<string, string[]>` | Feature name to file list mapping |
43
+ | `tables` | `Record<string, TableMeta>` | Table name to full metadata |
44
+ | `tablesByFeature` | `Record<string, string[]>` | Feature name to table name list |
45
+ | `pages` | `Record<string, PageMeta>` | Page slug to full page metadata |
46
+ | `pagesByFeature` | `Record<string, string[]>` | Feature name to page slug list |
47
+
48
+ ## TableMeta
49
+
50
+ Each table entry contains everything the CMS needs to render its UI:
51
+
52
+ ```typescript
53
+ interface TableMeta {
54
+ name: string; // camelCase table name (e.g., "accountCode")
55
+ dbName: string; // SQL table name (e.g., "account_code")
56
+ feature: string; // Parent feature name
57
+ columns: ColumnMeta[]; // All columns including audit fields
58
+ firewall: Record<string, unknown>; // Tenant isolation config
59
+ crud: Record<string, CrudConfig>; // Per-operation access rules
60
+ guards: {
61
+ createable: string[]; // Fields allowed on create
62
+ updatable: string[]; // Fields allowed on update
63
+ immutable: string[]; // Fields locked after creation
64
+ protected: Record<string, string[]>; // Fields only updatable via actions
65
+ };
66
+ masking: Record<string, MaskingRule>; // Per-field masking rules
67
+ views: Record<string, ViewConfig>; // Named column projections
68
+ validation: Record<string, ValidationRule>; // Per-field validation
69
+ actions: ActionMeta[]; // Available actions for this table
70
+ displayColumn?: string; // Human-readable label column
71
+ internal?: boolean; // Hidden from CMS sidebar when true
72
+ }
73
+ ```
74
+
75
+ > **Internal Tables**
76
+ >
77
+ > Tables without a `defineTable()` resource config are marked `internal: true` and hidden from the CMS sidebar. These are typically join tables or system tables.
78
+
79
+
80
+ ## ColumnMeta
81
+
82
+ Each column in the `columns` array:
83
+
84
+ ```typescript
85
+ interface ColumnMeta {
86
+ name: string; // Property name (camelCase)
87
+ dbName: string; // SQL column name (snake_case)
88
+ type: "text" | "integer" | "real" | "blob"; // SQLite type
89
+ mode?: "boolean"; // When an integer represents a boolean
90
+ primaryKey: boolean;
91
+ notNull: boolean;
92
+ defaultValue?: string | number | boolean;
93
+ fkTarget?: string; // Target table name for FK columns
94
+ }
95
+ ```
96
+
97
+ The compiler automatically includes the system columns (`id`, `organizationId`), the audit fields (`createdAt`, `createdBy`, `modifiedAt`, `modifiedBy`), and the soft-delete pair (`deletedAt`, `deletedBy` — when soft delete is enabled) at the beginning of every table's column list.
98
+
99
+ ### fkTarget — FK Resolution
100
+
101
+ Columns ending in `Id` may have a `fkTarget` property indicating which table they reference. This is resolved in priority order:
102
+
103
+ 1. **Explicit `references`** — from your `defineTable()` config (highest priority)
104
+ 2. **Drizzle `.references()`** — parsed from schema source code
105
+ 3. **Convention** — strip `Id` suffix, match table name directly
106
+
107
+ ```json
108
+ {
109
+ "name": "vendorId",
110
+ "type": "text",
111
+ "fkTarget": "contact"
112
+ }
113
+ ```
114
+
115
+ The CMS uses `fkTarget` to render typeahead/lookup inputs that search the correct table instead of showing raw IDs.
116
+
117
+ ## Input Hints
118
+
119
+ Tables with `inputHints` configured in `defineTable()` include an `inputHints` map in their metadata:
120
+
121
+ ```json
122
+ {
123
+ "name": "invoice",
124
+ "inputHints": {
125
+ "status": "select",
126
+ "sortOrder": "radio",
127
+ "isPartialPaymentDisabled": "checkbox",
128
+ "headerMessage": "textarea",
129
+ "description": "richtext"
130
+ }
131
+ }
132
+ ```
133
+
134
+ The CMS reads these hints to render the appropriate form control for each field. The `"richtext"` hint renders a tiptap editor in edit mode and formatted HTML in view mode. See [Input Hints](/compiler/definitions/schema#input-hints) for the full list of supported values.
135
+
136
+ ## Display Column
137
+
138
+ The `displayColumn` field tells the CMS which column to use as a human-readable label for a record. This is used in:
139
+
140
+ - FK typeahead dropdowns (showing names instead of IDs)
141
+ - Record titles in detail views
142
+ - Breadcrumb labels
143
+
144
+ ### Auto-Detection
145
+
146
+ If you don't explicitly set `displayColumn` in your resource config, the compiler auto-detects it by scanning column names in priority order:
147
+
148
+ 1. `name`
149
+ 2. `title`
150
+ 3. `label`
151
+ 4. `headline`
152
+ 5. `subject`
153
+ 6. `code`
154
+ 7. `displayName`
155
+ 8. `fullName`
156
+ 9. `description`
157
+
158
+ The first match wins. If no candidate matches, the table has no display column and the CMS falls back to showing IDs.
159
+
160
+ ### Explicit Config
161
+
162
+ Set it explicitly in your table definition:
163
+
164
+ ```typescript
165
+ export default defineTable(contacts, {
166
+ displayColumn: "companyName",
167
+ // ...
168
+ });
169
+ ```
170
+
171
+ ## FK Label Resolution
172
+
173
+ When a table has foreign key columns (ending in `Id`), the API enriches list responses with `_label` fields. For example, a `roomTypeId` column gets a corresponding `roomType_label` field containing the display column value from the referenced table.
174
+
175
+ The CMS uses these `_label` fields to show human-readable names in table cells and FK typeahead dropdowns instead of raw UUIDs.
176
+
177
+ ```
178
+ roomTypeId: "rt_abc123" → displayed as "Master Bedroom"
179
+ accountCodeId: "ac_xyz789" → displayed as "4100 - Revenue"
180
+ ```
181
+
182
+ The FK target table is resolved from the `fkTarget` property on each column. For simple cases like `roomTypeId` → `roomType`, the compiler auto-detects it. For non-obvious mappings (e.g., `vendorId` → `contact`), use explicit [`references`](/compiler/definitions/schema#references) in your `defineTable()` config.
183
+
184
+ ## Pages
185
+
186
+ When features include `definePage()` files (in `features/{name}/pages/`), the compiler includes them in the registry under two fields:
187
+
188
+ - **`pages`** — Map of page slug to full `PageMeta` object (data sources, layout, matching rules, page actions)
189
+ - **`pagesByFeature`** — Map of feature name to array of page slugs belonging to that feature
190
+
191
+ The CMS reads these fields to render custom pages in the sidebar and route to the page renderer. See [Custom Pages](/stack/cms/pages) for the full `definePage()` API.
192
+
193
+ ## Single-Tenant Mode
194
+
195
+ When `singleTenant` is `true` in the registry (set when the project config has `features.organizations: false`), the CMS skips the organization gate and reads the user's role directly from `user.role` on the session instead of from organization membership.
196
+
197
+ ## Next Steps
198
+
199
+ - **[Connecting](/stack/cms/connecting)** — Demo mode vs. live mode setup
200
+ - **[Schema Format Reference](/stack/cms/schema-format)** — Full TypeScript types
@@ -0,0 +1,203 @@
1
+ # Security
2
+
3
+ The CMS respects all four Quickback security layers. Every UI element — buttons, form fields, table columns, action menus — adapts based on the current user's role and the security rules defined in your feature files.
4
+
5
+ ## CMS Access (admin-only by default)
6
+
7
+ The CMS is restricted to Better Auth platform admins (`user.role === "admin"`) by default — non-admin authenticated users are redirected to `/account/profile`. To allow any authenticated user, opt out explicitly:
8
+
9
+ ```typescript
10
+ cms: { access: "user" }
11
+ ```
12
+
13
+ Under the default `access: "admin"`, the compiler emits server-side gates on every CMS-facing surface so a non-admin can't reach the CMS even by bypassing the SPA:
14
+
15
+ 1. **Account UI** — the "Go to CMS" button is hidden.
16
+ 2. **CMS SPA shell** — the Worker checks `ctx.userRole === "admin"` before serving `index.html`. Unauthenticated requests are redirected to login; authenticated non-admins get `403 Admin access required`.
17
+ 3. **`/api/v1/schema`** — the CMS metadata endpoint returns `403` to non-admins.
18
+ 4. **`custom_view` CRUD** — the CMS-internal saved-views table uses `userRole: ["admin"]` (see [`userRole`](/compiler/definitions/access#userrole-vs-roles)), so saved views can't be read or modified from outside the CMS by non-admin accounts.
19
+ 5. **In-SPA gate** — if any earlier layer is bypassed, the SPA still redirects the user to `/account/profile`.
20
+
21
+ Your resource CRUD endpoints keep whatever `crud.access.roles` you defined — they're the app's data API and unaffected by the CMS gate.
22
+
23
+ ## The Four Layers
24
+
25
+ Quickback enforces security through four complementary layers:
26
+
27
+ | Layer | Purpose | CMS Behavior |
28
+ |-------|---------|-------------|
29
+ | **Firewall** | Tenant isolation (org-scoped data) | Handled server-side. CMS cannot bypass it. |
30
+ | **CRUD Access** | Per-operation role requirements | Buttons hidden when role lacks permission |
31
+ | **Guards** | Field-level create/update control | Form fields enabled/disabled per guard rules |
32
+ | **Masking** | Sensitive field redaction | Masked values with lock icons per role |
33
+
34
+ ## Role-Based Access
35
+
36
+ The CMS header includes a **role switcher** (in demo mode) or reads the user's actual role from their organization membership (in live mode). The three roles are:
37
+
38
+ - **owner** — Full access to all operations and data
39
+ - **admin** — Elevated access, typically all CRUD and most actions
40
+ - **member** — Standard access with restrictions on sensitive data and destructive actions
41
+
42
+ ### CRUD Button Visibility
43
+
44
+ CRUD operation buttons are shown or hidden based on the current role's access:
45
+
46
+ ```typescript
47
+ crud: {
48
+ create: { access: { roles: ['admin', 'owner'] } },
49
+ read: { access: { roles: ['member', 'admin', 'owner'] } },
50
+ update: { access: { roles: ['admin', 'owner'] } },
51
+ delete: { access: { roles: ['owner'] } },
52
+ }
53
+ ```
54
+
55
+ With the config above:
56
+
57
+ - **Members** see the table (read) but no Create, Edit, or Delete buttons
58
+ - **Admins** see Create and Edit buttons but no Delete
59
+ - **Owners** see all buttons
60
+
61
+ The row action menu also adapts — Edit and Delete entries only appear when the role has the corresponding permission.
62
+
63
+ ## Guards
64
+
65
+ Guards control which fields appear in create and edit forms, and which cells are editable in Data Table mode.
66
+
67
+ ### Createable Fields
68
+
69
+ Fields listed in `guards.createable` appear in the create form. Fields not in this list are hidden from the form entirely:
70
+
71
+ ```typescript
72
+ guards: {
73
+ createable: ['name', 'email', 'phone', 'status'],
74
+ }
75
+ ```
76
+
77
+ ### Updatable Fields
78
+
79
+ Fields listed in `guards.updatable` are editable in the edit form and in Data Table inline editing:
80
+
81
+ ```typescript
82
+ guards: {
83
+ updatable: ['name', 'email', 'phone'],
84
+ }
85
+ ```
86
+
87
+ ### Immutable Fields
88
+
89
+ Fields in `guards.immutable` can be set during creation but cannot be changed afterward. In edit mode, they appear as disabled inputs with a lock icon:
90
+
91
+ ```typescript
92
+ guards: {
93
+ immutable: ['accountCode', 'type'],
94
+ }
95
+ ```
96
+
97
+ ### Protected Fields
98
+
99
+ Fields in `guards.protected` can only be updated via specific actions. They appear as disabled inputs with the message "Updated via actions only":
100
+
101
+ ```typescript
102
+ guards: {
103
+ protected: {
104
+ status: ['approve', 'void'], // Updated by approve or void actions
105
+ balance: ['applyPayment'], // Updated by applyPayment action
106
+ },
107
+ }
108
+ ```
109
+
110
+ ## Masking
111
+
112
+ Masking rules redact sensitive data based on the user's role. The CMS applies masking client-side for display and the API enforces it server-side in responses.
113
+
114
+ ### Masking Types
115
+
116
+ | Type | Example Input | Masked Output |
117
+ |------|--------------|---------------|
118
+ | `email` | `john@acme.com` | `j***@acme.com` |
119
+ | `phone` | `(555) 123-4567` | `***-***-4567` |
120
+ | `ssn` | `123-45-6789` | `***-**-6789` |
121
+ | `redact` | `Confidential notes` | `------` |
122
+
123
+ ### Configuration
124
+
125
+ ```typescript
126
+ masking: {
127
+ email: { type: 'email', show: { roles: ['admin', 'owner'] } },
128
+ phone: { type: 'phone', show: { roles: ['admin', 'owner'] } },
129
+ ssn: { type: 'ssn', show: { roles: ['owner'] } },
130
+ }
131
+ ```
132
+
133
+ With the above config:
134
+
135
+ - **Members** see masked values for email, phone, and SSN
136
+ - **Admins** see unmasked email and phone, but masked SSN
137
+ - **Owners** see all values unmasked
138
+
139
+ ### Visual Indicator
140
+
141
+ Masked fields display a lock icon next to the redacted value, making it clear that the field contains hidden data:
142
+
143
+ ```
144
+ Email: [lock] j***@acme.com
145
+ SSN: [lock] ***-**-6789
146
+ ```
147
+
148
+ ## Views
149
+
150
+ Views provide column-level projections per role. Only authorized views appear in the toolbar dropdown.
151
+
152
+ ```typescript
153
+ read: {
154
+ views: {
155
+ summary: {
156
+ fields: ['id', 'name', 'status'],
157
+ access: { roles: ['member', 'admin', 'owner'] },
158
+ },
159
+ financial: {
160
+ fields: ['id', 'name', 'balance', 'creditLimit', 'paymentTerms'],
161
+ access: { roles: ['admin', 'owner'] },
162
+ },
163
+ },
164
+ }
165
+ ```
166
+
167
+ Members only see the "summary" view option. Admins and owners see both "summary" and "financial". The "All Fields" option is always available.
168
+
169
+ ## Firewall
170
+
171
+ The firewall layer handles tenant isolation — ensuring users can only access data within their organization. This is enforced entirely server-side:
172
+
173
+ - `organization_id` columns are filtered automatically by the API
174
+ - `owner` mode restricts records to the creating user
175
+ - The CMS never sees data outside the user's organization scope
176
+
177
+ The CMS does not display firewall config in its UI because there is nothing for the user to control. Tenant isolation is transparent and automatic.
178
+
179
+ ## Actions
180
+
181
+ Action visibility is controlled by access conditions on each action:
182
+
183
+ ```typescript
184
+ actions: {
185
+ approve: {
186
+ access: {
187
+ roles: ['admin', 'owner'],
188
+ record: { status: { equals: 'pending' } },
189
+ },
190
+ cms: { destructive: true, confirm: true },
191
+ },
192
+ }
193
+ ```
194
+
195
+ The CMS evaluates both the role requirement and the record condition. In this example, the "Approve" action only appears for admins and owners, and only on records where `status === "pending"`.
196
+
197
+ Destructive actions (`cms.destructive: true`, or named `void`/`delete`) receive special warning styling with red text and an alert icon. Actions with `cms.hidden: true` are hidden from the CMS entirely (API-only).
198
+
199
+ ## Next Steps
200
+
201
+ - **[Actions](/stack/cms/actions)** — Action dialogs and input forms
202
+ - **[Table Views](/stack/cms/table-views)** — View projections and toolbar
203
+ - **[Inline Editing](/stack/cms/inline-editing)** — How guards affect editability
@@ -0,0 +1,142 @@
1
+ # Table Views
2
+
3
+ The CMS provides two view modes for every table: **Table** mode for browsing and navigating records, and **Data Table** mode for spreadsheet-style inline editing. Switch between them with the toolbar toggle.
4
+
5
+ ## Table Mode
6
+
7
+ Table mode is the default browse experience:
8
+
9
+ - **Click rows** to navigate to the record detail view
10
+ - **Row action menus** (three-dot icon) with view, edit, delete, and custom actions
11
+ - **Column headers** are sortable — click to toggle ascending/descending
12
+ - **Search bar** for full-text search across all fields
13
+ - **Responsive columns** that adapt to available space
14
+
15
+ Each row shows the most relevant columns for the table. Foreign key columns display human-readable labels (resolved via `_label` fields) instead of raw UUIDs. Boolean columns render as colored Yes/No badges. Enum columns use color-coded pills.
16
+
17
+ ### Row Actions
18
+
19
+ The three-dot menu on each row provides:
20
+
21
+ | Action | Visibility | Description |
22
+ |--------|-----------|-------------|
23
+ | View details | Always | Navigate to the record detail page |
24
+ | Edit | When role has `update` access | Navigate to the edit form |
25
+ | Custom actions | Filtered by role + record state | Run actions like approve, void, post |
26
+ | Delete | When role has `delete` access | Delete with confirmation |
27
+
28
+ Actions are filtered by the current role's CRUD permissions and the action's access conditions. For example, an "approve" action that requires `status === "pending"` only appears on pending records.
29
+
30
+ ## Data Table Mode
31
+
32
+ Data Table mode provides an Excel/Google Sheets-like editing experience:
33
+
34
+ - **Cell selection** with a blue focus ring
35
+ - **Keyboard navigation** using arrow keys, Tab, Enter, and Escape
36
+ - **Type-to-edit** — start typing to enter edit mode on the selected cell
37
+ - **Row numbers** displayed in the leftmost column
38
+ - **Hint bar** at the bottom showing keyboard shortcuts
39
+
40
+ ### Editable Fields
41
+
42
+ Which cells are editable is determined by the table's guards:
43
+
44
+ - Fields in `guards.updatable` are editable
45
+ - Fields in `guards.immutable` are read-only (shown with a disabled style)
46
+ - Fields in `guards.protected` are read-only (marked "Updated via actions only")
47
+ - Audit fields (`createdAt`, `createdBy`, `modifiedAt`, `modifiedBy`) are always read-only
48
+
49
+ Non-editable cells can still be selected and copied, but they don't enter edit mode.
50
+
51
+ ### Cell Types
52
+
53
+ | Column Type | Edit Control | Behavior |
54
+ |-------------|-------------|----------|
55
+ | Text | Text input | Free-text entry |
56
+ | Number | Number input | Numeric entry with step controls |
57
+ | Boolean | Yes/No dropdown | Toggle between Yes and No |
58
+ | FK reference | Typeahead dropdown | Server-side search with debounced queries |
59
+ | Enum | Select dropdown | Choose from allowed values |
60
+
61
+ ### Saving
62
+
63
+ Changes are auto-saved when you:
64
+
65
+ - Press **Enter** to confirm and move down
66
+ - Press **Tab** to confirm and move to the next editable cell
67
+ - **Click away** from the editing cell (blur)
68
+
69
+ Press **Escape** to cancel an edit and revert to the previous value.
70
+
71
+ ## Views
72
+
73
+ Views are named column projections defined in your table's resource config. They control which columns appear in the table based on the current role.
74
+
75
+ ### Toolbar
76
+
77
+ The toolbar shows a view dropdown when the table has views defined. Options include:
78
+
79
+ - **All Fields** — Shows all columns (default)
80
+ - Custom views — Only show the columns specified in the view config
81
+
82
+ Views are filtered by role access. If a view's access rules require `admin` and the current user is a `member`, that view won't appear in the dropdown.
83
+
84
+ ### Example
85
+
86
+ Given this definition:
87
+
88
+ ```typescript
89
+ read: {
90
+ views: {
91
+ summary: {
92
+ fields: ['id', 'name', 'status'],
93
+ access: { roles: ['member', 'admin'] },
94
+ },
95
+ full: {
96
+ fields: ['id', 'name', 'status', 'ssn', 'internalNotes'],
97
+ access: { roles: ['admin'] },
98
+ },
99
+ },
100
+ }
101
+ ```
102
+
103
+ - Members see: "All Fields" and "summary"
104
+ - Admins see: "All Fields", "summary", and "full"
105
+ - Owners see: "All Fields", "summary", and "full"
106
+
107
+ When a view is selected, the CMS calls the `listView` API endpoint instead of the standard `list`, fetching only the projected columns.
108
+
109
+ ## Default Sort
110
+
111
+ You can set a default sort order for a table by adding `defaultSort` to your resource config:
112
+
113
+ ```typescript
114
+ export default defineTable(podcastEpisodes, {
115
+ defaultSort: { field: "createdAt", order: "desc" },
116
+ // ...
117
+ });
118
+ ```
119
+
120
+ When the CMS loads the table, it applies this sort automatically. Users can still click column headers to change the sort — `defaultSort` only sets the initial state.
121
+
122
+ ## Pagination
123
+
124
+ The bottom of every table view shows pagination controls:
125
+
126
+ - **Page range indicator** — "Showing 1-25 of 142"
127
+ - **Page buttons** — Navigate directly to a page, with ellipsis for large page counts
128
+ - **Previous/Next** arrows
129
+
130
+ The default page size is 25 records. The CMS resets to page 1 when you change the search query or switch views.
131
+
132
+ ## Search
133
+
134
+ The search bar performs full-text search across all columns. Type a query and the CMS debounces the request, then fetches matching records from the API.
135
+
136
+ Search works in both Table and Data Table modes, and works with views (searching within the projected columns).
137
+
138
+ ## Next Steps
139
+
140
+ - **[Inline Editing](/stack/cms/inline-editing)** — Deep dive into spreadsheet editing, FK typeahead, and keyboard shortcuts
141
+ - **[Security](/stack/cms/security)** — How roles and guards affect the table UI
142
+ - **[Actions](/stack/cms/actions)** — Custom actions in the row menu and detail view
@@ -0,0 +1,65 @@
1
+ # Quickback Stack
2
+
3
+ **Quickback Stack** is the runtime services that surround your compiled API. While the [Quickback Compiler](/compiler) generates your routes and security policies, the Stack is everything else you need to ship a real application — auth, storage, realtime, queues, an admin UI, an account UI — all on your own Cloudflare account.
4
+
5
+ ## What you get
6
+
7
+ | Component | Service | Purpose |
8
+ |-----------|---------|---------|
9
+ | [Auth](/stack/auth) | Better Auth | Email/OTP, passkeys, organizations, admin |
10
+ | [Storage](/stack/storage) | KV, R2 | Sessions, cache, files |
11
+ | [Realtime](/stack/realtime) | Durable Objects | WebSocket for live updates |
12
+ | [Queues](/stack/queues) | Cloudflare Queues | Background jobs, webhook delivery |
13
+ | [Vector & AI](/stack/vector) | Workers AI | Embeddings, semantic search |
14
+ | [Webhooks](/stack/webhooks) | Hono + Queues | Signed inbound, retried outbound |
15
+ | [Quickback CMS](/stack/cms) | Embedded SPA | Schema-driven admin UI |
16
+ | [Account UI](/stack/account-ui) | Embedded SPA | Login, profile, orgs, admin |
17
+
18
+ ## Architecture
19
+
20
+ ```
21
+ ┌─────────────────────────────────────────────────────────────┐
22
+ │ Cloudflare Edge │
23
+ ├─────────────────────────────────────────────────────────────┤
24
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
25
+ │ │ Workers │ │ Durable │ │ KV │ │
26
+ │ │ (API/CMS) │ │ Objects │ │ (Cache) │ │
27
+ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
28
+ │ │ │ │ │
29
+ │ ┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐ │
30
+ │ │ D1 │ │ Realtime │ │ R2 │ │
31
+ │ │ (or Neon) │ │ (WebSocket)│ │ (Storage) │ │
32
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
33
+ │ │
34
+ │ ┌─────────────┐ ┌─────────────────────────────────┐ │
35
+ │ │ Queues │ │ Better Auth │ │
36
+ │ │ (Background)│ │ (Email OTP, Passkeys, etc.) │ │
37
+ │ └─────────────┘ └─────────────────────────────────┘ │
38
+ └─────────────────────────────────────────────────────────────┘
39
+ ```
40
+
41
+ ## Your account, your data
42
+
43
+ Everything in Quickback Stack runs on your own Cloudflare account:
44
+
45
+ - **Workers** — your deployments, your logs
46
+ - **Storage** — your KV namespaces, your R2 buckets
47
+ - **Secrets** — your API keys, in your Wrangler secrets
48
+
49
+ Quickback provides the architecture and the code generation. You own the infrastructure.
50
+
51
+ ## Quick start
52
+
53
+ ```bash
54
+ npm install -g wrangler @quickback-dev/cli
55
+ quickback create cloudflare my-app
56
+ cd my-app
57
+ quickback compile
58
+ wrangler deploy
59
+ ```
60
+
61
+ ## See also
62
+
63
+ - [Quickback Compiler](/compiler) — the build tool that generates your API
64
+ - [Quickback for Hono API](/compiler/targets/hono-api) — what the compiler outputs
65
+ - [Definitions](/compiler/definitions) — the security model the Stack runs