@quickback-dev/cli 0.17.1 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +17 -1
  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 +28 -63
  6. package/dist/docs/content.js.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/api-client.d.ts +17 -0
  9. package/dist/lib/api-client.d.ts.map +1 -1
  10. package/dist/lib/api-client.js.map +1 -1
  11. package/dist/lib/file-loader.d.ts +24 -0
  12. package/dist/lib/file-loader.d.ts.map +1 -1
  13. package/dist/lib/file-loader.js +46 -0
  14. package/dist/lib/file-loader.js.map +1 -1
  15. package/dist/skill/docs/changelog.md +780 -1174
  16. package/dist/skill/docs/compiler/cloud-compiler/cli.md +54 -33
  17. package/dist/skill/docs/compiler/cloud-compiler/index.md +9 -9
  18. package/dist/skill/docs/compiler/config/domains.md +44 -10
  19. package/dist/skill/docs/compiler/config/output.md +1 -1
  20. package/dist/skill/docs/compiler/config/providers.md +6 -12
  21. package/dist/skill/docs/compiler/config/variables.md +0 -30
  22. package/dist/skill/docs/compiler/definitions/access.md +203 -1
  23. package/dist/skill/docs/compiler/definitions/actions.md +40 -7
  24. package/dist/skill/docs/compiler/definitions/schema.md +6 -10
  25. package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +49 -54
  26. package/dist/skill/docs/compiler/getting-started/templates.md +58 -56
  27. package/dist/skill/docs/compiler/index.md +15 -34
  28. package/dist/skill/docs/compiler/targets/hono-api/cloudflare.md +1 -2
  29. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +0 -1
  30. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +19 -0
  31. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +1 -1
  32. package/dist/skill/docs/compiler/targets/index.md +6 -34
  33. package/dist/skill/docs/index.md +11 -5
  34. package/dist/skill/docs/stack/account-ui/customization.md +2 -14
  35. package/dist/skill/docs/stack/account-ui/environment-variables.md +7 -1
  36. package/dist/skill/docs/stack/account-ui/features/avatars.md +2 -4
  37. package/dist/skill/docs/stack/account-ui/features/index.md +1 -1
  38. package/dist/skill/docs/stack/account-ui/features/organizations.md +31 -11
  39. package/dist/skill/docs/stack/account-ui/index.md +5 -43
  40. package/dist/skill/docs/stack/account-ui/with-quickback.md +2 -75
  41. package/dist/skill/docs/stack/auth/plugins/index.md +74 -0
  42. package/dist/skill/docs/stack/index.md +8 -4
  43. package/package.json +1 -1
  44. package/src/skill/docs/changelog.md +780 -1174
  45. package/src/skill/docs/compiler/cloud-compiler/cli.md +54 -33
  46. package/src/skill/docs/compiler/cloud-compiler/index.md +9 -9
  47. package/src/skill/docs/compiler/config/domains.md +44 -10
  48. package/src/skill/docs/compiler/config/output.md +1 -1
  49. package/src/skill/docs/compiler/config/providers.md +6 -12
  50. package/src/skill/docs/compiler/config/variables.md +0 -30
  51. package/src/skill/docs/compiler/definitions/access.md +203 -1
  52. package/src/skill/docs/compiler/definitions/actions.md +40 -7
  53. package/src/skill/docs/compiler/definitions/schema.md +6 -10
  54. package/src/skill/docs/compiler/getting-started/template-cloudflare.md +49 -54
  55. package/src/skill/docs/compiler/getting-started/templates.md +58 -56
  56. package/src/skill/docs/compiler/index.md +15 -34
  57. package/src/skill/docs/compiler/targets/hono-api/cloudflare.md +1 -2
  58. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +0 -1
  59. package/src/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +19 -0
  60. package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +1 -1
  61. package/src/skill/docs/compiler/targets/index.md +6 -34
  62. package/src/skill/docs/index.md +11 -5
  63. package/src/skill/docs/stack/account-ui/customization.md +2 -14
  64. package/src/skill/docs/stack/account-ui/environment-variables.md +7 -1
  65. package/src/skill/docs/stack/account-ui/features/avatars.md +2 -4
  66. package/src/skill/docs/stack/account-ui/features/index.md +1 -1
  67. package/src/skill/docs/stack/account-ui/features/organizations.md +31 -11
  68. package/src/skill/docs/stack/account-ui/index.md +5 -43
  69. package/src/skill/docs/stack/account-ui/with-quickback.md +2 -75
  70. package/src/skill/docs/stack/auth/plugins/index.md +74 -0
  71. package/src/skill/docs/stack/index.md +8 -4
  72. package/dist/skill/docs/compiler/targets/supabase-rls/index.md +0 -55
  73. package/dist/skill/docs/compiler/targets/supabase-rls/limitations.md +0 -48
  74. package/dist/skill/docs/compiler/targets/supabase-rls/mappings.md +0 -99
  75. package/dist/skill/docs/compiler/targets/supabase-rls/setup.md +0 -88
  76. package/dist/skill/docs/stack/account-ui/library-usage.md +0 -257
  77. package/dist/skill/docs/stack/account-ui/standalone.md +0 -149
  78. package/dist/skill/docs/stack/account-ui/worker.md +0 -362
  79. package/src/skill/docs/compiler/targets/supabase-rls/index.md +0 -55
  80. package/src/skill/docs/compiler/targets/supabase-rls/limitations.md +0 -48
  81. package/src/skill/docs/compiler/targets/supabase-rls/mappings.md +0 -99
  82. package/src/skill/docs/compiler/targets/supabase-rls/setup.md +0 -88
  83. package/src/skill/docs/stack/account-ui/library-usage.md +0 -257
  84. package/src/skill/docs/stack/account-ui/standalone.md +0 -149
  85. package/src/skill/docs/stack/account-ui/worker.md +0 -362
@@ -1,362 +0,0 @@
1
- # Worker Setup
2
-
3
- > **Compiler-Embedded is Recommended**
4
- >
5
- > Most Quickback projects embed Account UI via the compiler (`account: { ... }` in config). The compiler builds the SPA from source with your settings baked in — no manual Worker setup needed. See [With Quickback](/stack/account-ui/with-quickback) for the recommended approach. This page is for standalone deployments where you need a separate Worker.
6
-
7
-
8
- # Worker Setup
9
-
10
- Deploy the Account UI as a Cloudflare Worker with static asset serving.
11
-
12
- ## Quick Start
13
-
14
- ### Using the Template
15
-
16
- ```bash
17
- npx degit Kardoe-com/quickback-better-auth-account-ui my-account-app
18
- cd my-account-app
19
- npm install
20
- ```
21
-
22
- ### Using the Library
23
-
24
- If you're consuming Account UI as an npm package, re-export the worker from the library:
25
-
26
- ```ts title="src/worker.ts"
27
- export { default } from 'quickback-better-auth-account-ui/worker';
28
- ```
29
-
30
- Then continue with the Wrangler configuration below.
31
-
32
- ### 2. Configure Wrangler
33
-
34
- The template includes a `wrangler.toml` pre-configured for Cloudflare Workers:
35
-
36
- ```toml title="wrangler.toml"
37
- name = "my-account-app"
38
- compatibility_date = "2025-01-01"
39
- compatibility_flags = ["nodejs_compat"]
40
-
41
- # Custom domain (uncomment and set your domain)
42
- # routes = [
43
- # { pattern = "account.example.com", custom_domain = true }
44
- # ]
45
-
46
- # Worker entry point
47
- main = "src/worker.ts"
48
-
49
- # Static assets
50
- [assets]
51
- binding = "ASSETS"
52
- directory = "dist/client"
53
- ```
54
-
55
- ### 3. Build and Deploy
56
-
57
- ```bash
58
- npm run build
59
- npx wrangler deploy
60
- ```
61
-
62
- ## Worker Entry Point
63
-
64
- The worker is at `src/worker.ts`. It serves static assets and handles SPA routing:
65
-
66
- - Static asset serving via the `ASSETS` binding
67
- - SPA routing (all routes serve `index.html`)
68
- - Health check endpoint (`/health`)
69
-
70
- ### Custom Worker Logic
71
-
72
- Edit `src/worker.ts` directly to add custom logic:
73
-
74
- ```ts title="src/worker.ts"
75
- export default {
76
- async fetch(request: Request, env: Env): Promise<Response> {
77
- const url = new URL(request.url);
78
-
79
- // Custom health check with more info
80
- if (url.pathname === '/health') {
81
- return new Response(JSON.stringify({
82
- status: 'ok',
83
- app: 'my-account-ui',
84
- version: '1.0.0',
85
- timestamp: new Date().toISOString(),
86
- }), {
87
- headers: { 'Content-Type': 'application/json' }
88
- });
89
- }
90
-
91
- // Custom analytics or logging
92
- console.log(`${request.method} ${url.pathname}`);
93
-
94
- // Try to serve static asset
95
- const assetResponse = await env.ASSETS.fetch(request);
96
-
97
- // If asset found, return it
98
- if (assetResponse.status !== 404) {
99
- return assetResponse;
100
- }
101
-
102
- // SPA routing: serve index.html for all other routes
103
- const indexRequest = new Request(`${url.origin}/index.html`, request);
104
- return env.ASSETS.fetch(indexRequest);
105
- },
106
- };
107
- ```
108
-
109
- ## Wrangler Configuration
110
-
111
- ### Environment Variables
112
-
113
- For production deployment, set environment variables in Cloudflare dashboard or via wrangler:
114
-
115
- ```toml title="wrangler.toml"
116
- [env.production]
117
- name = "my-account-app"
118
-
119
- [env.production.vars]
120
- # Catch-all: API + Account + CMS URLs all derive from this origin.
121
- VITE_QUICKBACK_URL = "https://secure.example.com"
122
- VITE_ACCOUNT_APP_URL = "https://account.example.com"
123
- VITE_APP_NAME = "My App"
124
- VITE_QUICKBACK_APP_URL = "https://app.example.com"
125
- ```
126
-
127
- > **Build-Time Variables**
128
- >
129
- > Vite environment variables (`VITE_*`) are baked into the build at build time. Changing them in `wrangler.toml` requires rebuilding. Use `.env.production` for production builds.
130
-
131
-
132
- ### Multiple Environments
133
-
134
- ```toml title="wrangler.toml"
135
- # Development
136
- [env.dev]
137
- name = "my-account-app-dev"
138
- route = "account-dev.example.com/*"
139
-
140
- [env.dev.vars]
141
- VITE_QUICKBACK_URL = "https://secure-dev.example.com"
142
- VITE_ACCOUNT_APP_URL = "https://account-dev.example.com"
143
-
144
- # Staging
145
- [env.staging]
146
- name = "my-account-app-staging"
147
- route = "account-staging.example.com/*"
148
-
149
- [env.staging.vars]
150
- VITE_QUICKBACK_URL = "https://secure-staging.example.com"
151
- VITE_ACCOUNT_APP_URL = "https://account-staging.example.com"
152
-
153
- # Production
154
- [env.production]
155
- name = "my-account-app"
156
- route = "account.example.com/*"
157
-
158
- [env.production.vars]
159
- VITE_QUICKBACK_URL = "https://secure.example.com"
160
- VITE_ACCOUNT_APP_URL = "https://account.example.com"
161
- ```
162
-
163
- Deploy to specific environment:
164
-
165
- ```bash
166
- wrangler deploy --env staging
167
- wrangler deploy --env production
168
- ```
169
-
170
- ## Cloudflare Pages Alternative
171
-
172
- You can also deploy to Cloudflare Pages instead of Workers:
173
-
174
- ### 1. Configure Build
175
-
176
- ```toml title="wrangler.toml"
177
- # Remove [assets] section - Pages handles this
178
-
179
- name = "my-account-app"
180
- pages_build_output_dir = "dist/client"
181
- ```
182
-
183
- ### 2. Deploy to Pages
184
-
185
- ```bash
186
- # First time setup
187
- wrangler pages project create my-account-app
188
-
189
- # Deploy
190
- wrangler pages deploy dist/client
191
- ```
192
-
193
- ### 3. Configure Environment Variables
194
-
195
- Set environment variables in Cloudflare Pages dashboard:
196
- 1. Go to your Pages project
197
- 2. **Settings** → **Environment Variables**
198
- 3. Add `VITE_*` variables
199
- 4. Redeploy
200
-
201
- > **Pages vs Workers**
202
- >
203
- > **Workers**: Better for custom server logic, middleware, edge compute
204
- > **Pages**: Simpler for static SPAs, automatic preview deployments, built-in analytics
205
-
206
-
207
- ## Local Development
208
-
209
- ### Option 1: Vite Dev Server
210
-
211
- The fastest way to develop locally:
212
-
213
- ```bash
214
- npx vite dev
215
- ```
216
-
217
- This starts the Vite dev server with hot module replacement on `localhost:5173`.
218
-
219
- ### Option 2: Wrangler Dev
220
-
221
- Test the worker locally with `wrangler dev`:
222
-
223
- ```bash
224
- npm run build && wrangler dev
225
- ```
226
-
227
- This runs the worker on `localhost:8787`.
228
-
229
- ## Health Check
230
-
231
- The worker includes a built-in health check endpoint:
232
-
233
- ```bash
234
- curl https://account.example.com/health
235
- ```
236
-
237
- Response:
238
-
239
- ```json
240
- {
241
- "status": "ok",
242
- "app": "auth-ui"
243
- }
244
- ```
245
-
246
- Use this for:
247
- - Uptime monitoring
248
- - Load balancer health checks
249
- - Deployment verification
250
-
251
- ## Security Headers
252
-
253
- Add security headers by editing `src/worker.ts`:
254
-
255
- ```ts title="src/worker.ts"
256
- export default {
257
- async fetch(request: Request, env: Env): Promise<Response> {
258
- // ... routing logic ...
259
-
260
- // Add security headers to response
261
- const response = await env.ASSETS.fetch(request);
262
-
263
- const headers = new Headers(response.headers);
264
- headers.set('X-Frame-Options', 'DENY');
265
- headers.set('X-Content-Type-Options', 'nosniff');
266
- headers.set('Referrer-Policy', 'strict-origin-when-cross-origin');
267
- headers.set('Permissions-Policy', 'geolocation=(), microphone=(), camera=()');
268
-
269
- return new Response(response.body, {
270
- status: response.status,
271
- statusText: response.statusText,
272
- headers,
273
- });
274
- },
275
- };
276
- ```
277
-
278
- ## Custom 404 Page
279
-
280
- Serve a custom 404 page for unmatched routes:
281
-
282
- ```ts title="src/worker.ts"
283
- export default {
284
- async fetch(request: Request, env: Env): Promise<Response> {
285
- const url = new URL(request.url);
286
-
287
- // Try to serve static asset
288
- const assetResponse = await env.ASSETS.fetch(request);
289
-
290
- if (assetResponse.status !== 404) {
291
- return assetResponse;
292
- }
293
-
294
- // Serve index.html for SPA routes
295
- if (!url.pathname.startsWith('/api/')) {
296
- const indexRequest = new Request(`${url.origin}/index.html`, request);
297
- return env.ASSETS.fetch(indexRequest);
298
- }
299
-
300
- // Custom 404 for API routes
301
- return new Response('Not Found', { status: 404 });
302
- },
303
- };
304
- ```
305
-
306
- ## Deployment Checklist
307
-
308
- Before deploying to production:
309
-
310
- - [ ] Set all required environment variables (`VITE_QUICKBACK_URL` or `VITE_QUICKBACK_API_URL`, etc.)
311
- - [ ] Configure custom domain in Cloudflare
312
- - [ ] Add SSL certificate (automatic with Cloudflare)
313
- - [ ] Test all authentication flows
314
- - [ ] Configure DNS records
315
- - [ ] Set up monitoring/health checks
316
- - [ ] Test email sending
317
- - [ ] Verify passkey functionality (requires HTTPS)
318
- - [ ] Check CORS configuration on API
319
- - [ ] Review security headers
320
- - [ ] Test organization invitations
321
- - [ ] Verify redirection to main app works
322
-
323
- ## Troubleshooting
324
-
325
- ### Assets Not Loading
326
-
327
- **Problem**: 404 errors for static assets (JS, CSS)
328
-
329
- **Solution**: Check `directory` path in `wrangler.toml`:
330
-
331
- ```toml
332
- [assets]
333
- binding = "ASSETS"
334
- directory = "dist/client" # Must point to Vite's client build output
335
- ```
336
-
337
- ### Environment Variables Not Working
338
-
339
- **Problem**: Config values are undefined
340
-
341
- **Solution**: Remember that `VITE_*` variables are build-time. Either:
342
- 1. Set them in `.env.production` before building
343
- 2. Use `setAppConfig()` in `src/main.tsx` for runtime overrides
344
- 3. Edit `src/config/app.ts` defaults directly
345
-
346
- ### SPA Routing Issues
347
-
348
- **Problem**: Refreshing on `/profile` returns 404
349
-
350
- **Solution**: Ensure your worker serves `index.html` for all non-asset routes:
351
-
352
- ```ts
353
- if (assetResponse.status === 404 && !url.pathname.startsWith('/api/')) {
354
- return env.ASSETS.fetch(new Request(`${url.origin}/index.html`, request));
355
- }
356
- ```
357
-
358
- ## Next Steps
359
-
360
- - **[Environment Variables](/stack/account-ui/environment-variables)** - Configure your deployment
361
- - **[Feature Flags](/stack/account-ui/features)** - Enable features
362
- - **[Customization](/stack/account-ui/customization)** - Brand your UI