@kardoe/quickback 0.5.16 → 0.6.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.
- package/dist/commands/cursor.d.ts +11 -0
- package/dist/commands/cursor.d.ts.map +1 -0
- package/dist/commands/cursor.js +156 -0
- package/dist/commands/cursor.js.map +1 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +27 -3
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/mcp.d.ts +21 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +330 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/cursor/quickback.mdc +235 -0
- package/dist/docs/content.js +8 -8
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +5 -7
- package/dist/lib/api-client.js.map +1 -1
- package/dist/skill/SKILL.md +629 -0
- package/dist/skill/agents/quickback-specialist/AGENT.md +220 -0
- package/dist/skill/skill/SKILL.md +629 -0
- package/dist/skill/skill/agents/quickback-specialist/AGENT.md +220 -0
- package/package.json +9 -4
- package/src/cursor/quickback.mdc +235 -0
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quickback
|
|
3
|
+
description: Quickback API engine documentation - use when working with Quickback projects, defining resources, schemas, security pillars (Firewall, Access, Guards, Masking), actions, webhooks, or deployment
|
|
4
|
+
allowed-tools: Read, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Quickback
|
|
8
|
+
|
|
9
|
+
Quickback is two things:
|
|
10
|
+
|
|
11
|
+
1. **Compiler** — Transforms declarative TypeScript definitions into secure, production-ready APIs
|
|
12
|
+
2. **Stack** — A Supabase alternative running entirely on Cloudflare (D1, R2, KV, Durable Objects, Queues, Workers AI)
|
|
13
|
+
|
|
14
|
+
The output is standard TypeScript (Hono, Drizzle, Better Auth) running on your own infrastructure. Not a managed platform — real code you own and control.
|
|
15
|
+
|
|
16
|
+
## Accessing Documentation
|
|
17
|
+
|
|
18
|
+
The fastest way to look up detailed docs is via the CLI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
quickback docs # List all available topics
|
|
22
|
+
quickback docs <topic> # Show docs for a specific topic
|
|
23
|
+
quickback docs firewall # Example: firewall docs
|
|
24
|
+
quickback docs cms/record-layouts # Example: CMS record layouts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Full online docs: https://docs.quickback.dev
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# PART 1: THE COMPILER
|
|
32
|
+
|
|
33
|
+
The compiler takes your TypeScript definitions and generates API routes, middleware, migrations, typed SDKs, OpenAPI specs, and AI tool definitions.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
┌─────────────────────────────────────────────────────────┐
|
|
37
|
+
│ YOU DEFINE (in TypeScript) │
|
|
38
|
+
│ • Drizzle schema (your data models) │
|
|
39
|
+
│ • Security layers (Firewall, Access, Guards, Masking) │
|
|
40
|
+
│ • Views, Validation, Layouts │
|
|
41
|
+
│ • Actions (your business operations) │
|
|
42
|
+
├─────────────────────────────────────────────────────────┤
|
|
43
|
+
│ QUICKBACK COMPILES TO │
|
|
44
|
+
│ • Database migrations (via Drizzle) │
|
|
45
|
+
│ • API route handlers (Hono) │
|
|
46
|
+
│ • Typed client SDK for your frontend │
|
|
47
|
+
│ • AI tool definitions │
|
|
48
|
+
│ • OpenAPI specification │
|
|
49
|
+
└─────────────────────────────────────────────────────────┘
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Project Structure
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
my-app/
|
|
56
|
+
├── quickback/
|
|
57
|
+
│ ├── quickback.config.ts
|
|
58
|
+
│ └── features/
|
|
59
|
+
│ └── {feature-name}/
|
|
60
|
+
│ ├── {table}.ts # Schema + security (defineTable)
|
|
61
|
+
│ ├── actions.ts # Custom actions (optional)
|
|
62
|
+
│ └── handlers/ # Action handlers (optional)
|
|
63
|
+
└── ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## quickback.config.ts
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { defineConfig, defineRuntime, defineDatabase, defineAuth } from '@quickback/compiler';
|
|
70
|
+
|
|
71
|
+
export default defineConfig({
|
|
72
|
+
name: "my-saas-app",
|
|
73
|
+
providers: {
|
|
74
|
+
runtime: defineRuntime("cloudflare"),
|
|
75
|
+
database: defineDatabase("cloudflare-d1"),
|
|
76
|
+
auth: defineAuth("better-auth"),
|
|
77
|
+
},
|
|
78
|
+
build: {
|
|
79
|
+
outputDir: "dist",
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Compile Output and State Artifacts
|
|
85
|
+
|
|
86
|
+
- Runtime code stays in `build.outputDir` (e.g. `src/`, `wrangler.toml`, `package.json`)
|
|
87
|
+
- Drizzle migration/state artifacts are written to `quickback/drizzle/...`
|
|
88
|
+
- Security contract reports are written to `quickback/reports/...`
|
|
89
|
+
|
|
90
|
+
## Automatic Audit Fields
|
|
91
|
+
|
|
92
|
+
Quickback automatically injects these fields into every table:
|
|
93
|
+
- `createdAt`, `modifiedAt`, `deletedAt` (timestamps)
|
|
94
|
+
- `createdBy`, `modifiedBy`, `deletedBy` (user IDs)
|
|
95
|
+
|
|
96
|
+
**Do NOT add these to your schema files.** They are auto-injected by the compiler.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Feature Definitions
|
|
101
|
+
|
|
102
|
+
Features live in `quickback/features/{name}/` with one file per table using `defineTable()`.
|
|
103
|
+
|
|
104
|
+
### Example: todos.ts
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
108
|
+
import { defineTable } from "@quickback/compiler";
|
|
109
|
+
|
|
110
|
+
export const todos = sqliteTable("todos", {
|
|
111
|
+
id: integer("id").primaryKey(),
|
|
112
|
+
title: text("title").notNull(),
|
|
113
|
+
description: text("description"),
|
|
114
|
+
completed: integer("completed", { mode: "boolean" }).default(false),
|
|
115
|
+
userId: text("user_id").notNull(),
|
|
116
|
+
organizationId: text("organization_id").notNull(),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export default defineTable(todos, {
|
|
120
|
+
firewall: {
|
|
121
|
+
organization: {},
|
|
122
|
+
owner: {},
|
|
123
|
+
},
|
|
124
|
+
crud: {
|
|
125
|
+
list: { access: { roles: ["member", "admin"] } },
|
|
126
|
+
get: { access: { roles: ["member", "admin"] } },
|
|
127
|
+
create: { access: { roles: ["member", "admin"] } },
|
|
128
|
+
update: { access: { roles: ["admin"] } },
|
|
129
|
+
delete: { access: { roles: ["admin"] }, mode: "soft" },
|
|
130
|
+
},
|
|
131
|
+
guards: {
|
|
132
|
+
createable: ["title", "description", "completed"],
|
|
133
|
+
updatable: ["title", "description", "completed"],
|
|
134
|
+
},
|
|
135
|
+
masking: {
|
|
136
|
+
userId: { type: "redact", show: { roles: ["admin"] } },
|
|
137
|
+
},
|
|
138
|
+
layouts: {
|
|
139
|
+
default: {
|
|
140
|
+
sections: [
|
|
141
|
+
{ label: "Details", columns: 2, fields: ["title", "completed"] },
|
|
142
|
+
{ label: "Audit", collapsed: true, fields: ["userId"] },
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Internal/Junction Tables (No API)
|
|
150
|
+
|
|
151
|
+
Tables without a `defineTable()` default export get no API routes:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
export const roomAmenities = sqliteTable('room_amenities', {
|
|
155
|
+
roomId: text('room_id').notNull(),
|
|
156
|
+
amenityId: text('amenity_id').notNull(),
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Four Security Layers
|
|
163
|
+
|
|
164
|
+
Every API request passes through four layers in order:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Request → Firewall → Access → Guards → Database → Masking → Response
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
| Layer | Purpose | Failure |
|
|
171
|
+
|-------|---------|---------|
|
|
172
|
+
| **Firewall** | Tenant isolation via automatic WHERE clauses | 404 |
|
|
173
|
+
| **Access** | Role-based CRUD permissions (deny by default) | 403 |
|
|
174
|
+
| **Guards** | Field modification rules (protected/immutable fields) | 400 |
|
|
175
|
+
| **Masking** | PII redaction for unauthorized viewers | — |
|
|
176
|
+
|
|
177
|
+
### 1. Firewall — Data Isolation
|
|
178
|
+
|
|
179
|
+
Compiles WHERE clauses to isolate data by ownership. Auto-detects column names.
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
firewall: {
|
|
183
|
+
organization: {}, // WHERE organizationId = ctx.activeOrgId
|
|
184
|
+
owner: { mode: 'optional' }, // AND (ownerId = ctx.userId OR ownerId IS NULL)
|
|
185
|
+
team: {}, // WHERE teamId = ctx.activeTeamId
|
|
186
|
+
softDelete: {}, // AND deletedAt IS NULL
|
|
187
|
+
exception: true, // No filtering (public resources)
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Auto-detection:
|
|
192
|
+
- `organization` → looks for `organizationId` or `organization_id`
|
|
193
|
+
- `owner` → looks for `userId` or `user_id`
|
|
194
|
+
- `team` → looks for `teamId` or `team_id`
|
|
195
|
+
|
|
196
|
+
Column overrides:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
firewall: {
|
|
200
|
+
organization: {
|
|
201
|
+
column: 'tenant_id',
|
|
202
|
+
source: 'ctx.tenant.id',
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Owner modes: default = strict (only own records), `optional` = own + NULL owner (admin pattern).
|
|
208
|
+
|
|
209
|
+
### 2. Access — Permission Checks
|
|
210
|
+
|
|
211
|
+
Role-based and record-based access control. Deny by default.
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
crud: {
|
|
215
|
+
list: { access: { roles: ['member'] } },
|
|
216
|
+
get: { access: { roles: ['member'] } },
|
|
217
|
+
create: { access: { roles: ['admin', 'manager'] } },
|
|
218
|
+
update: {
|
|
219
|
+
access: {
|
|
220
|
+
or: [
|
|
221
|
+
{ roles: ['admin'] },
|
|
222
|
+
{ record: { createdBy: { equals: '$ctx.userId' } } },
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
delete: { access: { roles: ['admin'] } },
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Record condition operators: `equals`, `notEquals`, `in`, `notIn`, `greaterThan`, `lessThan`
|
|
231
|
+
|
|
232
|
+
Context variables: `$ctx.userId`, `$ctx.activeOrgId`, `$ctx.activeTeamId`, `$ctx.roles`, `$ctx.isAnonymous`
|
|
233
|
+
|
|
234
|
+
### 3. Guards — Field Protection
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
guards: {
|
|
238
|
+
createable: ['name', 'description'], // Allowed on POST
|
|
239
|
+
updatable: ['description'], // Allowed on PATCH
|
|
240
|
+
immutable: ['invoiceNumber'], // Set once, never change
|
|
241
|
+
protected: { status: ['approve'] }, // Only via named actions
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
System-managed fields (always protected): `createdAt`, `createdBy`, `modifiedAt`, `modifiedBy`, `deletedAt`, `deletedBy`
|
|
246
|
+
|
|
247
|
+
PUT/Upsert requires both `generateId: false` and `guards: false`.
|
|
248
|
+
|
|
249
|
+
### 4. Masking — PII Redaction
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
masking: {
|
|
253
|
+
ssn: { type: 'ssn', show: { roles: ['admin', 'hr'] } },
|
|
254
|
+
email: { type: 'email', show: { roles: ['admin'], or: 'owner' } },
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Mask types: `email`, `phone`, `ssn`, `creditCard`, `name`, `redact`, `custom`
|
|
259
|
+
|
|
260
|
+
Auto-detection warns on unmasked sensitive columns (`email`, `phone`, `ssn`, `password`, etc.).
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Views — Column-Level Security
|
|
265
|
+
|
|
266
|
+
Named projections that control which fields are visible based on role.
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
views: {
|
|
270
|
+
summary: {
|
|
271
|
+
fields: ['id', 'name', 'email'],
|
|
272
|
+
access: { roles: ['member', 'admin'] },
|
|
273
|
+
},
|
|
274
|
+
full: {
|
|
275
|
+
fields: ['id', 'name', 'email', 'phone', 'ssn', 'address'],
|
|
276
|
+
access: { roles: ['admin'] },
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Generated endpoints: `GET /api/v1/{resource}/views/{viewName}`
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Validation
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
validation: {
|
|
289
|
+
name: { minLength: 1, maxLength: 100 },
|
|
290
|
+
capacity: { min: 1, max: 1000 },
|
|
291
|
+
roomType: { enum: ['meeting', 'conference', 'breakout'] },
|
|
292
|
+
email: { email: true },
|
|
293
|
+
code: { pattern: '^[A-Z]{3}$' },
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## CMS Record Layouts
|
|
300
|
+
|
|
301
|
+
Control how fields are grouped on the CMS record detail page.
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
layouts: {
|
|
305
|
+
default: {
|
|
306
|
+
sections: [
|
|
307
|
+
{ label: "Contact Info", columns: 2, fields: ["name", "email", "phone"] },
|
|
308
|
+
{ label: "Notes", collapsed: true, fields: ["notes", "internalNotes"] },
|
|
309
|
+
],
|
|
310
|
+
},
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Section options: `label` (string), `fields` (string[]), `columns` (1|2, default 1), `collapsed` (boolean, default false). Unassigned fields go to "Other Fields".
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Actions — Custom Business Logic
|
|
319
|
+
|
|
320
|
+
Defined in a separate `actions.ts` file using `defineActions()`.
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
import { todos } from './todos';
|
|
324
|
+
import { defineActions } from '@quickback/compiler';
|
|
325
|
+
import { z } from 'zod';
|
|
326
|
+
|
|
327
|
+
export default defineActions(todos, {
|
|
328
|
+
complete: {
|
|
329
|
+
description: "Mark todo as complete",
|
|
330
|
+
input: z.object({ completedAt: z.string().datetime().optional() }),
|
|
331
|
+
guard: { roles: ["member", "admin"], record: { completed: { equals: false } } },
|
|
332
|
+
execute: async ({ db, record, ctx, input }) => {
|
|
333
|
+
await db.update(todos).set({ completed: true }).where(eq(todos.id, record.id));
|
|
334
|
+
return { success: true };
|
|
335
|
+
},
|
|
336
|
+
sideEffects: "sync",
|
|
337
|
+
},
|
|
338
|
+
archive: {
|
|
339
|
+
description: "Archive a todo",
|
|
340
|
+
input: z.object({}),
|
|
341
|
+
guard: { roles: ["admin"] },
|
|
342
|
+
handler: "./handlers/archive",
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Record-based** (default): `POST /api/v1/{resource}/:id/{action}`
|
|
348
|
+
**Standalone**: `standalone: true`, custom `path` and `method`
|
|
349
|
+
|
|
350
|
+
Action options: `standalone`, `method` (GET/POST/PUT/PATCH/DELETE), `responseType` (json/stream/file), `sideEffects` (sync/async/fire-and-forget)
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## API Reference
|
|
355
|
+
|
|
356
|
+
### CRUD Operations
|
|
357
|
+
|
|
358
|
+
| Method | Endpoint | Description |
|
|
359
|
+
|--------|----------|-------------|
|
|
360
|
+
| `GET` | `/api/v1/{resource}` | List records |
|
|
361
|
+
| `GET` | `/api/v1/{resource}/:id` | Get single record |
|
|
362
|
+
| `POST` | `/api/v1/{resource}` | Create record |
|
|
363
|
+
| `PATCH` | `/api/v1/{resource}/:id` | Update record |
|
|
364
|
+
| `DELETE` | `/api/v1/{resource}/:id` | Delete record |
|
|
365
|
+
| `PUT` | `/api/v1/{resource}/:id` | Upsert (if enabled) |
|
|
366
|
+
|
|
367
|
+
### Batch Operations
|
|
368
|
+
|
|
369
|
+
`POST|PATCH|DELETE|PUT /api/v1/{resource}/batch` with `{ "records": [...], "options": { "atomic": false } }`
|
|
370
|
+
|
|
371
|
+
### Query Parameters
|
|
372
|
+
|
|
373
|
+
| Feature | Syntax |
|
|
374
|
+
|---------|--------|
|
|
375
|
+
| Pagination | `?limit=50&offset=0` (max 100) |
|
|
376
|
+
| Filter | `?status=active`, `?amount.gt=100`, `?status.in=draft,pending` |
|
|
377
|
+
| Sort | `?sort=status,-createdAt` (multi-sort, `-` = desc) |
|
|
378
|
+
| Fields | `?fields=id,name,status` |
|
|
379
|
+
| Total count | `?total=true` |
|
|
380
|
+
| Search | `?search=conference` (OR'd LIKE across text columns) |
|
|
381
|
+
|
|
382
|
+
Filter operators: `.gt`, `.gte`, `.lt`, `.lte`, `.ne`, `.like`, `.in`
|
|
383
|
+
|
|
384
|
+
### Response Format
|
|
385
|
+
|
|
386
|
+
```json
|
|
387
|
+
{
|
|
388
|
+
"data": [{ "id": "...", "title": "Todo 1" }],
|
|
389
|
+
"pagination": { "limit": 10, "offset": 0, "count": 2, "total": 42 }
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Error Responses
|
|
394
|
+
|
|
395
|
+
| Status | Layer | Meaning |
|
|
396
|
+
|--------|-------|---------|
|
|
397
|
+
| `401` | Auth | Invalid/expired session |
|
|
398
|
+
| `403` | Access | Insufficient permissions |
|
|
399
|
+
| `404` | Firewall | Record not found or outside scope |
|
|
400
|
+
| `400` | Guards | Invalid field modification |
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Database Dialects
|
|
405
|
+
|
|
406
|
+
| Stack | Import | Table Function |
|
|
407
|
+
|-------|--------|----------------|
|
|
408
|
+
| Cloudflare D1 / SQLite | `drizzle-orm/sqlite-core` | `sqliteTable` |
|
|
409
|
+
| Supabase / PostgreSQL | `drizzle-orm/pg-core` | `pgTable` |
|
|
410
|
+
| MySQL | `drizzle-orm/mysql-core` | `mysqlTable` |
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
# PART 2: THE QUICKBACK STACK
|
|
415
|
+
|
|
416
|
+
The Quickback Stack is a production-ready backend platform built entirely on Cloudflare's edge infrastructure. It's a Supabase alternative where everything runs on your own Cloudflare account — your data, your infrastructure, global edge performance.
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
┌─────────────────────────────────────────────────────────┐
|
|
420
|
+
│ QUICKBACK STACK ON CLOUDFLARE │
|
|
421
|
+
│ │
|
|
422
|
+
│ Workers — API runtime (Hono) │
|
|
423
|
+
│ D1 — SQLite database at the edge │
|
|
424
|
+
│ R2 — S3-compatible file storage │
|
|
425
|
+
│ KV — Distributed key-value store │
|
|
426
|
+
│ Durable Objects — Realtime WebSockets │
|
|
427
|
+
│ Queues — Background job processing │
|
|
428
|
+
│ Workers AI — Embeddings & vector search │
|
|
429
|
+
│ Better Auth — Authentication & organizations │
|
|
430
|
+
└─────────────────────────────────────────────────────────┘
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## Authentication (Better Auth)
|
|
434
|
+
|
|
435
|
+
Built on Better Auth with multi-tenant organization support.
|
|
436
|
+
|
|
437
|
+
- Email/password, magic links, passkeys, email OTP
|
|
438
|
+
- Three org roles: `owner`, `admin`, `member`
|
|
439
|
+
- Session storage in KV namespace
|
|
440
|
+
- All auth routes at `/auth/v1/*`
|
|
441
|
+
- Extensible via Better Auth plugins
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
// Config
|
|
445
|
+
providers: {
|
|
446
|
+
auth: defineAuth("better-auth"),
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Docs: `quickback docs stack/auth/using-auth` | https://docs.quickback.dev/stack/auth
|
|
451
|
+
|
|
452
|
+
## Database (D1)
|
|
453
|
+
|
|
454
|
+
SQLite at the edge with zero configuration. Multi-database pattern for independent scaling:
|
|
455
|
+
|
|
456
|
+
| Binding | Purpose |
|
|
457
|
+
|---------|---------|
|
|
458
|
+
| `DB` | Application data (features) |
|
|
459
|
+
| `AUTH_DB` | Auth sessions & users |
|
|
460
|
+
| `FILES_DB` | File metadata |
|
|
461
|
+
| `WEBHOOKS_DB` | Webhook tracking |
|
|
462
|
+
|
|
463
|
+
- Drizzle ORM for type-safe queries
|
|
464
|
+
- Auto-generated migrations on compile
|
|
465
|
+
- Application-layer security (firewall, access, guards, masking)
|
|
466
|
+
- Local dev with `.wrangler/state/`
|
|
467
|
+
- Neon Postgres available as alternative
|
|
468
|
+
|
|
469
|
+
```typescript
|
|
470
|
+
providers: {
|
|
471
|
+
database: defineDatabase("cloudflare-d1", {
|
|
472
|
+
splitDatabases: true,
|
|
473
|
+
}),
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Docs: `quickback docs stack/database/d1` | https://docs.quickback.dev/stack/database/d1
|
|
478
|
+
|
|
479
|
+
## File Storage (R2)
|
|
480
|
+
|
|
481
|
+
S3-compatible object storage with built-in access control.
|
|
482
|
+
|
|
483
|
+
- Two-worker architecture: API worker (upload/manage) + Files worker (serve)
|
|
484
|
+
- Bucket-scoped access policies (public, organization, user)
|
|
485
|
+
- File metadata tracked in `FILES_DB`
|
|
486
|
+
- Soft deletes with org-level tenant isolation
|
|
487
|
+
- API at `/storage/v1/*`
|
|
488
|
+
|
|
489
|
+
Docs: `quickback docs stack/storage/r2` | https://docs.quickback.dev/stack/storage/r2
|
|
490
|
+
|
|
491
|
+
## KV Storage
|
|
492
|
+
|
|
493
|
+
Distributed key-value store optimized for reads (300+ edge locations, sub-millisecond).
|
|
494
|
+
|
|
495
|
+
- Use cases: sessions, caching, rate limiting, feature flags
|
|
496
|
+
- Eventually consistent (60 second propagation)
|
|
497
|
+
- TTL/expiration support
|
|
498
|
+
|
|
499
|
+
Docs: `quickback docs stack/storage/kv` | https://docs.quickback.dev/stack/storage/kv
|
|
500
|
+
|
|
501
|
+
## Realtime (Durable Objects)
|
|
502
|
+
|
|
503
|
+
WebSocket connections for live updates via organization-scoped Durable Objects.
|
|
504
|
+
|
|
505
|
+
- CRUD event broadcasting (insert, update, delete)
|
|
506
|
+
- Custom broadcasts and event namespaces
|
|
507
|
+
- Role-based filtering and per-role field masking
|
|
508
|
+
- Session token or API key authentication
|
|
509
|
+
- Type-safe with `defineRealtime()` for custom events
|
|
510
|
+
- Endpoint: `/realtime/v1/websocket`
|
|
511
|
+
|
|
512
|
+
Docs: `quickback docs stack/realtime/durable-objects` | https://docs.quickback.dev/stack/realtime
|
|
513
|
+
|
|
514
|
+
## Queues (Background Processing)
|
|
515
|
+
|
|
516
|
+
Cloudflare Queues for reliable async job processing.
|
|
517
|
+
|
|
518
|
+
| Queue | Purpose |
|
|
519
|
+
|-------|---------|
|
|
520
|
+
| `EMBEDDINGS_QUEUE` | Auto-generate embeddings |
|
|
521
|
+
| `WEBHOOKS_QUEUE` | Webhook delivery |
|
|
522
|
+
| Custom queues | Your background jobs |
|
|
523
|
+
|
|
524
|
+
- Custom handlers via `defineQueue()` in `services/queues/`
|
|
525
|
+
- Auto-retry up to 3 times, max batch 10, 30s timeout
|
|
526
|
+
- Chaining between queues
|
|
527
|
+
|
|
528
|
+
Docs: `quickback docs stack/queues/using-queues` | https://docs.quickback.dev/stack/queues
|
|
529
|
+
|
|
530
|
+
## Vector & Embeddings (Workers AI)
|
|
531
|
+
|
|
532
|
+
Auto-generated embeddings for similarity search and classification.
|
|
533
|
+
|
|
534
|
+
- Table-level config via `embeddings` in `defineTable()`
|
|
535
|
+
- Service-level config via `defineEmbedding()`
|
|
536
|
+
- Default model: `@cf/baai/bge-base-en-v1.5` (768 dimensions)
|
|
537
|
+
- Async processing via `EMBEDDINGS_QUEUE`
|
|
538
|
+
- Vector storage in D1 + optional Vectorize index
|
|
539
|
+
- API: `/api/v1/embeddings`
|
|
540
|
+
|
|
541
|
+
Docs: `quickback docs stack/vector/embeddings` | https://docs.quickback.dev/stack/vector
|
|
542
|
+
|
|
543
|
+
## Webhooks
|
|
544
|
+
|
|
545
|
+
### Inbound (Receiving)
|
|
546
|
+
|
|
547
|
+
Receive events from Stripe, Paddle, GitHub, etc. at `POST /webhooks/v1/inbound/:provider`
|
|
548
|
+
|
|
549
|
+
```typescript
|
|
550
|
+
import { onWebhookEvent } from './lib/webhooks';
|
|
551
|
+
|
|
552
|
+
onWebhookEvent('stripe:checkout.session.completed', async (ctx) => {
|
|
553
|
+
const { data, env } = ctx;
|
|
554
|
+
await createSubscription({ ... });
|
|
555
|
+
});
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Outbound (Sending)
|
|
559
|
+
|
|
560
|
+
Emit signed events when data changes. HMAC-SHA256 signing, async delivery via queue with exponential backoff retry.
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
import { emitWebhookEvent } from './lib/webhooks';
|
|
564
|
+
|
|
565
|
+
await emitWebhookEvent('user.created', { id: user.id, email: user.email }, { organizationId: orgId }, env);
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
Event patterns: `user.*`, `subscription.*`, `organization.*`, `file.*`, `*`
|
|
569
|
+
Endpoint management: `/webhooks/v1/endpoints`
|
|
570
|
+
|
|
571
|
+
Docs: `quickback docs stack/webhooks/outbound` | https://docs.quickback.dev/stack/webhooks
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
# CLI Commands
|
|
576
|
+
|
|
577
|
+
| Command | Description |
|
|
578
|
+
|---------|-------------|
|
|
579
|
+
| `quickback create <template> <name>` | Create project from template |
|
|
580
|
+
| `quickback compile` | Compile definitions to output |
|
|
581
|
+
| `quickback docs [topic]` | Browse built-in documentation |
|
|
582
|
+
| `quickback login` | Authenticate for Pro templates |
|
|
583
|
+
| `quickback logout` | Clear stored credentials |
|
|
584
|
+
| `quickback whoami` | Show current auth status |
|
|
585
|
+
| `quickback claude install` | Install Claude Code skill |
|
|
586
|
+
| `quickback claude update` | Update to latest skill version |
|
|
587
|
+
|
|
588
|
+
## Available Templates
|
|
589
|
+
|
|
590
|
+
| Template | Stack | Status |
|
|
591
|
+
|----------|-------|--------|
|
|
592
|
+
| `cloudflare` | Cloudflare Workers + D1 + Better Auth | Free |
|
|
593
|
+
| `bun` | Bun + SQLite + Better Auth | Free |
|
|
594
|
+
| `turso` | Turso/LibSQL + Better Auth | Pro |
|
|
595
|
+
|
|
596
|
+
## Development Workflow
|
|
597
|
+
|
|
598
|
+
```bash
|
|
599
|
+
quickback create cloudflare my-app # 1. Create project
|
|
600
|
+
# Define features in quickback/features/
|
|
601
|
+
quickback compile # 2. Compile
|
|
602
|
+
cd dist && npm install && npm run dev # 3. Run
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
# Online Documentation
|
|
608
|
+
|
|
609
|
+
- [Getting Started](https://docs.quickback.dev/compiler/getting-started)
|
|
610
|
+
- [Concepts](https://docs.quickback.dev/compiler/definitions/concepts)
|
|
611
|
+
- [Database Schema](https://docs.quickback.dev/compiler/definitions/schema)
|
|
612
|
+
- [Firewall](https://docs.quickback.dev/compiler/definitions/firewall)
|
|
613
|
+
- [Access](https://docs.quickback.dev/compiler/definitions/access)
|
|
614
|
+
- [Guards](https://docs.quickback.dev/compiler/definitions/guards)
|
|
615
|
+
- [Masking](https://docs.quickback.dev/compiler/definitions/masking)
|
|
616
|
+
- [Views](https://docs.quickback.dev/compiler/definitions/views)
|
|
617
|
+
- [Actions](https://docs.quickback.dev/compiler/definitions/actions)
|
|
618
|
+
- [CRUD API](https://docs.quickback.dev/compiler/using-the-api/crud)
|
|
619
|
+
- [Query Parameters](https://docs.quickback.dev/compiler/using-the-api/query-params)
|
|
620
|
+
- [CLI Reference](https://docs.quickback.dev/compiler/cloud-compiler/cli)
|
|
621
|
+
- [Stack Overview](https://docs.quickback.dev/stack)
|
|
622
|
+
- [D1 Database](https://docs.quickback.dev/stack/database/d1)
|
|
623
|
+
- [R2 Storage](https://docs.quickback.dev/stack/storage/r2)
|
|
624
|
+
- [Realtime](https://docs.quickback.dev/stack/realtime)
|
|
625
|
+
- [Queues](https://docs.quickback.dev/stack/queues)
|
|
626
|
+
- [Embeddings](https://docs.quickback.dev/stack/vector)
|
|
627
|
+
- [Webhooks](https://docs.quickback.dev/stack/webhooks)
|
|
628
|
+
- [CMS Overview](https://docs.quickback.dev/cms)
|
|
629
|
+
- [CMS Record Layouts](https://docs.quickback.dev/cms/record-layouts)
|