oneie 2.0.3 → 2.0.6

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 (84) hide show
  1. package/CLAUDE.md +220 -29
  2. package/LICENSE.md +84 -0
  3. package/README.md +489 -931
  4. package/dist/copy-claude-config.d.ts.map +1 -1
  5. package/dist/copy-claude-config.js +3 -1
  6. package/dist/copy-claude-config.js.map +1 -1
  7. package/dist/sync-agents.d.ts.map +1 -1
  8. package/dist/sync-agents.js +3 -1
  9. package/dist/sync-agents.js.map +1 -1
  10. package/dist/sync-ontology.d.ts.map +1 -1
  11. package/dist/sync-ontology.js +9 -7
  12. package/dist/sync-ontology.js.map +1 -1
  13. package/folders.yaml +78 -17
  14. package/one/.obsidian/workspace.json +6 -6
  15. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +412 -0
  16. package/one/events/FEATURE-2-4-COMPLETE.md +302 -0
  17. package/one/events/FEATURE_2_3_COMPLETE.md +575 -0
  18. package/one/events/GROUPS-MIGRATION.md +625 -0
  19. package/one/events/INSTALL-TESTS.md +293 -0
  20. package/one/events/INTEGRATION-ARCHITECTURE.md +561 -0
  21. package/one/events/INTEGRATION-CHECKLIST.md +1234 -0
  22. package/one/events/INTEGRATION-ORCHESTRATION.md +2623 -0
  23. package/one/events/INTEGRATION-SUMMARY.md +653 -0
  24. package/one/events/MIGRATION-REPORT.md +435 -0
  25. package/one/events/MIGRATION.md +69 -0
  26. package/one/events/README-archived.md +519 -0
  27. package/one/events/TEST-SUMMARY.md +393 -0
  28. package/one/events/TESTS-QUICK-REF.md +262 -0
  29. package/one/groups/groups.md +543 -0
  30. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +49 -0
  31. package/one/knowledge/architecture-any-backend.md +1366 -0
  32. package/one/knowledge/docs/flow.md +0 -0
  33. package/one/knowledge/ontology-documentation.md +18 -18
  34. package/one/knowledge/ontology.md +154 -143
  35. package/one/knowledge/ontology.md.backup +2822 -0
  36. package/one/knowledge/ontology.yaml +87 -87
  37. package/one/knowledge/provider-creation-guide.md +1064 -0
  38. package/one/knowledge/todo.md +251 -0
  39. package/one/license.md +84 -0
  40. package/one/things/CHECKLIST.md +356 -0
  41. package/one/things/ONE.md +510 -0
  42. package/one/things/{cli.md → cli/cli.md} +27 -4
  43. package/one/things/features/2-1-dataprovider-interface.md +2358 -0
  44. package/one/things/features/2-2-config-system.md +3075 -0
  45. package/one/things/features/2-3-effectts-services.md +1498 -0
  46. package/one/things/features/2-4-react-hooks.md +2120 -0
  47. package/one/things/features/2-5-auth-migration.md +2046 -0
  48. package/one/things/features/2-6-dashboard-migration.md +1985 -0
  49. package/one/things/features/2-7-alternative-providers.md +2505 -0
  50. package/one/things/features/2-7-implementation-report.md +680 -0
  51. package/one/things/features/2-cli.md +39 -39
  52. package/one/things/features/2-design.md +1738 -0
  53. package/one/things/features/2-tests.md +520 -0
  54. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +521 -0
  55. package/one/things/features/DECOUPLING.md +272 -0
  56. package/one/things/features/DEPLOYMENT.md +452 -0
  57. package/one/things/features/IMPLEMENTATION_SUMMARY.md +316 -0
  58. package/one/things/features/dataprovider-interface/1-tests.md +1522 -0
  59. package/one/things/features/improve.md +843 -0
  60. package/one/things/features/remove-convex-deps.md +45 -0
  61. package/one/things/features/top-features.md +79 -0
  62. package/one/things/ideas/2-backend-agnostic-frontend.md +384 -0
  63. package/one/things/plans/2-backend-agnostic-frontend.md +543 -0
  64. package/one/things/plans/3-groups.md +502 -0
  65. package/one/things/plans/backend-agnostic-frontend.md +323 -0
  66. package/one/things/plans/deploy-to-cloudflare.md +581 -0
  67. package/one/things/plans/organizations-to-groups.md +705 -0
  68. package/one/things/plans/release.md +432 -0
  69. package/one/things/products/ontology.md +1 -1
  70. package/one/things/system.md +600 -0
  71. package/one/things/tests/2-1-dataprovider-interface.md +1144 -0
  72. package/one/things/tests/2-1-test-analysis.md +496 -0
  73. package/one/things/vision/elegant-interface.md +214 -0
  74. package/package.json +1 -1
  75. package/one/organisation/organisation.md +0 -438
  76. package/one/repomix-output.md +0 -92634
  77. /package/one/{things → connections}/agentkit.md +0 -0
  78. /package/one/{things → connections}/copilotkit.md +0 -0
  79. /package/one/{organisation → groups}/one.md +0 -0
  80. /package/one/{organisation → groups}/revenue.md +0 -0
  81. /package/one/{organisation → groups}/strategy.md +0 -0
  82. /package/one/{organisation → groups}/vision.md +0 -0
  83. /package/one/things/{cli-code.md → cli/cli-code.md} +0 -0
  84. /package/one/things/{cli-compiler-code.md → cli/cli-compiler-code.md} +0 -0
@@ -0,0 +1,581 @@
1
+ # Deploy Frontend to Cloudflare Pages
2
+
3
+ **Project Name:** `frontend`
4
+ **Repository:** `one-ie/frontend`
5
+ **Deployment Options:** Wrangler CLI or Git Push
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This guide covers deploying the ONE Platform frontend (Astro 5 + React 19) to Cloudflare Pages under a new project called `frontend`. You can deploy using either:
12
+
13
+ 1. **Wrangler CLI** - Direct deployment from local machine
14
+ 2. **Git Integration** - Automatic deployment on push to `one-ie/frontend`
15
+
16
+ ## Prerequisites
17
+
18
+ - Cloudflare account with Pages access
19
+ - Wrangler CLI installed (`npm install -g wrangler`)
20
+ - Authenticated with Cloudflare (`wrangler login`)
21
+ - Repository: `https://github.com/one-ie/frontend`
22
+
23
+ ## Project Configuration
24
+
25
+ ### Build Settings
26
+
27
+ **Build Command:**
28
+ ```bash
29
+ bun run build
30
+ ```
31
+
32
+ **Build Output Directory:**
33
+ ```
34
+ dist/
35
+ ```
36
+
37
+ **Root Directory:**
38
+ ```
39
+ / (repository root)
40
+ ```
41
+
42
+ **Node Version:**
43
+ ```
44
+ 20.x or later
45
+ ```
46
+
47
+ ### Environment Variables
48
+
49
+ Add these to Cloudflare Pages project settings:
50
+
51
+ ```bash
52
+ # Convex Backend
53
+ PUBLIC_CONVEX_URL=https://shocking-falcon-870.convex.cloud
54
+ CONVEX_DEPLOYMENT=prod:shocking-falcon-870
55
+
56
+ # Better Auth
57
+ BETTER_AUTH_SECRET=your-production-secret-key
58
+ BETTER_AUTH_URL=https://frontend.pages.dev
59
+
60
+ # OAuth Providers (optional)
61
+ GITHUB_CLIENT_ID=your-github-client-id
62
+ GITHUB_CLIENT_SECRET=your-github-client-secret
63
+ GOOGLE_CLIENT_ID=your-google-client-id
64
+ GOOGLE_CLIENT_SECRET=your-google-client-secret
65
+
66
+ # Email (Resend)
67
+ RESEND_API_KEY=your-resend-api-key
68
+ RESEND_FROM_EMAIL=noreply@yourdomain.com
69
+ ```
70
+
71
+ ## Deployment Method 1: Wrangler CLI
72
+
73
+ ### Initial Setup
74
+
75
+ 1. **Navigate to frontend directory:**
76
+ ```bash
77
+ cd /path/to/ONE/frontend
78
+ ```
79
+
80
+ 2. **Build the project:**
81
+ ```bash
82
+ bun run build
83
+ ```
84
+
85
+ 3. **Deploy to Cloudflare Pages:**
86
+ ```bash
87
+ wrangler pages deploy dist --project-name=frontend --commit-dirty=true
88
+ ```
89
+
90
+ ### Subsequent Deployments
91
+
92
+ ```bash
93
+ # Build and deploy in one command
94
+ bun run build && wrangler pages deploy dist --project-name=frontend
95
+ ```
96
+
97
+ ### Production Deployment
98
+
99
+ ```bash
100
+ # Deploy to production branch
101
+ wrangler pages deploy dist --project-name=frontend --branch=main
102
+ ```
103
+
104
+ ### Preview Deployment
105
+
106
+ ```bash
107
+ # Deploy preview (non-production)
108
+ wrangler pages deploy dist --project-name=frontend --branch=preview
109
+ ```
110
+
111
+ ## Deployment Method 2: Git Integration
112
+
113
+ ### Setup Cloudflare Pages Project
114
+
115
+ 1. **Log in to Cloudflare Dashboard**
116
+ - Navigate to: https://dash.cloudflare.com
117
+ - Go to **Workers & Pages** → **Pages**
118
+
119
+ 2. **Create New Project**
120
+ - Click **Create application** → **Pages** → **Connect to Git**
121
+ - Select **GitHub** as the git provider
122
+ - Authorize Cloudflare to access your GitHub account
123
+
124
+ 3. **Select Repository**
125
+ - Organization: `one-ie`
126
+ - Repository: `frontend`
127
+ - Click **Begin setup**
128
+
129
+ 4. **Configure Build Settings**
130
+ ```
131
+ Project name: frontend
132
+ Production branch: main
133
+ Build command: bun run build
134
+ Build output directory: dist
135
+ Root directory: /
136
+ ```
137
+
138
+ 5. **Environment Variables**
139
+ - Click **Add variable** for each environment variable listed above
140
+ - Add all required variables (PUBLIC_CONVEX_URL, BETTER_AUTH_SECRET, etc.)
141
+ - Separate variables for **Production** and **Preview** if needed
142
+
143
+ 6. **Save and Deploy**
144
+ - Click **Save and Deploy**
145
+ - First deployment will begin automatically
146
+
147
+ ### Automatic Deployments
148
+
149
+ Once configured, deployments happen automatically:
150
+
151
+ **Production Deployments:**
152
+ ```bash
153
+ # Any push to main branch triggers production deployment
154
+ git push origin main
155
+ ```
156
+
157
+ **Preview Deployments:**
158
+ ```bash
159
+ # Any push to other branches triggers preview deployment
160
+ git push origin dev
161
+ git push origin feat/new-feature
162
+ ```
163
+
164
+ ### Deployment Branches
165
+
166
+ - **Production**: `main` branch → `https://frontend.pages.dev`
167
+ - **Preview**: `dev`, `feat/*`, etc. → `https://<branch>.<project>.pages.dev`
168
+
169
+ ## Custom Domain Setup
170
+
171
+ ### Add Custom Domain
172
+
173
+ 1. **Cloudflare Dashboard**
174
+ - Go to your `frontend` project
175
+ - Click **Custom domains** tab
176
+ - Click **Set up a custom domain**
177
+
178
+ 2. **Add Domain**
179
+ ```
180
+ Primary domain: frontend.one.ie
181
+ ```
182
+ - If domain is on Cloudflare, DNS records are added automatically
183
+ - If external, add the CNAME record provided
184
+
185
+ 3. **SSL Certificate**
186
+ - Cloudflare automatically provisions SSL certificate
187
+ - Certificate is issued within minutes
188
+ - HTTPS is enforced by default
189
+
190
+ ### Multiple Domains
191
+
192
+ ```
193
+ Production:
194
+ - frontend.one.ie (primary)
195
+ - www.frontend.one.ie (redirect)
196
+ - app.one.ie (alias)
197
+
198
+ Preview:
199
+ - preview.frontend.one.ie (dev branch)
200
+ - staging.frontend.one.ie (staging branch)
201
+ ```
202
+
203
+ ## Wrangler Configuration File
204
+
205
+ Create `wrangler.toml` in `/frontend` directory for easier deployments:
206
+
207
+ ```toml
208
+ # wrangler.toml
209
+ name = "frontend"
210
+ compatibility_date = "2024-01-01"
211
+ pages_build_output_dir = "dist"
212
+
213
+ [env.production]
214
+ pages_build_output_dir = "dist"
215
+
216
+ [env.preview]
217
+ pages_build_output_dir = "dist"
218
+ ```
219
+
220
+ With this file, deployment becomes simpler:
221
+
222
+ ```bash
223
+ # Deploy to production
224
+ wrangler pages deploy
225
+
226
+ # Deploy to preview
227
+ wrangler pages deploy --env=preview
228
+ ```
229
+
230
+ ## Build Optimization
231
+
232
+ ### Enable Caching
233
+
234
+ Add to `astro.config.mjs`:
235
+
236
+ ```javascript
237
+ export default defineConfig({
238
+ output: 'server',
239
+ adapter: cloudflare({
240
+ mode: 'advanced',
241
+ functionPerRoute: true,
242
+ routes: {
243
+ strategy: 'auto',
244
+ include: ['/*'],
245
+ exclude: ['/assets/*', '/_astro/*']
246
+ }
247
+ }),
248
+ vite: {
249
+ build: {
250
+ cssCodeSplit: true,
251
+ rollupOptions: {
252
+ output: {
253
+ manualChunks: {
254
+ 'react-vendor': ['react', 'react-dom'],
255
+ 'convex-vendor': ['convex', 'convex/react']
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
261
+ });
262
+ ```
263
+
264
+ ### Asset Optimization
265
+
266
+ Cloudflare automatically optimizes:
267
+ - Image compression (WebP, AVIF)
268
+ - Brotli compression for text assets
269
+ - HTTP/3 and QUIC support
270
+ - Edge caching for static assets
271
+
272
+ ## Monitoring and Analytics
273
+
274
+ ### Enable Web Analytics
275
+
276
+ 1. **Cloudflare Dashboard** → **frontend** project
277
+ 2. Click **Analytics** tab
278
+ 3. Enable **Web Analytics**
279
+ 4. Add analytics beacon to your site (optional - auto-injected)
280
+
281
+ ### View Deployment Logs
282
+
283
+ **Via Dashboard:**
284
+ - Go to **Deployments** tab
285
+ - Click on any deployment to view build logs
286
+ - View real-time logs during deployment
287
+
288
+ **Via Wrangler:**
289
+ ```bash
290
+ # View recent deployments
291
+ wrangler pages deployments list --project-name=frontend
292
+
293
+ # View specific deployment logs
294
+ wrangler pages deployments view <deployment-id> --project-name=frontend
295
+ ```
296
+
297
+ ### Function Logs
298
+
299
+ ```bash
300
+ # Tail function logs in real-time
301
+ wrangler pages deployment tail --project-name=frontend
302
+ ```
303
+
304
+ ## Rollback Deployments
305
+
306
+ ### Via Dashboard
307
+
308
+ 1. Go to **Deployments** tab
309
+ 2. Find previous successful deployment
310
+ 3. Click **⋯** menu → **Rollback to this deployment**
311
+ 4. Confirm rollback
312
+
313
+ ### Via Wrangler
314
+
315
+ ```bash
316
+ # List deployments
317
+ wrangler pages deployments list --project-name=frontend
318
+
319
+ # Rollback to specific deployment
320
+ wrangler pages deployment rollback <deployment-id> --project-name=frontend
321
+ ```
322
+
323
+ ## CI/CD Integration
324
+
325
+ ### GitHub Actions
326
+
327
+ Create `.github/workflows/deploy.yml`:
328
+
329
+ ```yaml
330
+ name: Deploy to Cloudflare Pages
331
+
332
+ on:
333
+ push:
334
+ branches:
335
+ - main
336
+ - dev
337
+
338
+ jobs:
339
+ deploy:
340
+ runs-on: ubuntu-latest
341
+ permissions:
342
+ contents: read
343
+ deployments: write
344
+
345
+ steps:
346
+ - name: Checkout
347
+ uses: actions/checkout@v4
348
+
349
+ - name: Setup Bun
350
+ uses: oven-sh/setup-bun@v1
351
+ with:
352
+ bun-version: latest
353
+
354
+ - name: Install dependencies
355
+ run: bun install
356
+
357
+ - name: Build
358
+ run: bun run build
359
+ env:
360
+ PUBLIC_CONVEX_URL: ${{ secrets.PUBLIC_CONVEX_URL }}
361
+ BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
362
+
363
+ - name: Deploy to Cloudflare Pages
364
+ uses: cloudflare/pages-action@v1
365
+ with:
366
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
367
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
368
+ projectName: frontend
369
+ directory: dist
370
+ gitHubToken: ${{ secrets.GITHUB_TOKEN }}
371
+ branch: ${{ github.ref_name }}
372
+ ```
373
+
374
+ **Required Secrets:**
375
+ - `CLOUDFLARE_API_TOKEN` - Cloudflare API token with Pages permissions
376
+ - `CLOUDFLARE_ACCOUNT_ID` - Your Cloudflare account ID
377
+ - `PUBLIC_CONVEX_URL` - Backend URL
378
+ - `BETTER_AUTH_SECRET` - Auth secret key
379
+
380
+ ## Troubleshooting
381
+
382
+ ### Build Fails
383
+
384
+ **Issue:** Build command fails
385
+ ```bash
386
+ # Check build locally first
387
+ bun run build
388
+
389
+ # Verify all dependencies are in package.json
390
+ bun install --frozen-lockfile
391
+ ```
392
+
393
+ **Issue:** TypeScript errors
394
+ ```bash
395
+ # Run type checking
396
+ bunx astro check
397
+
398
+ # Fix errors before deploying
399
+ ```
400
+
401
+ ### Environment Variables
402
+
403
+ **Issue:** Environment variables not working
404
+ - Verify variables are set in Cloudflare Pages dashboard
405
+ - Restart deployment after adding variables
406
+ - Check variable names match exactly (case-sensitive)
407
+
408
+ ### React 19 Edge Runtime
409
+
410
+ **Issue:** "MessageChannel is not defined"
411
+ - Ensure `react-dom/server.edge` alias is set in `astro.config.mjs`:
412
+
413
+ ```javascript
414
+ vite: {
415
+ resolve: {
416
+ alias: {
417
+ 'react-dom/server': 'react-dom/server.edge'
418
+ }
419
+ }
420
+ }
421
+ ```
422
+
423
+ ### Function Size Limits
424
+
425
+ **Issue:** "Functions bundle exceeds size limit"
426
+ - Enable code splitting in Vite config
427
+ - Use dynamic imports for large dependencies
428
+ - Split routes into separate functions with `functionPerRoute: true`
429
+
430
+ ### Authentication Issues
431
+
432
+ **Issue:** Auth not working after deployment
433
+ - Verify `BETTER_AUTH_URL` matches your production domain
434
+ - Check `PUBLIC_CONVEX_URL` is accessible from Cloudflare edge
435
+ - Ensure all OAuth redirect URLs are updated in provider settings
436
+
437
+ ## Performance Optimization
438
+
439
+ ### Edge Caching
440
+
441
+ Add cache headers for static assets in `public/_headers`:
442
+
443
+ ```
444
+ # Cache static assets
445
+ /assets/*
446
+ Cache-Control: public, max-age=31536000, immutable
447
+
448
+ /_astro/*
449
+ Cache-Control: public, max-age=31536000, immutable
450
+
451
+ # Cache HTML with revalidation
452
+ /*.html
453
+ Cache-Control: public, max-age=3600, must-revalidate
454
+
455
+ # API routes - no cache
456
+ /api/*
457
+ Cache-Control: no-store, no-cache, must-revalidate
458
+ ```
459
+
460
+ ### CDN Configuration
461
+
462
+ Cloudflare automatically provides:
463
+ - Global CDN with 330+ edge locations
464
+ - DDoS protection
465
+ - Bot management
466
+ - SSL/TLS encryption
467
+ - HTTP/3 support
468
+ - IPv6 support
469
+
470
+ ## Security
471
+
472
+ ### Enable Security Features
473
+
474
+ 1. **WAF (Web Application Firewall)**
475
+ - Enabled by default for all Cloudflare Pages
476
+ - Protects against common vulnerabilities
477
+
478
+ 2. **HTTPS Only**
479
+ - Always use HTTPS URLs in production
480
+ - HTTP automatically redirects to HTTPS
481
+
482
+ 3. **Environment Variables**
483
+ - Never commit secrets to git
484
+ - Use Cloudflare Pages environment variables
485
+ - Rotate secrets regularly
486
+
487
+ 4. **CSP Headers**
488
+ - Add Content Security Policy in `public/_headers`:
489
+
490
+ ```
491
+ /*
492
+ X-Frame-Options: DENY
493
+ X-Content-Type-Options: nosniff
494
+ Referrer-Policy: strict-origin-when-cross-origin
495
+ Permissions-Policy: camera=(), microphone=(), geolocation=()
496
+ ```
497
+
498
+ ## Migration from Old Project
499
+
500
+ ### Export from Old Project
501
+
502
+ 1. **Save Environment Variables**
503
+ - Export all environment variables from old project
504
+ - Document custom domain settings
505
+
506
+ 2. **Note Custom Configuration**
507
+ - Build commands
508
+ - Deployment branches
509
+ - Access policies
510
+
511
+ ### Setup New Project
512
+
513
+ 1. Follow **Deployment Method 2** steps above
514
+ 2. Import saved environment variables
515
+ 3. Configure same custom domains (or new ones)
516
+ 4. Run test deployment
517
+
518
+ ### Switch Traffic
519
+
520
+ 1. **DNS Method** (recommended):
521
+ - Update DNS records to point to new project
522
+ - Old project remains as fallback
523
+
524
+ 2. **Domain Transfer**:
525
+ - Remove domain from old project
526
+ - Add domain to new `frontend` project
527
+ - DNS updates automatically
528
+
529
+ ### Cleanup Old Project
530
+
531
+ After successful migration:
532
+ ```bash
533
+ # Delete old project (via dashboard or API)
534
+ # Keep old project for 30 days as backup (optional)
535
+ ```
536
+
537
+ ## Quick Reference
538
+
539
+ ### Essential Commands
540
+
541
+ ```bash
542
+ # Build locally
543
+ bun run build
544
+
545
+ # Deploy via Wrangler
546
+ wrangler pages deploy dist --project-name=frontend
547
+
548
+ # Deploy production
549
+ wrangler pages deploy dist --project-name=frontend --branch=main
550
+
551
+ # View deployments
552
+ wrangler pages deployments list --project-name=frontend
553
+
554
+ # Tail logs
555
+ wrangler pages deployment tail --project-name=frontend
556
+
557
+ # Deploy via Git
558
+ git push origin main # production
559
+ git push origin dev # preview
560
+ ```
561
+
562
+ ### Project URLs
563
+
564
+ ```
565
+ Production: https://frontend.pages.dev
566
+ Preview: https://<branch>.frontend.pages.dev
567
+ Custom: https://frontend.one.ie (after DNS setup)
568
+ ```
569
+
570
+ ### Support
571
+
572
+ - **Cloudflare Docs**: https://developers.cloudflare.com/pages/
573
+ - **Wrangler Docs**: https://developers.cloudflare.com/workers/wrangler/
574
+ - **Astro + Cloudflare**: https://docs.astro.build/en/guides/deploy/cloudflare/
575
+ - **Community**: https://discord.cloudflare.com
576
+
577
+ ---
578
+
579
+ **Status:** Ready for deployment
580
+ **Last Updated:** 2025-01-13
581
+ **Maintained By:** ONE Platform Team