@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,338 @@
1
+ # Output Structure
2
+
3
+ The compiler generates a complete project structure based on your definitions and provider configuration. The output varies depending on your runtime (Cloudflare vs Bun) and enabled features.
4
+
5
+ **Warning:** Never edit files in `src/` directly. They are overwritten on every compile. Make changes in your `quickback/` definitions instead.
6
+
7
+ ## Cloudflare Output
8
+
9
+ ```
10
+ src/
11
+ ├── index.ts # Hono app entry point (Workers export)
12
+ ├── env.d.ts # Cloudflare bindings TypeScript types
13
+ ├── db/
14
+ │ ├── index.ts # Database connection factory
15
+ │ ├── auth-schema.ts # Auth table schemas (dual mode)
16
+ │ └── features-schema.ts # Feature table schemas (dual mode)
17
+ ├── auth/
18
+ │ └── index.ts # Better Auth instance & config
19
+ ├── features/
20
+ │ └── {feature}/
21
+ │ ├── schema.ts # Drizzle table definition
22
+ │ ├── routes.ts # CRUD + action endpoints
23
+ │ └── actions.ts # Action handlers (if defined)
24
+ ├── lib/
25
+ │ ├── access.ts # Access control helpers
26
+ │ ├── types.ts # Runtime type definitions
27
+ │ ├── masks.ts # Field masking utilities
28
+ │ ├── services.ts # Service layer
29
+ │ ├── audit-wrapper.ts # Auto-inject audit fields
30
+ │ └── security-audit.ts # Unsafe cross-tenant audit logger (when needed)
31
+ └── middleware/
32
+ ├── auth.ts # Auth context middleware
33
+ ├── db.ts # Database instance middleware
34
+ └── services.ts # Service injection middleware
35
+
36
+ quickback/drizzle/
37
+ ├── auth/ # Auth migrations (dual mode)
38
+ │ ├── meta/
39
+ │ │ ├── _journal.json
40
+ │ │ └── 0000_snapshot.json
41
+ │ └── 0000_initial.sql
42
+ ├── features/ # Feature migrations (dual mode)
43
+ │ ├── meta/
44
+ │ │ ├── _journal.json
45
+ │ │ └── 0000_snapshot.json
46
+ │ └── 0000_initial.sql
47
+ └── audit/ # Unsafe cross-tenant action audit migrations (when needed)
48
+ ├── meta/
49
+ └── 0000_initial.sql
50
+
51
+ # Root config files
52
+ ├── package.json
53
+ ├── tsconfig.json
54
+ ├── wrangler.toml # Cloudflare Workers config
55
+ ├── drizzle.config.ts # Features DB drizzle config
56
+ ├── drizzle.auth.config.ts # Auth DB drizzle config (dual mode)
57
+ └── drizzle.audit.config.ts # Audit DB drizzle config (when unsafe actions exist)
58
+ ```
59
+
60
+ ## Bun Output
61
+
62
+ ```
63
+ src/
64
+ ├── index.ts # Hono app entry point (Bun server)
65
+ ├── db/
66
+ │ ├── index.ts # SQLite connection (bun:sqlite)
67
+ │ └── schema.ts # Combined schema (single DB)
68
+ ├── auth/
69
+ │ └── index.ts # Better Auth instance
70
+ ├── features/
71
+ │ └── {feature}/
72
+ │ ├── schema.ts
73
+ │ ├── routes.ts
74
+ │ └── actions.ts
75
+ ├── lib/
76
+ │ ├── access.ts
77
+ │ ├── types.ts
78
+ │ ├── masks.ts
79
+ │ ├── services.ts
80
+ │ └── audit-wrapper.ts
81
+ └── middleware/
82
+ ├── auth.ts
83
+ ├── db.ts
84
+ └── services.ts
85
+
86
+ quickback/drizzle/ # Single migration directory
87
+ ├── meta/
88
+ │ ├── _journal.json
89
+ │ └── 0000_snapshot.json
90
+ └── 0000_initial.sql
91
+
92
+ data/ # SQLite database files
93
+ └── app.db
94
+
95
+ ├── package.json
96
+ ├── tsconfig.json
97
+ └── drizzle.config.ts
98
+ ```
99
+
100
+ ## Key Differences by Runtime
101
+
102
+ | Aspect | Cloudflare | Bun |
103
+ |--------|-----------|-----|
104
+ | Entry point | Workers `export default` | `Bun.serve()` with port |
105
+ | Database | D1 bindings (dual mode) | SQLite file (single DB) |
106
+ | Types | `env.d.ts` for bindings | No extra types needed |
107
+ | Config | `wrangler.toml` | `.env` file |
108
+ | Migrations | `quickback/drizzle/auth/` + `quickback/drizzle/features/` | `quickback/drizzle/` |
109
+ | Drizzle configs | 2 configs (auth + features) | 1 config |
110
+
111
+ ## Optional Output Files
112
+
113
+ These files are generated only when the corresponding features are configured:
114
+
115
+ ### Embeddings
116
+
117
+ When any feature has `embeddings` configured:
118
+
119
+ ```
120
+ src/
121
+ ├── lib/
122
+ │ └── embeddings.ts # Embedding helpers
123
+ ├── routes/
124
+ │ └── embeddings.ts # POST /api/v1/embeddings endpoint
125
+ └── queue-consumer.ts # Queue handler for async embedding jobs
126
+ ```
127
+
128
+ ### File Storage (R2)
129
+
130
+ When `fileStorage` is configured:
131
+
132
+ ```
133
+ src/
134
+ └── routes/
135
+ └── storage.ts # File upload/download endpoints
136
+ quickback/drizzle/
137
+ └── files/ # File metadata migrations
138
+ ├── meta/
139
+ └── 0000_*.sql
140
+ ```
141
+
142
+ ### Webhooks
143
+
144
+ When webhooks are enabled:
145
+
146
+ ```
147
+ src/
148
+ └── lib/
149
+ └── webhooks/
150
+ ├── index.ts # Webhook module entry
151
+ ├── sign.ts # Webhook payload signing
152
+ ├── handlers.ts # Handler registry
153
+ ├── emit.ts # Queue emission helpers
154
+ ├── routes.ts # Inbound/outbound endpoints
155
+ └── providers/
156
+ ├── index.ts
157
+ └── stripe.ts # Stripe webhook handler
158
+ quickback/drizzle/
159
+ └── webhooks/ # Webhook schema migrations
160
+ ├── meta/
161
+ └── 0000_*.sql
162
+ ```
163
+
164
+ ### Security Audit Database (Unsafe Actions)
165
+
166
+ When any action enables unsafe cross-tenant mode (`unsafe.crossTenant: true`):
167
+
168
+ ```
169
+ src/
170
+ ├── db/
171
+ │ └── audit-schema.ts # audit_events table
172
+ └── lib/
173
+ └── security-audit.ts # mandatory audit writer
174
+
175
+ quickback/drizzle/
176
+ └── audit/
177
+ ├── meta/
178
+ └── 0000_*.sql
179
+
180
+ # Root
181
+ └── drizzle.audit.config.ts
182
+ ```
183
+
184
+ Cloudflare output also includes an `AUDIT_DB` D1 binding in `wrangler.toml` and migration scripts:
185
+
186
+ - `db:migrate:audit:local`
187
+ - `db:migrate:audit:remote`
188
+
189
+ ### Security Contract Report and Signature
190
+
191
+ Generated on every compile (unless disabled via `compiler.securityContracts.report.enabled: false`):
192
+
193
+ ```
194
+ reports/
195
+ ├── security-contracts.report.json # Contract evaluation summary + violations
196
+ └── security-contracts.report.sig.json # Signature / digest envelope for the report
197
+ ```
198
+
199
+ The signature file uses HMAC-SHA256 when a signing key is configured, otherwise it falls back to SHA-256 digest mode.
200
+ Set `compiler.securityContracts.report.signature.required: true` to fail compilation when a signing key is missing.
201
+
202
+ ### Realtime
203
+
204
+ When any feature has `realtime` configured:
205
+
206
+ ```
207
+ src/
208
+ ├── lib/
209
+ │ ├── realtime.ts # Broadcast helpers
210
+ │ ├── Broadcaster.ts # Durable Object class (inline in main worker)
211
+ │ └── ws-ticket.ts # WebSocket ticket auth utility
212
+ └── routes/
213
+ └── ws-ticket.ts # POST /realtime/v1/ws-ticket endpoint
214
+ ```
215
+
216
+ The Broadcaster DO class is exported from your main worker entry point and runs inline — no separate `cloudflare-workers/broadcast/` deployment needed.
217
+
218
+ ### Device Authorization
219
+
220
+ When the `deviceAuthorization` plugin is enabled:
221
+
222
+ ```
223
+ src/
224
+ └── routes/
225
+ └── cli-auth.ts # Device auth flow endpoints
226
+ ```
227
+
228
+ ## Database Schemas
229
+
230
+ ### Dual Database Mode (Cloudflare Default)
231
+
232
+ The compiler separates schemas into two files:
233
+
234
+ **`src/db/auth-schema.ts`** — Re-exports Better Auth table schemas:
235
+ - `users`, `sessions`, `accounts`
236
+ - `organizations`, `members`, `invitations` (if organizations enabled)
237
+ - Plugin-specific tables (`apiKeys`, etc.)
238
+
239
+ **`src/db/features-schema.ts`** — Re-exports your feature schemas:
240
+ - All tables defined with `defineTable()`
241
+ - Audit field columns added automatically
242
+
243
+ ### Single Database Mode (Bun Default)
244
+
245
+ **`src/db/schema.ts`** — Combined re-export of all schemas (auth + features).
246
+
247
+ ## Generated Routes
248
+
249
+ For each feature, the compiler generates a routes file at `src/features/{name}/routes.ts` containing:
250
+
251
+ | Route | Generated When |
252
+ |-------|----------------|
253
+ | `GET /` | `crud.list` configured |
254
+ | `GET /:id` | `crud.get` configured |
255
+ | `POST /` | `crud.create` configured |
256
+ | `PATCH /:id` | `crud.update` configured |
257
+ | `DELETE /:id` | `crud.delete` configured |
258
+ | `PUT /:id` | `crud.put` configured |
259
+ | `POST /batch` | `crud.create` exists (auto-enabled) |
260
+ | `PATCH /batch` | `crud.update` exists (auto-enabled) |
261
+ | `DELETE /batch` | `crud.delete` exists (auto-enabled) |
262
+ | `PUT /batch` | `crud.put` exists (auto-enabled) |
263
+ | `GET /views/{name}` | `views` configured |
264
+ | `POST /:id/{action}` | Record-based actions defined |
265
+ | `POST /{action}` | Standalone actions defined |
266
+
267
+ All routes are mounted under `/api/v1/{feature}` in the main app.
268
+
269
+ ## Migrations
270
+
271
+ The compiler runs `drizzle-kit generate` during compilation to produce SQL migration files. On subsequent compiles, it uses `existingFiles` (your current migration state) to generate only incremental changes.
272
+
273
+ The CLI loads migration meta JSON from one location only — `<project>/quickback/drizzle/`:
274
+
275
+ - `quickback/drizzle/auth/meta/`
276
+ - `quickback/drizzle/features/meta/`
277
+ - `quickback/drizzle/files/meta/`
278
+ - `quickback/drizzle/webhooks/meta/`
279
+ - `quickback/drizzle/audit/meta/`
280
+ - `quickback/drizzle/meta/` (single-database mode)
281
+
282
+ Quickback owns this state — nothing under a project-root `drizzle/` folder is ever read or written.
283
+
284
+ Migration and report artifacts are written to the `quickback/` state directory:
285
+
286
+ - `quickback/drizzle/...` for Drizzle migration SQL/meta artifacts
287
+ - `quickback/reports/...` for security contract report artifacts
288
+
289
+ For non-interactive environments (cloud compile, CI), table/column renames must be declared with `compiler.migrations.renames` in `quickback.config.ts`. This avoids interactive rename prompts during migration generation.
290
+
291
+ Migration files follow the Drizzle Kit naming convention:
292
+ ```
293
+ 0000_initial.sql
294
+ 0001_add_status_column.sql
295
+ 0002_create_orders_table.sql
296
+ ```
297
+
298
+ ## CMS and Account UI Assets
299
+
300
+ When `cms` and/or `account` are enabled, the compiler builds the SPAs from source at compile time and includes the assets in the output.
301
+
302
+ Each SPA is placed in its own subdirectory under `src/apps/`:
303
+
304
+ ```
305
+ src/apps/ # Root assets directory
306
+ ├── cms/ # CMS SPA (served at /cms/ on unified domain)
307
+ │ ├── index.html
308
+ │ └── assets/
309
+ │ ├── app.abc123.js # Content-hashed filenames from Vite
310
+ │ └── app.xyz456.css
311
+ └── account/ # Account SPA (served at /account/ on unified domain)
312
+ ├── index.html
313
+ └── assets/
314
+ ├── app.def789.js
315
+ └── app.ghi012.css
316
+ ```
317
+
318
+ On custom domains, each SPA is served at root (`/`) via hostname-based routing. On the unified domain, CMS is at `/cms/` and Account is at `/account/`.
319
+
320
+ ### Generated Wrangler Assets Config
321
+
322
+ The compiler always generates `run_worker_first = true` when SPAs are enabled — the Worker handles all SPA routing (per hostname and per path prefix):
323
+
324
+ ```toml
325
+ [assets]
326
+ binding = "ASSETS"
327
+ directory = "src/apps"
328
+ not_found_handling = "none"
329
+ run_worker_first = true
330
+ ```
331
+
332
+ See [Multi-Domain Architecture](/compiler/config/domains) for details on hostname routing.
333
+
334
+ ## See Also
335
+
336
+ - [Providers](/compiler/config/providers) — Configure runtime, database, and auth providers
337
+ - [Environment variables](/compiler/config/variables) — Required variables by runtime
338
+ - [Multi-Domain Architecture](/compiler/config/domains) — Custom domains and hostname routing
@@ -0,0 +1,248 @@
1
+ # Providers
2
+
3
+ Providers configure which services your compiled backend targets.
4
+
5
+ ## Runtime Providers
6
+
7
+ | Provider | Description |
8
+ |----------|-------------|
9
+ | `cloudflare` | Cloudflare Workers (Hono) |
10
+ | `bun` | Bun runtime (Hono) |
11
+ | `node` | Node.js runtime (Hono) |
12
+
13
+ ```typescript
14
+ import { defineRuntime } from "@quickback/compiler";
15
+
16
+ providers: {
17
+ runtime: defineRuntime("cloudflare"),
18
+ }
19
+ ```
20
+
21
+ ## Database Providers
22
+
23
+ | Provider | Description |
24
+ |----------|-------------|
25
+ | `cloudflare-d1` | Cloudflare D1 (SQLite) |
26
+ | `better-sqlite3` | SQLite via better-sqlite3 (Bun/Node) |
27
+ | `libsql` | LibSQL / Turso |
28
+ | `neon` | Neon (PostgreSQL) |
29
+ | `supabase` | Supabase (PostgreSQL) |
30
+
31
+ ```typescript
32
+ import { defineDatabase } from "@quickback/compiler";
33
+
34
+ providers: {
35
+ database: defineDatabase("cloudflare-d1", {
36
+ generateId: "prefixed", // "uuid" | "cuid" | "nanoid" | "prefixed" | "serial" | false
37
+ namingConvention: "snake_case", // "camelCase" | "snake_case"
38
+ usePlurals: false, // Auth table names: "users" vs "user"
39
+ }),
40
+ }
41
+ ```
42
+
43
+ ### Database Options
44
+
45
+ | Option | Type | Default (D1) | Description |
46
+ |--------|------|---------|-------------|
47
+ | `generateId` | `string \| false` | `"prefixed"` | ID generation strategy |
48
+ | `namingConvention` | `string` | `"snake_case"` | Column naming convention |
49
+ | `usePlurals` | `boolean` | `false` | Pluralize auth table names (e.g. `user` vs `users`) |
50
+ | `splitDatabases` | `boolean` | `true` | Separate auth and features databases |
51
+ | `authBinding` | `string` | `"AUTH_DB"` | Binding name for auth database |
52
+ | `featuresBinding` | `string` | `"DB"` | Binding name for features database |
53
+ | `databaseId` | `string` | — | D1 database ID for the features database (used in generated wrangler.toml) |
54
+ | `authDatabaseId` | `string` | — | D1 database ID for the auth database |
55
+ | `featuresDatabaseId` | `string` | — | Explicit features DB ID (falls back to `databaseId`) |
56
+ | `filesDatabaseId` | `string` | — | D1 database ID for the files metadata database |
57
+ | `webhooksDatabaseId` | `string` | — | D1 database ID for the webhooks database |
58
+ | `auditBinding` | `string` | `"AUDIT_DB"` | Binding name for the security audit database |
59
+ | `auditDatabaseName` | `string` | `"{app}-audit"` | D1 database name for audit events |
60
+ | `auditDatabaseId` | `string` | — | Explicit D1 database ID for audit events |
61
+ | `experimentalRemote` | `{ auth?, features?, audit?, webhooks?, files? }` | `{}` | Per-binding `experimental_remote = true` flag for `wrangler dev` (see [below](#sharing-deployed-d1-in-dev-experimental_remote)) |
62
+ | `webhookAdminRoles` | `string[]` | `["owner", "admin"]` | Org roles allowed to manage webhook endpoints |
63
+
64
+ #### Audit Database
65
+
66
+ Cross-tenant `unsafe` actions (see [Actions → Unsafe mode](/compiler/definitions/actions#unsafe-mode)) write mandatory audit events. Those events land in a dedicated D1 database — separate from your features DB — so audit history stays isolated from application data and can't be tampered with through a normal CRUD route.
67
+
68
+ You don't need to do anything to enable it — the compiler wires up the binding automatically if your project declares any unsafe action. To override defaults:
69
+
70
+ ```typescript
71
+ providers: {
72
+ database: defineDatabase("cloudflare-d1", {
73
+ auditBinding: "MY_AUDIT_DB", // default: AUDIT_DB
74
+ auditDatabaseName: "my-app-audit-prod", // default: {app}-audit
75
+ auditDatabaseId: "c3b8866b-cc4f-4e51-8382-0af244584d93",
76
+ }),
77
+ }
78
+ ```
79
+
80
+ The binding name must match what your Worker reads at runtime. If you don't declare any unsafe actions, no audit DB is provisioned and these options have no effect.
81
+
82
+ #### Setting Database IDs for Deployment
83
+
84
+ When deploying to production, set your D1 database IDs so the compiler generates a ready-to-deploy `wrangler.toml`:
85
+
86
+ ```typescript
87
+ providers: {
88
+ database: defineDatabase("cloudflare-d1", {
89
+ authDatabaseId: "fe6c77c4-2131-40be-a8fc-3649eef2a38c",
90
+ databaseId: "bba22981-cb6e-43d6-bf32-4193513c60b1",
91
+ filesDatabaseId: "c3b8866b-cc4f-4e51-8382-0af244584d93",
92
+ }),
93
+ }
94
+ ```
95
+
96
+ If these are omitted, the compiler uses local-dev placeholders and you'll need to manually edit `wrangler.toml` before deploying.
97
+
98
+ #### Sharing deployed D1 in dev (`experimental_remote`)
99
+
100
+ Wrangler can read or write the **deployed** D1 for a specific binding while `wrangler dev` runs locally. A common workflow: share the production auth DB in dev so real sessions and users work against the running local Worker, while feature writes stay sandboxed in the local SQLite shadow.
101
+
102
+ Quickback regenerates `wrangler.toml` on every compile, so flags like `experimental_remote = true` need to live in `quickback.config.ts`:
103
+
104
+ ```typescript
105
+ providers: {
106
+ database: defineDatabase("cloudflare-d1", {
107
+ authDatabaseId: "fe6c77c4-2131-40be-a8fc-3649eef2a38c",
108
+ experimentalRemote: { auth: true },
109
+ }),
110
+ }
111
+ ```
112
+
113
+ Keys map to logical bindings, not the runtime binding string:
114
+
115
+ | Key | Binding affected |
116
+ |-----|------------------|
117
+ | `auth` | `AUTH_DB` (also applied to the files worker's auth binding) |
118
+ | `features` | `DB` (or the legacy single-DB binding when `splitDatabases: false`) |
119
+ | `audit` | `AUDIT_DB` |
120
+ | `webhooks` | `WEBHOOKS_DB` |
121
+ | `files` | `FILES_DB` (also applied to the files worker) |
122
+
123
+ Only `true` flips the flag on; `false` or omitted leaves the binding local. Off by default — only enable against databases you intend to share.
124
+
125
+ > `experimental_remote` is a Wrangler dev feature. A flagged binding hits the deployed D1 from `wrangler dev`, so any write goes to production. Only enable for bindings you've decided are safe to read/write from local dev.
126
+
127
+
128
+ <Callout>
129
+ `usePlurals` only affects **auth tables** generated by Better Auth (e.g. `user` vs `users`, `session` vs `sessions`). Feature table names come directly from your Drizzle schema definitions — whatever you pass to `sqliteTable()` or `pgTable()` is used as-is. The `namingConvention` setting applies to both auth and feature column names.
130
+ </Callout>
131
+
132
+ ### ID Generation Options
133
+
134
+ | Value | Description | Example |
135
+ |-------|-------------|---------|
136
+ | `"uuid"` | Server generates UUID | `550e8400-e29b-41d4-a716-446655440000` |
137
+ | `"cuid"` | Server generates CUID | `clh2v8k9g0000l508h5gx8j1a` |
138
+ | `"nanoid"` | Server generates nanoid (21-char, URL-safe) | `V1StGXR8_Z5jdHi6B-myT` |
139
+ | `"short"` | 6-char alphanumeric (nanoid `customAlphabet`) | `a3F9xK` |
140
+ | `"prefixed"` | Prefixed ID from table name | `room_abc123` |
141
+ | `"serial"` | Database auto-increments | `1`, `2`, `3` |
142
+ | `false` | Client provides ID (enables PUT/upsert) | Any string |
143
+
144
+ > `"short"` produces IDs with ~56.8 billion possible values (62^6). That's fine for small/scoped tables like rooms, invites, or share codes — but at roughly 238,000 rows you hit a 50% chance of collision (birthday bound). Don't use it for high-volume records. `"nanoid"` and `"short"` both require the `nanoid` package in your project.
145
+
146
+
147
+ ## Auth Providers
148
+
149
+ | Provider | Description |
150
+ |----------|-------------|
151
+ | `better-auth` | Better Auth with plugins |
152
+ | `supabase-auth` | Supabase Auth |
153
+ | `external` | External auth via Cloudflare service binding |
154
+
155
+ ```typescript
156
+ import { defineAuth } from "@quickback/compiler";
157
+
158
+ providers: {
159
+ auth: defineAuth("better-auth", {
160
+ session: {
161
+ expiresInDays: 7,
162
+ updateAgeInDays: 1,
163
+ },
164
+ rateLimit: {
165
+ enabled: true,
166
+ window: 60,
167
+ max: 100,
168
+ },
169
+ }),
170
+ }
171
+ ```
172
+
173
+ ### Better Auth Options
174
+
175
+ | Option | Type | Description |
176
+ |--------|------|-------------|
177
+ | `session.expiresInDays` | `number` | Session expiration in days |
178
+ | `session.updateAgeInDays` | `number` | Session refresh interval in days |
179
+ | `rateLimit.enabled` | `boolean` | Enable rate limiting |
180
+ | `rateLimit.window` | `number` | Rate limit window in seconds |
181
+ | `rateLimit.max` | `number` | Max requests per window |
182
+ | `socialProviders` | `object` | Social login providers (`google`, `github`, `discord`) |
183
+ | `debugLogs` | `boolean` | Enable auth debug logging |
184
+
185
+ <Callout>
186
+ Auth table naming (`usePlurals`, `namingConvention`) is inherited from your database provider config — you don't need to set it separately on the auth provider. `usePlurals` controls whether auth tables are named `user`/`session` or `users`/`sessions`. It does not affect feature tables, which use whatever name you define in your schema.
187
+ </Callout>
188
+
189
+ ### Better Auth Plugins
190
+
191
+ When `features: ["organizations"]` is set in your config, the compiler automatically enables organization-related plugins. Additional plugins can be configured:
192
+
193
+ | Plugin | Description |
194
+ |--------|-------------|
195
+ | `organization` | Multi-tenant organizations |
196
+ | `admin` | Admin panel access |
197
+ | `apiKey` | API key authentication |
198
+ | `anonymous` | Anonymous sessions |
199
+ | `upgradeAnonymous` | Convert anonymous to full accounts |
200
+ | `twoFactor` | Two-factor authentication |
201
+ | `passkey` | WebAuthn passkey login |
202
+ | `magicLink` | Email magic link login |
203
+ | `emailOtp` | Email one-time password |
204
+ | `deviceAuthorization` | Device auth flow (CLI tools) |
205
+ | `jwt` | JWT token support |
206
+ | `openAPI` | OpenAPI spec generation |
207
+
208
+ ## Storage Providers
209
+
210
+ ```typescript
211
+ import { defineStorage, defineFileStorage } from "@quickback/compiler";
212
+
213
+ providers: {
214
+ storage: defineStorage("kv", {
215
+ binding: "KV_STORE",
216
+ namespaceId: "7ed0f824a8c54c388713d9fdf63cd004",
217
+ }),
218
+ fileStorage: defineFileStorage("r2", {
219
+ binding: "FILES",
220
+ maxFileSize: "10mb",
221
+ allowedTypes: ["image/png", "image/jpeg", "application/pdf"],
222
+ publicDomain: "files.example.com",
223
+ }),
224
+ }
225
+ ```
226
+
227
+ <Callout>
228
+ The KV `namespaceId` can be set on the storage provider config, or as `kvId` on the auth provider config (since KV is primarily used for auth sessions). The compiler checks both locations.
229
+ </Callout>
230
+
231
+ ### Storage Types
232
+
233
+ | Type | Description |
234
+ |------|-------------|
235
+ | `kv` | Key-value storage (Cloudflare KV, Redis) |
236
+ | `r2` | Object storage (Cloudflare R2) |
237
+ | `memory` | In-memory storage (development only) |
238
+ | `redis` | Redis storage |
239
+
240
+ ### File Storage Options
241
+
242
+ | Option | Type | Description |
243
+ |--------|------|-------------|
244
+ | `binding` | `string` | R2 bucket binding name |
245
+ | `maxFileSize` | `string` | Maximum file size (e.g. `"10mb"`) |
246
+ | `allowedTypes` | `string[]` | Allowed MIME types |
247
+ | `publicDomain` | `string` | Public domain for file URLs |
248
+ | `userScopedBuckets` | `boolean` | Scope files by user |