@quickback-dev/cli 0.10.16 → 0.10.20

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 (249) 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.js +6 -6
  5. package/dist/docs/content.js.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/skill/SKILL.md +142 -1051
  8. package/dist/skill/agents/quickback-specialist/AGENT.md +36 -0
  9. package/dist/skill/docs/changelog.md +1192 -0
  10. package/dist/skill/docs/compiler/claude-code-skill.md +312 -0
  11. package/dist/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
  12. package/dist/skill/docs/compiler/cloud-compiler/cli.md +307 -0
  13. package/dist/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
  14. package/dist/skill/docs/compiler/cloud-compiler/index.md +65 -0
  15. package/dist/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
  16. package/dist/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
  17. package/dist/skill/docs/compiler/config/agents.md +144 -0
  18. package/dist/skill/docs/compiler/config/auth.md +109 -0
  19. package/dist/skill/docs/compiler/config/bindings.md +176 -0
  20. package/dist/skill/docs/compiler/config/domains.md +149 -0
  21. package/dist/skill/docs/compiler/config/index.md +419 -0
  22. package/dist/skill/docs/compiler/config/output.md +338 -0
  23. package/dist/skill/docs/compiler/config/providers.md +248 -0
  24. package/dist/skill/docs/compiler/config/security.md +255 -0
  25. package/dist/skill/docs/compiler/config/single-tenant.md +128 -0
  26. package/dist/skill/docs/compiler/config/variables.md +157 -0
  27. package/dist/skill/docs/compiler/definitions/access.md +445 -0
  28. package/dist/skill/docs/compiler/definitions/actions.md +884 -0
  29. package/dist/skill/docs/compiler/definitions/concepts.md +52 -0
  30. package/dist/skill/docs/compiler/definitions/feature.md +164 -0
  31. package/dist/skill/docs/compiler/definitions/firewall.md +285 -0
  32. package/dist/skill/docs/compiler/definitions/guards.md +241 -0
  33. package/dist/skill/docs/compiler/definitions/index.md +219 -0
  34. package/dist/skill/docs/compiler/definitions/masking.md +241 -0
  35. package/dist/skill/docs/compiler/definitions/read.md +220 -0
  36. package/dist/skill/docs/compiler/definitions/schema.md +697 -0
  37. package/dist/skill/docs/compiler/definitions/validation.md +35 -0
  38. package/dist/skill/docs/compiler/definitions/views.md +292 -0
  39. package/dist/skill/docs/compiler/getting-started/claude-code.md +126 -0
  40. package/dist/skill/docs/compiler/getting-started/full-example.md +431 -0
  41. package/dist/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
  42. package/dist/skill/docs/compiler/getting-started/index.md +192 -0
  43. package/dist/skill/docs/compiler/getting-started/patterns.md +225 -0
  44. package/dist/skill/docs/compiler/getting-started/template-blog.md +280 -0
  45. package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
  46. package/dist/skill/docs/compiler/getting-started/template-empty.md +112 -0
  47. package/dist/skill/docs/compiler/getting-started/templates.md +111 -0
  48. package/dist/skill/docs/compiler/index.md +85 -0
  49. package/dist/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
  50. package/dist/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
  51. package/dist/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
  52. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
  53. package/dist/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
  54. package/dist/skill/docs/compiler/targets/hono-api/index.md +37 -0
  55. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
  56. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
  57. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
  58. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
  59. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
  60. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
  61. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
  62. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
  63. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
  64. package/dist/skill/docs/compiler/targets/index.md +47 -0
  65. package/dist/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
  66. package/dist/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
  67. package/dist/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
  68. package/dist/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
  69. package/dist/skill/docs/compiler/troubleshooting.md +120 -0
  70. package/dist/skill/docs/index.md +77 -0
  71. package/dist/skill/docs/stack/account-ui/customization.md +378 -0
  72. package/dist/skill/docs/stack/account-ui/environment-variables.md +325 -0
  73. package/dist/skill/docs/stack/account-ui/features/admin.md +76 -0
  74. package/dist/skill/docs/stack/account-ui/features/api-keys.md +22 -0
  75. package/dist/skill/docs/stack/account-ui/features/avatars.md +37 -0
  76. package/dist/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
  77. package/dist/skill/docs/stack/account-ui/features/index.md +291 -0
  78. package/dist/skill/docs/stack/account-ui/features/organizations.md +29 -0
  79. package/dist/skill/docs/stack/account-ui/features/passkeys.md +31 -0
  80. package/dist/skill/docs/stack/account-ui/features/passwordless.md +28 -0
  81. package/dist/skill/docs/stack/account-ui/features/sessions.md +20 -0
  82. package/dist/skill/docs/stack/account-ui/hooks.md +209 -0
  83. package/dist/skill/docs/stack/account-ui/index.md +147 -0
  84. package/dist/skill/docs/stack/account-ui/library-usage.md +257 -0
  85. package/dist/skill/docs/stack/account-ui/standalone.md +149 -0
  86. package/dist/skill/docs/stack/account-ui/with-quickback.md +160 -0
  87. package/dist/skill/docs/stack/account-ui/worker.md +362 -0
  88. package/dist/skill/docs/stack/auth/api-keys.md +15 -0
  89. package/dist/skill/docs/stack/auth/device-auth.md +14 -0
  90. package/dist/skill/docs/stack/auth/index.md +64 -0
  91. package/dist/skill/docs/stack/auth/jwt-optimization.md +245 -0
  92. package/dist/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
  93. package/dist/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
  94. package/dist/skill/docs/stack/auth/plugins/index.md +228 -0
  95. package/dist/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
  96. package/dist/skill/docs/stack/auth/security.md +455 -0
  97. package/dist/skill/docs/stack/auth/using-auth.md +39 -0
  98. package/dist/skill/docs/stack/cms/actions.md +199 -0
  99. package/dist/skill/docs/stack/cms/components.md +479 -0
  100. package/dist/skill/docs/stack/cms/connecting.md +199 -0
  101. package/dist/skill/docs/stack/cms/dashboard.md +39 -0
  102. package/dist/skill/docs/stack/cms/index.md +158 -0
  103. package/dist/skill/docs/stack/cms/inline-editing.md +136 -0
  104. package/dist/skill/docs/stack/cms/pages.md +275 -0
  105. package/dist/skill/docs/stack/cms/record-layouts.md +151 -0
  106. package/dist/skill/docs/stack/cms/schema-format.md +437 -0
  107. package/dist/skill/docs/stack/cms/schema-registry.md +200 -0
  108. package/dist/skill/docs/stack/cms/security.md +203 -0
  109. package/dist/skill/docs/stack/cms/table-views.md +142 -0
  110. package/dist/skill/docs/stack/index.md +65 -0
  111. package/dist/skill/docs/stack/queues/handlers.md +317 -0
  112. package/dist/skill/docs/stack/queues/index.md +56 -0
  113. package/dist/skill/docs/stack/queues/using-queues.md +192 -0
  114. package/dist/skill/docs/stack/realtime/durable-objects.md +488 -0
  115. package/dist/skill/docs/stack/realtime/index.md +67 -0
  116. package/dist/skill/docs/stack/realtime/using-realtime.md +211 -0
  117. package/dist/skill/docs/stack/storage/index.md +17 -0
  118. package/dist/skill/docs/stack/storage/kv.md +204 -0
  119. package/dist/skill/docs/stack/storage/r2.md +232 -0
  120. package/dist/skill/docs/stack/storage/using-kv.md +70 -0
  121. package/dist/skill/docs/stack/storage/using-r2.md +55 -0
  122. package/dist/skill/docs/stack/vector/embeddings.md +554 -0
  123. package/dist/skill/docs/stack/vector/index.md +44 -0
  124. package/dist/skill/docs/stack/vector/using-embeddings.md +186 -0
  125. package/dist/skill/docs/stack/webhooks/inbound.md +186 -0
  126. package/dist/skill/docs/stack/webhooks/index.md +36 -0
  127. package/dist/skill/docs/stack/webhooks/outbound.md +281 -0
  128. package/package.json +1 -1
  129. package/src/skill/SKILL.md +142 -1051
  130. package/src/skill/agents/quickback-specialist/AGENT.md +36 -0
  131. package/src/skill/docs/changelog.md +1192 -0
  132. package/src/skill/docs/compiler/claude-code-skill.md +312 -0
  133. package/src/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
  134. package/src/skill/docs/compiler/cloud-compiler/cli.md +307 -0
  135. package/src/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
  136. package/src/skill/docs/compiler/cloud-compiler/index.md +65 -0
  137. package/src/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
  138. package/src/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
  139. package/src/skill/docs/compiler/config/agents.md +144 -0
  140. package/src/skill/docs/compiler/config/auth.md +109 -0
  141. package/src/skill/docs/compiler/config/bindings.md +176 -0
  142. package/src/skill/docs/compiler/config/domains.md +149 -0
  143. package/src/skill/docs/compiler/config/index.md +419 -0
  144. package/src/skill/docs/compiler/config/output.md +338 -0
  145. package/src/skill/docs/compiler/config/providers.md +248 -0
  146. package/src/skill/docs/compiler/config/security.md +255 -0
  147. package/src/skill/docs/compiler/config/single-tenant.md +128 -0
  148. package/src/skill/docs/compiler/config/variables.md +157 -0
  149. package/src/skill/docs/compiler/definitions/access.md +445 -0
  150. package/src/skill/docs/compiler/definitions/actions.md +884 -0
  151. package/src/skill/docs/compiler/definitions/concepts.md +52 -0
  152. package/src/skill/docs/compiler/definitions/feature.md +164 -0
  153. package/src/skill/docs/compiler/definitions/firewall.md +285 -0
  154. package/src/skill/docs/compiler/definitions/guards.md +241 -0
  155. package/src/skill/docs/compiler/definitions/index.md +219 -0
  156. package/src/skill/docs/compiler/definitions/masking.md +241 -0
  157. package/src/skill/docs/compiler/definitions/read.md +220 -0
  158. package/src/skill/docs/compiler/definitions/schema.md +697 -0
  159. package/src/skill/docs/compiler/definitions/validation.md +35 -0
  160. package/src/skill/docs/compiler/definitions/views.md +292 -0
  161. package/src/skill/docs/compiler/getting-started/claude-code.md +126 -0
  162. package/src/skill/docs/compiler/getting-started/full-example.md +431 -0
  163. package/src/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
  164. package/src/skill/docs/compiler/getting-started/index.md +192 -0
  165. package/src/skill/docs/compiler/getting-started/patterns.md +225 -0
  166. package/src/skill/docs/compiler/getting-started/template-blog.md +280 -0
  167. package/src/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
  168. package/src/skill/docs/compiler/getting-started/template-empty.md +112 -0
  169. package/src/skill/docs/compiler/getting-started/templates.md +111 -0
  170. package/src/skill/docs/compiler/index.md +85 -0
  171. package/src/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
  172. package/src/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
  173. package/src/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
  174. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
  175. package/src/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
  176. package/src/skill/docs/compiler/targets/hono-api/index.md +37 -0
  177. package/src/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
  178. package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
  179. package/src/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
  180. package/src/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
  181. package/src/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
  182. package/src/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
  183. package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
  184. package/src/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
  185. package/src/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
  186. package/src/skill/docs/compiler/targets/index.md +47 -0
  187. package/src/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
  188. package/src/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
  189. package/src/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
  190. package/src/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
  191. package/src/skill/docs/compiler/troubleshooting.md +120 -0
  192. package/src/skill/docs/index.md +77 -0
  193. package/src/skill/docs/stack/account-ui/customization.md +378 -0
  194. package/src/skill/docs/stack/account-ui/environment-variables.md +325 -0
  195. package/src/skill/docs/stack/account-ui/features/admin.md +76 -0
  196. package/src/skill/docs/stack/account-ui/features/api-keys.md +22 -0
  197. package/src/skill/docs/stack/account-ui/features/avatars.md +37 -0
  198. package/src/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
  199. package/src/skill/docs/stack/account-ui/features/index.md +291 -0
  200. package/src/skill/docs/stack/account-ui/features/organizations.md +29 -0
  201. package/src/skill/docs/stack/account-ui/features/passkeys.md +31 -0
  202. package/src/skill/docs/stack/account-ui/features/passwordless.md +28 -0
  203. package/src/skill/docs/stack/account-ui/features/sessions.md +20 -0
  204. package/src/skill/docs/stack/account-ui/hooks.md +209 -0
  205. package/src/skill/docs/stack/account-ui/index.md +147 -0
  206. package/src/skill/docs/stack/account-ui/library-usage.md +257 -0
  207. package/src/skill/docs/stack/account-ui/standalone.md +149 -0
  208. package/src/skill/docs/stack/account-ui/with-quickback.md +160 -0
  209. package/src/skill/docs/stack/account-ui/worker.md +362 -0
  210. package/src/skill/docs/stack/auth/api-keys.md +15 -0
  211. package/src/skill/docs/stack/auth/device-auth.md +14 -0
  212. package/src/skill/docs/stack/auth/index.md +64 -0
  213. package/src/skill/docs/stack/auth/jwt-optimization.md +245 -0
  214. package/src/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
  215. package/src/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
  216. package/src/skill/docs/stack/auth/plugins/index.md +228 -0
  217. package/src/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
  218. package/src/skill/docs/stack/auth/security.md +455 -0
  219. package/src/skill/docs/stack/auth/using-auth.md +39 -0
  220. package/src/skill/docs/stack/cms/actions.md +199 -0
  221. package/src/skill/docs/stack/cms/components.md +479 -0
  222. package/src/skill/docs/stack/cms/connecting.md +199 -0
  223. package/src/skill/docs/stack/cms/dashboard.md +39 -0
  224. package/src/skill/docs/stack/cms/index.md +158 -0
  225. package/src/skill/docs/stack/cms/inline-editing.md +136 -0
  226. package/src/skill/docs/stack/cms/pages.md +275 -0
  227. package/src/skill/docs/stack/cms/record-layouts.md +151 -0
  228. package/src/skill/docs/stack/cms/schema-format.md +437 -0
  229. package/src/skill/docs/stack/cms/schema-registry.md +200 -0
  230. package/src/skill/docs/stack/cms/security.md +203 -0
  231. package/src/skill/docs/stack/cms/table-views.md +142 -0
  232. package/src/skill/docs/stack/index.md +65 -0
  233. package/src/skill/docs/stack/queues/handlers.md +317 -0
  234. package/src/skill/docs/stack/queues/index.md +56 -0
  235. package/src/skill/docs/stack/queues/using-queues.md +192 -0
  236. package/src/skill/docs/stack/realtime/durable-objects.md +488 -0
  237. package/src/skill/docs/stack/realtime/index.md +67 -0
  238. package/src/skill/docs/stack/realtime/using-realtime.md +211 -0
  239. package/src/skill/docs/stack/storage/index.md +17 -0
  240. package/src/skill/docs/stack/storage/kv.md +204 -0
  241. package/src/skill/docs/stack/storage/r2.md +232 -0
  242. package/src/skill/docs/stack/storage/using-kv.md +70 -0
  243. package/src/skill/docs/stack/storage/using-r2.md +55 -0
  244. package/src/skill/docs/stack/vector/embeddings.md +554 -0
  245. package/src/skill/docs/stack/vector/index.md +44 -0
  246. package/src/skill/docs/stack/vector/using-embeddings.md +186 -0
  247. package/src/skill/docs/stack/webhooks/inbound.md +186 -0
  248. package/src/skill/docs/stack/webhooks/index.md +36 -0
  249. package/src/skill/docs/stack/webhooks/outbound.md +281 -0
@@ -0,0 +1,260 @@
1
+ # Cloudflare Template
2
+
3
+ The Cloudflare template creates a production-ready backend running on Cloudflare Workers with D1 (SQLite at the edge), KV storage, and Better Auth.
4
+
5
+ ## Create the Project
6
+
7
+ ```bash
8
+ quickback create cloudflare my-app
9
+ cd my-app
10
+ ```
11
+
12
+ Aliases: `quickback create cf my-app`
13
+
14
+ This scaffolds a project with:
15
+
16
+ ```
17
+ my-app/
18
+ ├── quickback/
19
+ │ ├── quickback.config.ts # Compiler configuration
20
+ │ └── features/
21
+ │ └── todos/
22
+ │ ├── todos.ts # Schema + security (defineTable)
23
+ │ └── actions.ts # Custom actions
24
+ ├── src/ # Compiled output (generated)
25
+ ├── package.json
26
+ ├── tsconfig.json
27
+ ├── wrangler.toml
28
+ └── drizzle.config.ts
29
+ ```
30
+
31
+ ## Generated Configuration
32
+
33
+ ### quickback.config.ts
34
+
35
+ ```typescript
36
+ import { defineConfig } from "@quickback/compiler";
37
+
38
+ export default defineConfig({
39
+ name: "my-app",
40
+ template: "hono",
41
+ features: ["organizations"],
42
+ providers: {
43
+ runtime: { name: "cloudflare", config: {} },
44
+ database: {
45
+ name: "cloudflare-d1",
46
+ config: { binding: "DB" },
47
+ },
48
+ auth: { name: "better-auth", config: {} },
49
+ },
50
+ });
51
+ ```
52
+
53
+ ### Example Feature (todos.ts)
54
+
55
+ The template includes a `todos` feature with all four security pillars configured:
56
+
57
+ ```typescript
58
+ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
59
+ import { defineTable } from "@quickback/compiler";
60
+
61
+ export const todos = sqliteTable("todos", {
62
+ id: text("id").primaryKey(),
63
+ title: text("title").notNull(),
64
+ description: text("description"),
65
+ completed: integer("completed", { mode: "boolean" }).default(false),
66
+ priority: text("priority").default("medium"),
67
+ dueDate: integer("due_date", { mode: "timestamp" }),
68
+ organizationId: text("organization_id").notNull(),
69
+ ownerId: text("owner_id").notNull(),
70
+ });
71
+
72
+ export default defineTable(todos, {
73
+ firewall: [
74
+ { field: 'organizationId', equals: 'ctx.activeOrgId' },
75
+ { field: 'deletedAt', isNull: true },
76
+ ],
77
+ guards: {
78
+ createable: ["title", "description", "completed", "priority", "dueDate"],
79
+ updatable: ["title", "description", "completed", "priority", "dueDate"],
80
+ immutable: ["id", "organizationId", "ownerId"],
81
+ },
82
+ masking: {
83
+ description: {
84
+ type: "redact",
85
+ show: { roles: ["owner", "admin"] },
86
+ },
87
+ },
88
+ read: {
89
+ access: { roles: ["owner", "admin", "member"] },
90
+ },
91
+ crud: {
92
+ create: { access: { roles: ["owner", "admin", "member"] } },
93
+ update: { access: { roles: ["owner", "admin", "member"] } },
94
+ delete: { access: { roles: ["owner", "admin"] }, mode: "soft" },
95
+ },
96
+ });
97
+ ```
98
+
99
+ ## Setup Steps
100
+
101
+ ### 1. Install Dependencies
102
+
103
+ ```bash
104
+ npm install
105
+ ```
106
+
107
+ ### 2. Log In to the Compiler
108
+
109
+ ```bash
110
+ quickback login
111
+ ```
112
+
113
+ ### 3. Compile Your Definitions
114
+
115
+ ```bash
116
+ quickback compile
117
+ ```
118
+
119
+ This sends your definitions to the Quickback compiler and generates the full `src/` directory, migrations, and configuration files.
120
+
121
+ ### 4. Create D1 Databases
122
+
123
+ The Cloudflare template uses **dual database mode** by default — separate databases for auth and application data.
124
+
125
+ ```bash
126
+ # Create the auth database
127
+ npx wrangler d1 create my-app-auth
128
+
129
+ # Create the features database
130
+ npx wrangler d1 create my-app-features
131
+ ```
132
+
133
+ Copy the database IDs from the output and update your `wrangler.toml`:
134
+
135
+ ```toml
136
+ [[d1_databases]]
137
+ binding = "AUTH_DB"
138
+ database_name = "my-app-auth"
139
+ database_id = "paste-auth-id-here"
140
+
141
+ [[d1_databases]]
142
+ binding = "DB"
143
+ database_name = "my-app-features"
144
+ database_id = "paste-features-id-here"
145
+ ```
146
+
147
+ ### 5. Run Migrations (Local)
148
+
149
+ ```bash
150
+ npm run db:migrate:local
151
+ ```
152
+
153
+ This applies migrations to both databases locally.
154
+
155
+ ### 6. Start Development Server
156
+
157
+ ```bash
158
+ npm run dev
159
+ ```
160
+
161
+ Your API is running at `http://localhost:8787`.
162
+
163
+ ## Wrangler Configuration
164
+
165
+ The compiler generates a `wrangler.toml` with all required bindings:
166
+
167
+ ```toml
168
+ name = "my-app"
169
+ main = "src/index.ts"
170
+ compatibility_date = "2025-03-01"
171
+ compatibility_flags = ["nodejs_compat"]
172
+
173
+ [observability]
174
+ enabled = true
175
+
176
+ [placement]
177
+ mode = "smart"
178
+
179
+ # Auth database
180
+ [[d1_databases]]
181
+ binding = "AUTH_DB"
182
+ database_name = "my-app-auth"
183
+ database_id = "your-auth-db-id"
184
+
185
+ # Features database
186
+ [[d1_databases]]
187
+ binding = "DB"
188
+ database_name = "my-app-features"
189
+ database_id = "your-features-db-id"
190
+
191
+ # Key-value storage
192
+ [[kv_namespaces]]
193
+ binding = "KV"
194
+ id = "your-kv-id"
195
+ ```
196
+
197
+ ### Optional Bindings
198
+
199
+ Depending on your configuration, the compiler may also generate bindings for:
200
+
201
+ | Binding | Type | When Generated |
202
+ |---------|------|----------------|
203
+ | `R2_BUCKET` | R2 Bucket | `fileStorage` configured |
204
+ | `AI` | Workers AI | `embeddings` configured on any feature |
205
+ | `VECTORIZE` | Vectorize Index | `embeddings` configured |
206
+ | `EMBEDDINGS_QUEUE` | Queue | `embeddings` configured |
207
+ | `WEBHOOKS_DB` | D1 | Webhooks enabled |
208
+ | `WEBHOOKS_QUEUE` | Queue | Webhooks enabled |
209
+ | `BROADCASTER` | Service | `realtime` configured |
210
+
211
+ ## Dual Database Mode
212
+
213
+ By default, the Cloudflare template separates auth tables from application tables:
214
+
215
+ - **`AUTH_DB`** — Better Auth tables (`users`, `sessions`, `accounts`, `organizations`, `members`)
216
+ - **`DB`** — Your feature tables (`todos`, etc.)
217
+
218
+ This keeps auth data isolated and allows independent scaling. Each database gets its own migration directory:
219
+
220
+ ```
221
+ quickback/drizzle/
222
+ ├── auth/ # Auth migrations
223
+ │ ├── meta/
224
+ │ └── 0000_*.sql
225
+ └── features/ # Feature migrations
226
+ ├── meta/
227
+ └── 0000_*.sql
228
+ ```
229
+
230
+ ## Deploying to Production
231
+
232
+ ### 1. Apply Remote Migrations
233
+
234
+ ```bash
235
+ npm run db:migrate:remote
236
+ ```
237
+
238
+ ### 2. Deploy to Cloudflare
239
+
240
+ ```bash
241
+ npm run deploy
242
+ ```
243
+
244
+ This runs `wrangler deploy` to push your worker to Cloudflare's edge network.
245
+
246
+ ## Available Scripts
247
+
248
+ | Script | Command | Description |
249
+ |--------|---------|-------------|
250
+ | `dev` | `wrangler dev` | Start local dev server |
251
+ | `deploy` | `npm run db:migrate:remote && wrangler deploy` | Deploy to production |
252
+ | `db:migrate:local` | Runs auth + features migrations locally | Apply migrations to local D1 |
253
+ | `db:migrate:remote` | Runs auth + features migrations remotely | Apply migrations to production D1 |
254
+
255
+ ## Next Steps
256
+
257
+ - [Add a new feature](/compiler/definitions/schema) — Define your own tables with security
258
+ - [Configure access control](/compiler/definitions/access) — Set role-based permissions
259
+ - [Add custom actions](/compiler/definitions/actions) — Business logic beyond CRUD
260
+ - [Environment variables](/compiler/config/variables) — Configure secrets and bindings
@@ -0,0 +1,112 @@
1
+ # Empty Scaffolding Templates
2
+
3
+ The `empty` template creates a project with only the configuration file — no example features. Use this when you know exactly what you want to build and don't need starter code.
4
+
5
+ ## Available Empty Templates
6
+
7
+ | Template | Runtime | Database | Command |
8
+ |----------|---------|----------|---------|
9
+ | `empty` | Cloudflare Workers | D1 | `quickback create empty my-app` |
10
+
11
+ Alias: `quickback create scaffold my-app` (same as `empty`)
12
+
13
+ ## Create the Project
14
+
15
+ ```bash
16
+ quickback create empty my-app
17
+ ```
18
+
19
+ This scaffolds a minimal project:
20
+
21
+ ```
22
+ my-app/
23
+ ├── quickback/
24
+ │ ├── quickback.config.ts # Compiler configuration
25
+ │ └── features/ # Empty — add your own
26
+ ├── package.json
27
+ └── tsconfig.json
28
+ ```
29
+
30
+ ## Generated Configuration
31
+
32
+ ```typescript
33
+ export default {
34
+ name: "my-app",
35
+ template: "hono",
36
+ features: {
37
+ organizations: true,
38
+ },
39
+ providers: {
40
+ runtime: { name: "cloudflare", config: {} },
41
+ database: {
42
+ name: "cloudflare-d1",
43
+ config: { binding: "DB" },
44
+ },
45
+ auth: { name: "better-auth", config: {} },
46
+ },
47
+ };
48
+ ```
49
+
50
+ Multi-tenant mode (`organizations: true`) is the default. Change to `organizations: false` for [single-tenant mode](/compiler/config/single-tenant).
51
+
52
+ ## Adding Your First Feature
53
+
54
+ Create a feature directory with a schema file:
55
+
56
+ ```bash
57
+ mkdir -p quickback/features/products
58
+ ```
59
+
60
+ ```typescript
61
+ // quickback/features/products/products.ts
62
+ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
63
+ import { defineTable } from "@quickback/compiler";
64
+
65
+ export const products = sqliteTable("products", {
66
+ id: text("id").primaryKey(),
67
+ name: text("name").notNull(),
68
+ description: text("description"),
69
+ price: integer("price").notNull(),
70
+ organizationId: text("organization_id").notNull(),
71
+ userId: text("user_id").notNull(),
72
+ });
73
+
74
+ export default defineTable(products, {
75
+ firewall: {
76
+ organization: {},
77
+ owner: { mode: "optional" },
78
+ softDelete: {},
79
+ },
80
+ guards: {
81
+ createable: ["name", "description", "price"],
82
+ updatable: ["name", "description", "price"],
83
+ },
84
+ read: {
85
+ access: { roles: ["member+"] },
86
+ },
87
+ crud: {
88
+ create: { access: { roles: ["member+"] } },
89
+ update: { access: { roles: ["member+"] } },
90
+ delete: { access: { roles: ["admin+"] }, mode: "soft" },
91
+ },
92
+ });
93
+ ```
94
+
95
+ Then compile:
96
+
97
+ ```bash
98
+ quickback login # First time only
99
+ quickback compile
100
+ ```
101
+
102
+ ## Setup Steps
103
+
104
+ Follow the same setup steps as the [Cloudflare template](/compiler/getting-started/template-cloudflare#setup-steps). The only difference is you'll need to add at least one feature before compiling.
105
+
106
+ ## Next Steps
107
+
108
+ - [Schema Definitions](/compiler/definitions/schema) — Define tables with Drizzle ORM
109
+ - [Firewall](/compiler/definitions/firewall) — Data isolation and tenant scoping
110
+ - [Access Control](/compiler/definitions/access) — Role-based permissions
111
+ - [Guards](/compiler/definitions/guards) — Field-level write protection
112
+ - [Full Example](/compiler/getting-started/full-example) — Complete feature walkthrough
@@ -0,0 +1,111 @@
1
+ # Templates
2
+
3
+ Quickback provides pre-configured templates to get you started quickly. Each template combines a runtime, database, and auth provider into a working project.
4
+
5
+ ## Available Templates
6
+
7
+ ### Full-Featured Templates
8
+
9
+ These templates include an example feature (todos) with full security configuration.
10
+
11
+ | Template | Runtime | Database | Auth | Tenant | Command |
12
+ |----------|---------|----------|------|--------|---------|
13
+ | `cloudflare` | Cloudflare Workers | D1 (SQLite) | Better Auth | Multi-tenant | `quickback create cloudflare my-app` |
14
+ | `multi-tenant` | Cloudflare Workers | D1 (SQLite) | Better Auth | Multi-tenant + orgs | `quickback create multi-tenant my-app` |
15
+
16
+ ### Starter Templates
17
+
18
+ Purpose-built templates with opinionated defaults for common use cases.
19
+
20
+ | Template | Runtime | Database | Tenant | Command |
21
+ |----------|---------|----------|--------|---------|
22
+ | `blog` | Cloudflare Workers | D1 | Single-tenant | `quickback create blog my-site` |
23
+
24
+ The **blog** template creates a single-tenant blog/CMS backend with:
25
+ - Public read access (no auth required for `list` and `get`)
26
+ - Admin-only write access (create, update, delete, publish/unpublish)
27
+ - A `posts` feature with title, slug, content, status, and publish date
28
+ - [Single-tenant mode](/compiler/config/single-tenant) (`organizations: false`)
29
+
30
+ ### Empty Scaffolding
31
+
32
+ Start from scratch with just the config file — no example features. Add your own definitions.
33
+
34
+ | Template | Runtime | Database | Command |
35
+ |----------|---------|----------|---------|
36
+ | `empty` | Cloudflare Workers | D1 | `quickback create empty my-app` |
37
+
38
+ These create the project structure with `quickback.config.ts` only — no `features/` directory. Run `quickback init` inside the project to scaffold your first feature.
39
+
40
+ ## What Each Template Includes
41
+
42
+ Full-featured and starter templates scaffold a complete project with:
43
+
44
+ - **`quickback.config.ts`** — Pre-configured with the right providers
45
+ - **`quickback/features/`** — Example feature(s) with security configuration
46
+ - **Deployment scripts** — `npm run deploy` for Cloudflare, `npm start` for Bun
47
+
48
+ Empty templates include only:
49
+
50
+ - **`quickback.config.ts`** — Pre-configured with the right providers
51
+ - **`package.json`** — Dependencies ready to install
52
+
53
+ ## Choosing a Template
54
+
55
+ ### Cloudflare (Recommended for Production)
56
+
57
+ Best for production deployments. Runs on Cloudflare's global edge network with zero cold starts. Includes D1 (SQLite at the edge), KV storage, and R2 file storage.
58
+
59
+ - Free tier available (Workers free plan)
60
+ - Global edge deployment
61
+ - Built-in KV, R2, Queues, Vectorize
62
+ - Dual database mode (separate auth and features DBs)
63
+
64
+ ### Blog (Single-Tenant CMS)
65
+
66
+ Best for personal sites, blogs, or any app with a single tenant. Uses [single-tenant mode](/compiler/config/single-tenant) — no organizations, roles come from `user.role`.
67
+
68
+ - Public JSON API for content
69
+ - Admin-only editing via Better Auth admin plugin
70
+ - Pair with any frontend (Astro, Next.js, SvelteKit, etc.)
71
+
72
+ ### Empty (Start from Scratch)
73
+
74
+ Best when you know exactly what you want to build. Gets you the project structure and config without any opinionated features.
75
+
76
+ - Config-only scaffolding
77
+ - Cloudflare Workers + D1 runtime
78
+ - Add features with `quickback init` or by hand
79
+
80
+ ## Template Aliases
81
+
82
+ For convenience, templates have short aliases:
83
+
84
+ | Alias | Template |
85
+ |-------|----------|
86
+ | `cf` | `betterauth-d1-cloudflare` |
87
+ | `saas` | `b2bsaas-cloudflare` |
88
+ | `scaffold` | `empty-cloudflare` |
89
+
90
+ ## After Creating a Project
91
+
92
+ ```bash
93
+ # 1. Create the project
94
+ quickback create cloudflare my-app
95
+ cd my-app
96
+
97
+ # 2. Log in to the compiler
98
+ quickback login
99
+
100
+ # 3. Compile your definitions
101
+ quickback compile
102
+
103
+ # 4. Run locally
104
+ npm run dev
105
+ ```
106
+
107
+ See the individual template guides for detailed setup:
108
+ - [Cloudflare Template](/compiler/getting-started/template-cloudflare)
109
+ - [Blog Template](/compiler/getting-started/template-blog)
110
+ - [Empty Scaffolding](/compiler/getting-started/template-empty)
111
+ - [Single-Tenant Mode](/compiler/config/single-tenant)
@@ -0,0 +1,85 @@
1
+ # Quickback Compiler
2
+
3
+ The **Quickback Compiler** is the build tool at the center of Quickback. You write declarative definitions in TypeScript — schema, security rules, validation, custom actions — and the compiler emits production-ready output for your chosen target.
4
+
5
+ ```
6
+ defineTable() ─┐ ┌─► Hono API (Cloudflare D1 / Neon)
7
+ ├─► quickback compile┤
8
+ defineActions()─┘ └─► RLS policies (Supabase)
9
+ ```
10
+
11
+ The same definitions, the same DSL — pick the target that fits where you're deploying.
12
+
13
+ ## What the compiler does
14
+
15
+ When you run `quickback compile`, it:
16
+
17
+ 1. **Reads your definitions** — every `defineTable()`, `defineActions()`, and `defineConfig()` in your project
18
+ 2. **Validates security** — firewall, access, guards, and masking are checked for consistency
19
+ 3. **Generates target output** — Hono routes + middleware + types + OpenAPI + MCP, or RLS migrations + helper functions
20
+ 4. **Emits database migrations** — runs `drizzle-kit generate` for schema changes
21
+
22
+ ```
23
+ quickback/
24
+ ├── quickback.config.ts # Compiler configuration (target + providers)
25
+ └── features/
26
+ └── jobs/
27
+ ├── jobs.ts # defineTable(...)
28
+ └── actions.ts # defineActions(...)
29
+ ```
30
+
31
+ ## Two compile targets
32
+
33
+ ### [Quickback for Hono API](/compiler/targets/hono-api)
34
+
35
+ Generates a complete Hono application: routes, middleware, types, OpenAPI spec, MCP server. Pair with **Cloudflare D1** for SQLite-at-the-edge or **Neon** for full PostgreSQL with database-level RLS.
36
+
37
+ ```typescript
38
+ providers: {
39
+ runtime: defineRuntime('cloudflare'),
40
+ database: defineDatabase('cloudflare-d1'),
41
+ auth: defineAuth('better-auth'),
42
+ }
43
+ ```
44
+
45
+ ### [Quickback for Supabase](/compiler/targets/supabase-rls)
46
+
47
+ Generates PostgreSQL Row Level Security policies for Supabase. Keep Supabase Auth, Storage, and Realtime — Quickback adds the security layer beneath your existing app code.
48
+
49
+ ```typescript
50
+ providers: {
51
+ runtime: defineRuntime('supabase'),
52
+ database: defineDatabase('supabase'),
53
+ auth: defineAuth('supabase-auth'),
54
+ }
55
+ ```
56
+
57
+ ## The shared core
58
+
59
+ Whichever target you pick, the **input language is the same**:
60
+
61
+ - **[Definitions](/compiler/definitions)** — Schema, Firewall, Access, Guards, Masking, Views, Actions
62
+ - **[Configuration](/compiler/config)** — `quickback.config.ts`, providers, domains, bindings
63
+ - **[Getting Started](/compiler/getting-started)** — Templates and full examples
64
+
65
+ ## The cloud and the CLI
66
+
67
+ You don't run the compiler binary locally — it runs as a hosted service:
68
+
69
+ - **[Cloud Compiler](/compiler/cloud-compiler)** — `compiler.quickback.dev`, CLI, authentication, MCP server for editors
70
+ - **[Claude Code Skill](/compiler/claude-code-skill)** — AI-powered authoring assistance
71
+
72
+ ## Development workflow
73
+
74
+ 1. **Define resources** in `quickback/features/`
75
+ 2. **Compile** with `quickback compile`
76
+ 3. **Apply migrations** for your provider
77
+ 4. **Test locally** with `npm run dev`
78
+ 5. **Deploy** with `npm run deploy` (Hono target) or `supabase db push` (Supabase target)
79
+
80
+ ## Next steps
81
+
82
+ - [Getting Started](/compiler/getting-started) — Create your first project
83
+ - [Definitions](/compiler/definitions) — The shared DSL
84
+ - [Quickback for Hono API](/compiler/targets/hono-api) — Compile to a Hono app
85
+ - [Quickback for Supabase](/compiler/targets/supabase-rls) — Compile to RLS policies
@@ -0,0 +1,94 @@
1
+ # Cloudflare Workers
2
+
3
+ The Cloudflare target generates a complete Hono-based API running on Cloudflare Workers with D1 as the database. This is the recommended target for production deployments.
4
+
5
+ ## Configuration
6
+
7
+ ```typescript
8
+ import { defineConfig, defineRuntime, defineDatabase, defineAuth } from "@quickback/compiler";
9
+
10
+ export default defineConfig({
11
+ name: "my-app",
12
+ template: "hono",
13
+ features: ["organizations"],
14
+ providers: {
15
+ runtime: defineRuntime("cloudflare"),
16
+ database: defineDatabase("cloudflare-d1"),
17
+ auth: defineAuth("better-auth"),
18
+ },
19
+ });
20
+ ```
21
+
22
+ ## Generated Output
23
+
24
+ ```
25
+ src/
26
+ ├── routes/ # Hono route handlers (one per resource)
27
+ ├── middleware/ # Auth, firewall, access middleware
28
+ ├── features/ # Feature-specific helpers (security, masking)
29
+ ├── types/ # TypeScript interfaces
30
+ ├── db/
31
+ │ └── schema.ts # Drizzle schema
32
+ └── index.ts # Hono app entry point
33
+
34
+ quickback/drizzle/
35
+ ├── migrations/ # SQL migration files
36
+ └── meta/ # Drizzle metadata
37
+ ```
38
+
39
+ ## Security Model
40
+
41
+ All four security layers run at the application level:
42
+
43
+ 1. **Firewall** — Drizzle WHERE clauses for data isolation
44
+ 2. **Access** — Role checks in middleware
45
+ 3. **Guards** — Field filtering in request handlers
46
+ 4. **Masking** — Response transformation before sending
47
+
48
+ Since D1 is only accessible through your Worker (no external connection string), the application layer is the only entry point. See [D1 Security Architecture](/compiler/targets/hono-api/database/d1#security-architecture) for details.
49
+
50
+ ## Features
51
+
52
+ - Full CRUD with batch operations (create, update, delete, upsert)
53
+ - Custom actions with inline or handler-based execution
54
+ - Soft delete with cascading to child tables
55
+ - Pagination, filtering, sorting, field selection, and full-text search
56
+ - Views (column-level projections with per-view access control)
57
+ - OpenAPI specification generation at `/openapi.json`
58
+
59
+ ## Deployment
60
+
61
+ ```bash
62
+ # Local development
63
+ npm run dev
64
+
65
+ # Apply migrations to remote D1
66
+ npm run db:migrate:remote
67
+
68
+ # Deploy to Cloudflare Workers
69
+ npm run deploy
70
+ ```
71
+
72
+ ## Environment & Bindings
73
+
74
+ Your `wrangler.toml` needs these bindings:
75
+
76
+ | Binding | Type | Required | Purpose |
77
+ |---------|------|----------|---------|
78
+ | `DB` | D1 | Yes | Feature database |
79
+ | `AUTH_DB` | D1 | Yes | Better Auth database |
80
+ | `AUDIT_DB` | D1 | No* | Unsafe cross-tenant action audit logs |
81
+ | `KV` | KV | Yes | Session storage |
82
+ | `R2` | R2 | No | File storage (avatars, uploads) |
83
+ | `AI` | Workers AI | No | Embeddings generation |
84
+ | `VECTORIZE` | Vectorize | No | Vector search index |
85
+ | `BROADCASTER` | Durable Object | No | Realtime broadcasts (inline DO) |
86
+
87
+ \* Required when you define cross-tenant unsafe actions.
88
+
89
+ ## See Also
90
+
91
+ - [Cloudflare Template](/compiler/getting-started/template-cloudflare) — Step-by-step setup guide with full wrangler.toml configuration
92
+ - [D1 Database](/compiler/targets/hono-api/database/d1) — D1 setup, multi-database pattern, and security architecture
93
+ - [Neon Integration](/compiler/targets/hono-api/database/neon) — Alternative: PostgreSQL with RLS
94
+ - [Supabase Integration](/compiler/targets/supabase-rls) — Alternative: Supabase with RLS