oneie 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1132) hide show
  1. package/README.md +9 -9
  2. package/dist/commands/agent.d.ts +2 -0
  3. package/dist/commands/agent.d.ts.map +1 -1
  4. package/dist/commands/agent.js +44 -0
  5. package/dist/commands/agent.js.map +1 -1
  6. package/dist/commands/bounty.d.ts +4 -0
  7. package/dist/commands/bounty.d.ts.map +1 -0
  8. package/dist/commands/bounty.js +24 -0
  9. package/dist/commands/bounty.js.map +1 -0
  10. package/dist/commands/capabilities.d.ts +4 -0
  11. package/dist/commands/capabilities.d.ts.map +1 -0
  12. package/dist/commands/capabilities.js +18 -0
  13. package/dist/commands/capabilities.js.map +1 -0
  14. package/dist/commands/commend.d.ts +4 -0
  15. package/dist/commands/commend.d.ts.map +1 -0
  16. package/dist/commands/commend.js +13 -0
  17. package/dist/commands/commend.js.map +1 -0
  18. package/dist/commands/completion.d.ts +4 -0
  19. package/dist/commands/completion.d.ts.map +1 -0
  20. package/dist/commands/completion.js +49 -0
  21. package/dist/commands/completion.js.map +1 -0
  22. package/dist/commands/config.d.ts +4 -0
  23. package/dist/commands/config.d.ts.map +1 -0
  24. package/dist/commands/config.js +78 -0
  25. package/dist/commands/config.js.map +1 -0
  26. package/dist/commands/doctor.d.ts +4 -0
  27. package/dist/commands/doctor.d.ts.map +1 -0
  28. package/dist/commands/doctor.js +72 -0
  29. package/dist/commands/doctor.js.map +1 -0
  30. package/dist/commands/export.d.ts +4 -0
  31. package/dist/commands/export.d.ts.map +1 -0
  32. package/dist/commands/export.js +15 -0
  33. package/dist/commands/export.js.map +1 -0
  34. package/dist/commands/fade.d.ts.map +1 -1
  35. package/dist/commands/fade.js +8 -4
  36. package/dist/commands/fade.js.map +1 -1
  37. package/dist/commands/flag.d.ts +4 -0
  38. package/dist/commands/flag.d.ts.map +1 -0
  39. package/dist/commands/flag.js +13 -0
  40. package/dist/commands/flag.js.map +1 -0
  41. package/dist/commands/health.d.ts +4 -0
  42. package/dist/commands/health.d.ts.map +1 -0
  43. package/dist/commands/health.js +11 -0
  44. package/dist/commands/health.js.map +1 -0
  45. package/dist/commands/highways.d.ts.map +1 -1
  46. package/dist/commands/highways.js +7 -4
  47. package/dist/commands/highways.js.map +1 -1
  48. package/dist/commands/hire.d.ts +4 -0
  49. package/dist/commands/hire.d.ts.map +1 -0
  50. package/dist/commands/hire.js +16 -0
  51. package/dist/commands/hire.js.map +1 -0
  52. package/dist/commands/init.d.ts.map +1 -1
  53. package/dist/commands/init.js +69 -42
  54. package/dist/commands/init.js.map +1 -1
  55. package/dist/commands/mark.d.ts.map +1 -1
  56. package/dist/commands/mark.js +7 -7
  57. package/dist/commands/mark.js.map +1 -1
  58. package/dist/commands/pay.d.ts +4 -0
  59. package/dist/commands/pay.d.ts.map +1 -0
  60. package/dist/commands/pay.js +21 -0
  61. package/dist/commands/pay.js.map +1 -0
  62. package/dist/commands/pipe.d.ts +4 -0
  63. package/dist/commands/pipe.d.ts.map +1 -0
  64. package/dist/commands/pipe.js +35 -0
  65. package/dist/commands/pipe.js.map +1 -0
  66. package/dist/commands/publish.d.ts +4 -0
  67. package/dist/commands/publish.d.ts.map +1 -0
  68. package/dist/commands/publish.js +23 -0
  69. package/dist/commands/publish.js.map +1 -0
  70. package/dist/commands/repl.d.ts +4 -0
  71. package/dist/commands/repl.d.ts.map +1 -0
  72. package/dist/commands/repl.js +56 -0
  73. package/dist/commands/repl.js.map +1 -0
  74. package/dist/commands/revenue.d.ts +4 -0
  75. package/dist/commands/revenue.d.ts.map +1 -0
  76. package/dist/commands/revenue.js +11 -0
  77. package/dist/commands/revenue.js.map +1 -0
  78. package/dist/commands/stats.d.ts +4 -0
  79. package/dist/commands/stats.d.ts.map +1 -0
  80. package/dist/commands/stats.js +11 -0
  81. package/dist/commands/stats.js.map +1 -0
  82. package/dist/commands/status.d.ts +4 -0
  83. package/dist/commands/status.d.ts.map +1 -0
  84. package/dist/commands/status.js +18 -0
  85. package/dist/commands/status.js.map +1 -0
  86. package/dist/commands/tail.d.ts +4 -0
  87. package/dist/commands/tail.d.ts.map +1 -0
  88. package/dist/commands/tail.js +51 -0
  89. package/dist/commands/tail.js.map +1 -0
  90. package/dist/commands/warn.d.ts.map +1 -1
  91. package/dist/commands/warn.js +6 -6
  92. package/dist/commands/warn.js.map +1 -1
  93. package/dist/index.js +61 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist/lib/args.d.ts +1 -0
  96. package/dist/lib/args.d.ts.map +1 -1
  97. package/dist/lib/args.js +3 -0
  98. package/dist/lib/args.js.map +1 -1
  99. package/dist/lib/output.d.ts +5 -0
  100. package/dist/lib/output.d.ts.map +1 -0
  101. package/dist/lib/output.js +32 -0
  102. package/dist/lib/output.js.map +1 -0
  103. package/dist/lib/sdk.d.ts +10 -0
  104. package/dist/lib/sdk.d.ts.map +1 -0
  105. package/dist/lib/sdk.js +22 -0
  106. package/dist/lib/sdk.js.map +1 -0
  107. package/dist/utils/installation-setup.d.ts +15 -0
  108. package/dist/utils/installation-setup.d.ts.map +1 -1
  109. package/dist/utils/installation-setup.js +63 -0
  110. package/dist/utils/installation-setup.js.map +1 -1
  111. package/package.json +3 -18
  112. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  113. package/.claude/agents/agent-backend.md +0 -574
  114. package/.claude/agents/agent-builder.md +0 -911
  115. package/.claude/agents/agent-claude.md +0 -645
  116. package/.claude/agents/agent-clean.md +0 -477
  117. package/.claude/agents/agent-clone.md +0 -554
  118. package/.claude/agents/agent-designer.md +0 -1080
  119. package/.claude/agents/agent-director.md +0 -2254
  120. package/.claude/agents/agent-documenter.md +0 -688
  121. package/.claude/agents/agent-frontend.md +0 -1199
  122. package/.claude/agents/agent-integrator.md +0 -670
  123. package/.claude/agents/agent-lawyer.md +0 -1320
  124. package/.claude/agents/agent-news.md +0 -363
  125. package/.claude/agents/agent-onboard.md +0 -613
  126. package/.claude/agents/agent-ontology.md +0 -585
  127. package/.claude/agents/agent-ops.md +0 -1275
  128. package/.claude/agents/agent-problem-solver.md +0 -669
  129. package/.claude/agents/agent-quality.md +0 -1042
  130. package/.claude/agents/agent-sales.md +0 -507
  131. package/.claude/agents/agent-writer.md +0 -1068
  132. package/.claude/commands/cascade.md +0 -742
  133. package/.claude/commands/chat.md +0 -728
  134. package/.claude/commands/commit.md +0 -95
  135. package/.claude/commands/create.md +0 -544
  136. package/.claude/commands/deploy.md +0 -309
  137. package/.claude/commands/fast.md +0 -636
  138. package/.claude/commands/mcp-on.md +0 -191
  139. package/.claude/commands/media-upload.md +0 -186
  140. package/.claude/commands/news.md +0 -274
  141. package/.claude/commands/onboard.md +0 -440
  142. package/.claude/commands/one.md +0 -398
  143. package/.claude/commands/optimize.md +0 -74
  144. package/.claude/commands/plan.md +0 -719
  145. package/.claude/commands/push.md +0 -214
  146. package/.claude/commands/release.md +0 -105
  147. package/.claude/commands/review.md +0 -99
  148. package/.claude/commands/server.md +0 -487
  149. package/.claude/commands/start.md +0 -227
  150. package/.claude/commands/test.md +0 -197
  151. package/.claude/commands/validate.md +0 -140
  152. package/.claude/hooks/.last-news-context +0 -1
  153. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  154. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  155. package/.claude/hooks/README-news-generation.md +0 -364
  156. package/.claude/hooks/README-root-cleanup.md +0 -200
  157. package/.claude/hooks/README.md +0 -284
  158. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  159. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  160. package/.claude/hooks/auto-format.sh +0 -106
  161. package/.claude/hooks/check-filenames.py +0 -177
  162. package/.claude/hooks/clean-post.py +0 -468
  163. package/.claude/hooks/clean-pre.py +0 -393
  164. package/.claude/hooks/clean-root-markdown.sh +0 -73
  165. package/.claude/hooks/commit-push.sh +0 -95
  166. package/.claude/hooks/done.py +0 -236
  167. package/.claude/hooks/format-hook.sh +0 -163
  168. package/.claude/hooks/formatting.py +0 -187
  169. package/.claude/hooks/hook-logger.sh +0 -173
  170. package/.claude/hooks/knowledge-post.py +0 -355
  171. package/.claude/hooks/knowledge-pre.py +0 -245
  172. package/.claude/hooks/mcp-on.sh +0 -134
  173. package/.claude/hooks/notification-hook.sh +0 -279
  174. package/.claude/hooks/ontology-validation.py +0 -255
  175. package/.claude/hooks/push.sh +0 -153
  176. package/.claude/hooks/release-cli.sh +0 -205
  177. package/.claude/hooks/root-cleanup.py +0 -217
  178. package/.claude/hooks/security-hook.sh +0 -397
  179. package/.claude/hooks/tag-all-docs.py +0 -464
  180. package/.claude/hooks/test-validate-ontology.sh +0 -170
  181. package/.claude/hooks/todo.py +0 -368
  182. package/.claude/hooks/track-changes.sh +0 -101
  183. package/.claude/hooks/validate-imports.py +0 -182
  184. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  185. package/.claude/hooks/validate-ontology-structure.py +0 -558
  186. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  187. package/.claude/hooks/validate-ontology.py +0 -140
  188. package/.claude/hooks/write-news.sh +0 -194
  189. package/.claude/skills/INDEX.md +0 -523
  190. package/.claude/skills/REGISTRY.md +0 -529
  191. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  192. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  193. package/.claude/skills/agent-frontend-create-page.md +0 -413
  194. package/.claude/skills/agents/README.md +0 -238
  195. package/.claude/skills/astro/add-content-collection.md +0 -30
  196. package/.claude/skills/astro/check-build.md +0 -29
  197. package/.claude/skills/astro/create-component.md +0 -29
  198. package/.claude/skills/astro/create-page.md +0 -30
  199. package/.claude/skills/astro/optimize-performance.md +0 -21
  200. package/.claude/skills/convex/check-deployment.md +0 -46
  201. package/.claude/skills/convex/create-mutation.md +0 -405
  202. package/.claude/skills/convex/create-query.md +0 -52
  203. package/.claude/skills/convex/read-schema.md +0 -373
  204. package/.claude/skills/convex/test-function.md +0 -50
  205. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  206. package/.claude/skills/deployment/create-release.md +0 -21
  207. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  208. package/.claude/skills/deployment/deploy-convex.md +0 -30
  209. package/.claude/skills/deployment/sync-repositories.md +0 -19
  210. package/.claude/skills/design/check-accessibility.md +0 -21
  211. package/.claude/skills/design/create-component-spec.md +0 -27
  212. package/.claude/skills/design/generate-design-tokens.md +0 -24
  213. package/.claude/skills/design/generate-wireframe.md +0 -30
  214. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  215. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  216. package/.claude/skills/documentation/generate-readme.md +0 -22
  217. package/.claude/skills/documentation/update-knowledge.md +0 -20
  218. package/.claude/skills/integration/connect-external-system.md +0 -21
  219. package/.claude/skills/integration/implement-a2a.md +0 -20
  220. package/.claude/skills/integration/implement-acp.md +0 -20
  221. package/.claude/skills/integration/verify-integration.md +0 -20
  222. package/.claude/skills/ontology/README.md +0 -255
  223. package/.claude/skills/ontology/check-dimension.md +0 -307
  224. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  225. package/.claude/skills/ontology/validate-schema.md +0 -229
  226. package/.claude/skills/ontology/verify-relationships.md +0 -310
  227. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  228. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  229. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  230. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  231. package/.claude/skills/sales/generate-demo-script.md +0 -21
  232. package/.claude/skills/sales/qualify-lead.md +0 -30
  233. package/.claude/skills/sales/track-trial.md +0 -20
  234. package/.claude/skills/sales/verify-kyc.md +0 -20
  235. package/.claude/skills/testing/analyze-coverage.md +0 -24
  236. package/.claude/skills/testing/generate-tests.md +0 -24
  237. package/.claude/skills/testing/run-tests.md +0 -27
  238. package/.claude/skills/testing/validate-e2e.md +0 -25
  239. package/AGENTS.md +0 -60
  240. package/CLAUDE.md +0 -130
  241. package/CREATE-WEBSITE.md +0 -458
  242. package/SECURITY.md +0 -31
  243. package/folders.yaml +0 -92
  244. package/one/README.md +0 -760
  245. package/one/actors/anthony-o-connell.md +0 -469
  246. package/one/actors/people.md +0 -590
  247. package/one/events/0-changes.md +0 -2764
  248. package/one/events/1-PROJECTS-START-HERE.md +0 -384
  249. package/one/events/1-projects-developer-quickstart.md +0 -620
  250. package/one/events/1-projects-feature.md +0 -2047
  251. package/one/events/1-projects-team-briefing.md +0 -583
  252. package/one/events/2024-10-14-deployment-plan.md +0 -330
  253. package/one/events/2024-10-14-deployment-success.md +0 -447
  254. package/one/events/2024-10-14-final-sync-complete.md +0 -250
  255. package/one/events/2024-10-14-release-v2.0.6.md +0 -414
  256. package/one/events/2024-10-15-agent-clean-v2-summary.md +0 -495
  257. package/one/events/2024-10-15-handoff-to-clean.md +0 -347
  258. package/one/events/2024-10-15-package-manager-tests.md +0 -442
  259. package/one/events/2024-10-15-release-command-complete.md +0 -416
  260. package/one/events/2025-10-15-private-files-secured.md +0 -359
  261. package/one/events/2025-10-15-unignore-public-group-docs.md +0 -298
  262. package/one/events/2025-11-08-backend-claude-refactor.md +0 -242
  263. package/one/events/2025-11-08-parallel-agent-implementation.md +0 -620
  264. package/one/events/2025-11-10-ai-integration-status-report.md +0 -241
  265. package/one/events/ACCESSIBILITY_CHECKLIST.md +0 -275
  266. package/one/events/ACCESSIBILITY_FIXES_SUMMARY.md +0 -293
  267. package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +0 -335
  268. package/one/events/ALIGNMENT_SUMMARY.md +0 -280
  269. package/one/events/API_ROUTES_FIXES_SUMMARY.md +0 -280
  270. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +0 -654
  271. package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +0 -598
  272. package/one/events/AUDIT_PLAN_COMPLETION-20251108-125555.md +0 -262
  273. package/one/events/BEFORE_AFTER_COMPARISON.md +0 -978
  274. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +0 -372
  275. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +0 -430
  276. package/one/events/CHARTS-READY-TO-USE-20251106-080939.md +0 -184
  277. package/one/events/CHARTS-SUMMARY-20251106-080938.md +0 -196
  278. package/one/events/CLAUDE copy.md +0 -897
  279. package/one/events/CLEANUP-RELEASE-V2.0.8.md +0 -308
  280. package/one/events/CLOUDFLARE-FS-FIX-20251106-100516.md +0 -75
  281. package/one/events/COMPONENT_SHOWCASE-20251106-080938.md +0 -629
  282. package/one/events/CONNECTIONS_DEMO.md +0 -519
  283. package/one/events/CREATE-WEBSITE.md +0 -460
  284. package/one/events/CRITICAL-FIXES-COMPLETE.md +0 -571
  285. package/one/events/CUSTOM-DOMAIN.md +0 -375
  286. package/one/events/DELIVERABLES.md +0 -450
  287. package/one/events/DELIVERABLES.txt +0 -273
  288. package/one/events/DEMO-GROUPS-PAGE.md +0 -410
  289. package/one/events/DEMO-TESTING-SUMMARY.md +0 -536
  290. package/one/events/DEMO_COMPONENTS.md +0 -505
  291. package/one/events/DEMO_HOOKS_INDEX.md +0 -352
  292. package/one/events/DEMO_INFRASTRUCTURE.md +0 -923
  293. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +0 -588
  294. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +0 -449
  295. package/one/events/DEMO_QUICK_REFERENCE.md +0 -459
  296. package/one/events/DEMO_SETUP.md +0 -494
  297. package/one/events/DEPLOYMENT copy.md +0 -444
  298. package/one/events/DEPLOYMENT.md +0 -196
  299. package/one/events/DESIGN-DELIVERABLES-20251106-080938.md +0 -557
  300. package/one/events/DESIGN-EXECUTIVE-SUMMARY-20251106-080938.md +0 -484
  301. package/one/events/DOCS-SYSTEM-GUIDE-20251105-142103.md +0 -458
  302. package/one/events/DOCUMENTER-DELIVERY-SUMMARY.md +0 -481
  303. package/one/events/DOCUMENTER-EXECUTION-GUIDE.md +0 -394
  304. package/one/events/DOCUMENTER-TASK-BREAKDOWN.md +0 -783
  305. package/one/events/ECOMMERCE-BEFORE-AFTER.md +0 -267
  306. package/one/events/ECOMMERCE-DEMO-PLAN.md +0 -243
  307. package/one/events/ECOMMERCE-ENHANCEMENTS.md +0 -594
  308. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +0 -439
  309. package/one/events/ECOMMERCE-LIVE-DEMO.md +0 -381
  310. package/one/events/ECOMMERCE-QUICKSTART.md +0 -376
  311. package/one/events/ECOMMERCE-README.md +0 -354
  312. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +0 -214
  313. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +0 -414
  314. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +0 -753
  315. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +0 -941
  316. package/one/events/EFFECT_TS_API_PATTERN.md +0 -496
  317. package/one/events/EXECUTION-READY.md +0 -359
  318. package/one/events/EXECUTION-SUMMARY.md +0 -478
  319. package/one/events/FEATURE-2-4-COMPLETE.md +0 -320
  320. package/one/events/FEATURE_2_3_COMPLETE.md +0 -593
  321. package/one/events/FILE-REFERENCE-20251105-142103.md +0 -325
  322. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +0 -241
  323. package/one/events/GROUPS-MIGRATION.md +0 -643
  324. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +0 -432
  325. package/one/events/HANDOFF.md +0 -331
  326. package/one/events/HOOKS-DEMO.md +0 -459
  327. package/one/events/IMPLEMENTATION-CHECKLIST-20251105-142103.md +0 -274
  328. package/one/events/IMPLEMENTATION-REPORT-DOCS-20251105-142102.md +0 -394
  329. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +0 -568
  330. package/one/events/IMPLEMENTATION_SUMMARY-20251106-080938.md +0 -571
  331. package/one/events/IMPLEMENTATION_SUMMARY.md +0 -547
  332. package/one/events/INDEX-ALL-AGENTS.md +0 -190
  333. package/one/events/INDEX-FRONTEND-TESTING.md +0 -524
  334. package/one/events/INDEX-PROBLEM-SOLVER.md +0 -488
  335. package/one/events/INDEX-QUALITY-AGENT-INFER65.md +0 -455
  336. package/one/events/INDEX.md +0 -295
  337. package/one/events/INDEX_QUICK_START_REDESIGN-20251106-080939.md +0 -342
  338. package/one/events/INSTALL-TESTS.md +0 -311
  339. package/one/events/INSTALLATION_FOLDERS.md +0 -534
  340. package/one/events/INSTALLATION_FOLDERS_FILES.md +0 -223
  341. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +0 -437
  342. package/one/events/INTEGRATION-ARCHITECTURE.md +0 -579
  343. package/one/events/INTEGRATION-CHECKLIST.md +0 -1252
  344. package/one/events/INTEGRATION-ORCHESTRATION.md +0 -2641
  345. package/one/events/INTEGRATION-SUMMARY.md +0 -671
  346. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +0 -684
  347. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +0 -660
  348. package/one/events/LANDING-PAGE-QUICKSTART.md +0 -425
  349. package/one/events/LICENSE.md +0 -107
  350. package/one/events/MASTER-COORDINATION-PLAN.md +0 -613
  351. package/one/events/MASTER-ORCHESTRATION-INFER65.md +0 -441
  352. package/one/events/MASTER-PLAN-SUMMARY.md +0 -309
  353. package/one/events/MCP-CONFIGURATION.md +0 -354
  354. package/one/events/MCP-SETUP-COMPLETE.md +0 -223
  355. package/one/events/MIGRATION-REPORT.md +0 -453
  356. package/one/events/MIGRATION.md +0 -87
  357. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +0 -1663
  358. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +0 -643
  359. package/one/events/NEWS-COMMANDS.md +0 -506
  360. package/one/events/NEWS-SYSTEM-SUMMARY.md +0 -480
  361. package/one/events/NODE-UPGRADE.md +0 -129
  362. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +0 -416
  363. package/one/events/ONTOLOGY-HOOKS-README.md +0 -718
  364. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +0 -383
  365. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +0 -569
  366. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +0 -491
  367. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +0 -504
  368. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +0 -221
  369. package/one/events/PACKAGE-STRUCTURE.md +0 -328
  370. package/one/events/PLAN-COMPLETE.md +0 -429
  371. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +0 -349
  372. package/one/events/PROBLEM-SOLVER-EXECUTIVE-SUMMARY.md +0 -484
  373. package/one/events/PROBLEM-SOLVER-QUICKSTART.md +0 -420
  374. package/one/events/PROJECTS-PLAN-SUMMARY.md +0 -480
  375. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +0 -585
  376. package/one/events/QA-CHECKLIST.md +0 -692
  377. package/one/events/QUALITY-AGENT-SUMMARY.md +0 -334
  378. package/one/events/QUALITY-EXECUTION-CHECKLIST.md +0 -593
  379. package/one/events/QUICK-REFERENCE-FRONTEND-TESTING.md +0 -475
  380. package/one/events/QUICK-START-ONTOLOGY.md +0 -426
  381. package/one/events/QUICK_START_REDESIGN-20251106-080938.md +0 -400
  382. package/one/events/README-PROBLEM-SOLVER.md +0 -394
  383. package/one/events/README-archived.md +0 -537
  384. package/one/events/README_QUICK_START_REDESIGN-20251106-080938.md +0 -484
  385. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +0 -657
  386. package/one/events/SEARCH_DEMO_DELIVERY.md +0 -433
  387. package/one/events/SEARCH_DEMO_SUMMARY.md +0 -321
  388. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +0 -399
  389. package/one/events/SECURITY-AUDIT-FIXES.md +0 -394
  390. package/one/events/SECURITY-SCAN-COMPLETE.md +0 -299
  391. package/one/events/SHOP-BUILD-STATUS.md +0 -132
  392. package/one/events/SHOP-PREMIUM-UPDATE.md +0 -165
  393. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +0 -280
  394. package/one/events/SITE-WIDE-GRADIENT-FIX.md +0 -317
  395. package/one/events/SPECIALIST-QUICK-REFERENCE.md +0 -678
  396. package/one/events/STORE-PRODUCTION-READY-STATUS.md +0 -377
  397. package/one/events/STRIPE-INTEGRATION.md +0 -432
  398. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +0 -447
  399. package/one/events/STRIPE-SETUP-GUIDE.md +0 -480
  400. package/one/events/TEST-PLAN-INDEX.md +0 -364
  401. package/one/events/TEST-PLAN.md +0 -1435
  402. package/one/events/TEST-SUMMARY.md +0 -411
  403. package/one/events/TESTING-DELIVERY.txt +0 -372
  404. package/one/events/TESTS-QUICK-REF.md +0 -280
  405. package/one/events/TRANSITIONS-QUICK-START.md +0 -159
  406. package/one/events/TRANSPARENCY-FIXES.md +0 -293
  407. package/one/events/TYPESCRIPT_FIXES.md +0 -170
  408. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +0 -412
  409. package/one/events/TYPESCRIPT_FIXES_INDEX.md +0 -359
  410. package/one/events/VERIFICATION_CHECKLIST-20251106-080938.md +0 -326
  411. package/one/events/VIEW-TRANSITIONS.md +0 -446
  412. package/one/events/agent-command-implementation.md +0 -305
  413. package/one/events/agent-director-enhancement-summary.md +0 -404
  414. package/one/events/agent-director-routing-update.md +0 -214
  415. package/one/events/agent-onboard-implementation-summary.md +0 -475
  416. package/one/events/agent-ontology-alignment-completion.md +0 -263
  417. package/one/events/ai-integration-complete.md +0 -294
  418. package/one/events/ai-integration-lessons-learned.md +0 -511
  419. package/one/events/backend-integration-tests.md +0 -624
  420. package/one/events/backend-structure-diagram.txt +0 -393
  421. package/one/events/backend-structure-summary.txt +0 -269
  422. package/one/events/bullfm-video-podcast-analysis.md +0 -319
  423. package/one/events/clean-agent-ontology-cleanup-report.md +0 -371
  424. package/one/events/clean-agent-todo-analysis-summary.md +0 -336
  425. package/one/events/cloudflare-automation-complete.md +0 -350
  426. package/one/events/cloudflare-pages-infrastructure-setup.md +0 -282
  427. package/one/events/contact-page-complete.md +0 -316
  428. package/one/events/convex-analysis-index.md +0 -322
  429. package/one/events/convex-structure-analysis.md +0 -718
  430. package/one/events/creation-instructions-9-todos.md +0 -906
  431. package/one/events/cycle-3-video-player-port-20251108.md +0 -368
  432. package/one/events/cycle-3-video-player-port-complete-20251108.md +0 -334
  433. package/one/events/deployment-installation-folders.md +0 -178
  434. package/one/events/deployment-ops-summary.md +0 -386
  435. package/one/events/deployment-verification.md +0 -366
  436. package/one/events/design-spec-complete.md +0 -226
  437. package/one/events/documentation-audit-index.md +0 -473
  438. package/one/events/documentation-audit-summary.md +0 -417
  439. package/one/events/documentation-improvement-roadmap.md +0 -906
  440. package/one/events/documentation-standards-compliance-report.md +0 -538
  441. package/one/events/documentation-updates.md +0 -370
  442. package/one/events/events.md +0 -563
  443. package/one/events/fix-product-hydration-20251106.md +0 -211
  444. package/one/events/frontend-effects-complete.md +0 -584
  445. package/one/events/frontend-effects-orchestration.md +0 -1356
  446. package/one/events/frontend-effects-risk-register.md +0 -1055
  447. package/one/events/frontend-effects-week1-assignments.md +0 -1594
  448. package/one/events/hook-ontology-alignment-summary.md +0 -528
  449. package/one/events/installation-folders-workflow-integration.md +0 -458
  450. package/one/events/landing-page-generator.md +0 -476
  451. package/one/events/legal-assessment-2025-10-16.md +0 -1917
  452. package/one/events/master-coordination-plan.json +0 -1078
  453. package/one/events/master-plan-9-todos.md +0 -900
  454. package/one/events/mobile-performance-optimization.md +0 -179
  455. package/one/events/onboarding-implementation-complete.md +0 -523
  456. package/one/events/ontology-audit-agent-clone.md +0 -323
  457. package/one/events/ontology-test-examples.md +0 -580
  458. package/one/events/phase1-backend-implementation-complete.md +0 -536
  459. package/one/events/plan-completion-audit.md +0 -707
  460. package/one/events/plan-files-updated.md +0 -273
  461. package/one/events/production-readiness-plan.md +0 -389
  462. package/one/events/readme.md +0 -100
  463. package/one/events/release.md +0 -272
  464. package/one/events/root-cleanup-alignment-report.md +0 -265
  465. package/one/events/security-fixes-2025-01-15.md +0 -226
  466. package/one/events/separate-implementation-status.md +0 -555
  467. package/one/events/server-command-optimization-20251108.md +0 -150
  468. package/one/events/session-summary-2025-10-18.md +0 -366
  469. package/one/events/skills-complete.md +0 -351
  470. package/one/events/skills-infer-6-10-summary.md +0 -70
  471. package/one/events/skills-phase1-complete.md +0 -281
  472. package/one/events/specialist-assignments.md +0 -766
  473. package/one/events/structural-analysis-architecture-vs-plans.md +0 -600
  474. package/one/events/test-dashboard.md +0 -363
  475. package/one/events/test-index.md +0 -421
  476. package/one/events/test-report-ontology.md +0 -611
  477. package/one/events/testing-summary.md +0 -388
  478. package/one/events/todo-agent-builder.md +0 -1180
  479. package/one/events/todo-agent-director.md +0 -164
  480. package/one/events/todo-agent-documenter.md +0 -1815
  481. package/one/events/todo-agent-frontend.md +0 -1542
  482. package/one/events/todo-agent-problem-solver.md +0 -1682
  483. package/one/events/todo-agent-quality.md +0 -1647
  484. package/one/events/todo-refactoring-complete.md +0 -408
  485. package/one/events/wave1-backend-implementation-complete.md +0 -698
  486. package/one/events/web-AI_INTEGRATION_PHASE2_SUMMARY-20251111-152540.md +0 -529
  487. package/one/events/web-BUY-IN-CHATGPT-README-20251116-235241.md +0 -491
  488. package/one/events/web-CHARTS-IMPLEMENTATION-20251106-080939.md +0 -576
  489. package/one/events/web-CHARTS-QUICKSTART-20251106-080939.md +0 -416
  490. package/one/events/web-CODE-HIGHLIGHTING-SUMMARY-20251111-152540.md +0 -442
  491. package/one/events/web-DEPLOYMENT_SUMMARY-20251116-005428.md +0 -290
  492. package/one/events/web-DESIGN-SUMMARY-20251106-080939.md +0 -514
  493. package/one/events/web-README-AI-INTEGRATION-20251111-152540.md +0 -196
  494. package/one/events/web-RECHARTS-INTEGRATION-20251111-152540.md +0 -265
  495. package/one/events/web-RELEASE_OPTIMIZATION_PLAN-20251116-005428.md +0 -447
  496. package/one/events/web-TEST-CLEANUP-20251105-143205.md +0 -3
  497. package/one/events/web-USING-ANY-COMPONENT-IN-CHAT-20251111-152540.md +0 -561
  498. package/one/events/web-test-code-highlighting-20251111-152540.md +0 -231
  499. package/one/groups/features.md +0 -2904
  500. package/one/groups/groups.md +0 -587
  501. package/one/groups/one.md +0 -619
  502. package/one/groups/strategy-copy.md +0 -887
  503. package/one/learning/.obsidian/app.json +0 -1
  504. package/one/learning/.obsidian/appearance.json +0 -1
  505. package/one/learning/.obsidian/core-plugins.json +0 -33
  506. package/one/learning/.obsidian/ecommerce-ontology.md +0 -210
  507. package/one/learning/.obsidian/workspace.json +0 -211
  508. package/one/learning/100-inference-quick-reference.md +0 -449
  509. package/one/learning/ag-ui-protocol.md +0 -613
  510. package/one/learning/agent-onboard-usage.md +0 -630
  511. package/one/learning/agentic-commerce.md +0 -146
  512. package/one/learning/ai-agents-vs-memecoins-thesis.md +0 -683
  513. package/one/learning/ai-api-reference.md +0 -715
  514. package/one/learning/ai-platform.md +0 -323
  515. package/one/learning/ai-quickstart.md +0 -355
  516. package/one/learning/ai-sdk-implementation.md +0 -436
  517. package/one/learning/ai-token-crypto-analysis-framework.md +0 -1191
  518. package/one/learning/ai-token-paradigm-shift-2025.md +0 -732
  519. package/one/learning/altcoin-cycle-prediction-ontology.md +0 -884
  520. package/one/learning/altcoin-cycle-trading-strategy.md +0 -642
  521. package/one/learning/architecture-any-backend.md +0 -1589
  522. package/one/learning/architecture-diagram.md +0 -404
  523. package/one/learning/architecture-frontend.md +0 -1014
  524. package/one/learning/architecture.md +0 -1742
  525. package/one/learning/archived/ontology.old.md +0 -2840
  526. package/one/learning/astro-effect-complete-vision.md +0 -2148
  527. package/one/learning/astro-effect-simple-architecture.md +0 -750
  528. package/one/learning/audit-agent-onboard-alignment.md +0 -481
  529. package/one/learning/audit-agent-sales-alignment.md +0 -444
  530. package/one/learning/backend-api-reference.md +0 -728
  531. package/one/learning/cascading-context-specification.md +0 -1617
  532. package/one/learning/claude-code-integration.md +0 -1293
  533. package/one/learning/cli-claude-handoff.md +0 -736
  534. package/one/learning/context-engineering.md +0 -610
  535. package/one/learning/crypto-analysis-strategy.md +0 -1276
  536. package/one/learning/crypto-cycle-2024-2025-analysis.md +0 -44
  537. package/one/learning/crypto.md +0 -978
  538. package/one/learning/develop/design.md +0 -364
  539. package/one/learning/develop/index.md +0 -145
  540. package/one/learning/development-commands.md +0 -251
  541. package/one/learning/docs.md +0 -627
  542. package/one/learning/dsl.md +0 -1678
  543. package/one/learning/event-driven-documentation.md +0 -270
  544. package/one/learning/files.md +0 -2489
  545. package/one/learning/frontend.md +0 -1056
  546. package/one/learning/games-english.md +0 -691
  547. package/one/learning/games.md +0 -1082
  548. package/one/learning/generative-ui-patterns.md +0 -559
  549. package/one/learning/guidelines.md +0 -314
  550. package/one/learning/hono.md +0 -2127
  551. package/one/learning/implementation-examples.md +0 -2554
  552. package/one/learning/installation-folders.md +0 -366
  553. package/one/learning/institutional-cycle-paradigm-2025.md +0 -555
  554. package/one/learning/knowledge.md +0 -660
  555. package/one/learning/language.md +0 -998
  556. package/one/learning/lessons-learned.md +0 -378
  557. package/one/learning/lessons-website-building-focus.md +0 -382
  558. package/one/learning/merge-report.md +0 -254
  559. package/one/learning/metadata-system.md +0 -504
  560. package/one/learning/nine-padel-playbook.md +0 -229
  561. package/one/learning/one-protocol-ai-agents.md +0 -892
  562. package/one/learning/one-protocol-executive-report.md +0 -617
  563. package/one/learning/one-protocol-standard.md +0 -869
  564. package/one/learning/one-protocol-whitepaper.md +0 -756
  565. package/one/learning/ontology-blog.yaml +0 -47
  566. package/one/learning/ontology-cheatsheet.md +0 -617
  567. package/one/learning/ontology-community.yaml +0 -65
  568. package/one/learning/ontology-core-universal.md +0 -740
  569. package/one/learning/ontology-core.yaml +0 -63
  570. package/one/learning/ontology-courses.yaml +0 -76
  571. package/one/learning/ontology-creator.md +0 -402
  572. package/one/learning/ontology-crypto.md +0 -1603
  573. package/one/learning/ontology-developer-guide.md +0 -814
  574. package/one/learning/ontology-documentation.md +0 -377
  575. package/one/learning/ontology-ecommerce.md +0 -269
  576. package/one/learning/ontology-education-game.md +0 -1654
  577. package/one/learning/ontology-education.md +0 -938
  578. package/one/learning/ontology-engineering-specification.md +0 -1310
  579. package/one/learning/ontology-engineering.md +0 -1676
  580. package/one/learning/ontology-files.yaml +0 -525
  581. package/one/learning/ontology-frontend-master.md +0 -2898
  582. package/one/learning/ontology-frontend-specifications.md +0 -2196
  583. package/one/learning/ontology-frontend.md +0 -2475
  584. package/one/learning/ontology-index.md +0 -397
  585. package/one/learning/ontology-minimal.yaml +0 -301
  586. package/one/learning/ontology-portfolio.yaml +0 -45
  587. package/one/learning/ontology-quickstart.md +0 -602
  588. package/one/learning/ontology-release.md +0 -317
  589. package/one/learning/ontology-shop.yaml +0 -148
  590. package/one/learning/ontology-tokens.yaml +0 -51
  591. package/one/learning/ontology-tutorial.md +0 -455
  592. package/one/learning/ontology-v2.md +0 -4449
  593. package/one/learning/ontology-video-script.md +0 -939
  594. package/one/learning/ontology-visual-guide.md +0 -378
  595. package/one/learning/ontology.md +0 -3847
  596. package/one/learning/ontology.yaml +0 -1653
  597. package/one/learning/parallel-agents.md +0 -932
  598. package/one/learning/patterns/backend/convex-mutation-pattern.md +0 -130
  599. package/one/learning/patterns/backend/convex-query-pattern.md +0 -143
  600. package/one/learning/patterns/backend/mutation-template.md +0 -249
  601. package/one/learning/patterns/backend/query-template.md +0 -286
  602. package/one/learning/patterns/backend/service-template.md +0 -258
  603. package/one/learning/patterns/design/component-architecture.md +0 -435
  604. package/one/learning/patterns/design/index.md +0 -160
  605. package/one/learning/patterns/design/test-driven-design-pattern.md +0 -196
  606. package/one/learning/patterns/design/wireframe-template.md +0 -250
  607. package/one/learning/patterns/frontend/component-template.md +0 -246
  608. package/one/learning/patterns/frontend/form-template.md +0 -348
  609. package/one/learning/patterns/frontend/page-template.md +0 -209
  610. package/one/learning/patterns/frontend/react-component-pattern.md +0 -188
  611. package/one/learning/patterns/test/acceptance-criteria-template.md +0 -396
  612. package/one/learning/patterns/test/technical-test-template.md +0 -566
  613. package/one/learning/patterns/test/test-driven-pattern.md +0 -160
  614. package/one/learning/patterns/test/user-flow-template.md +0 -272
  615. package/one/learning/performance.md +0 -459
  616. package/one/learning/provider-agnostic-content.md +0 -995
  617. package/one/learning/provider-creation-guide.md +0 -1082
  618. package/one/learning/quality-loop.md +0 -419
  619. package/one/learning/quick-start-ontology-mapping.md +0 -773
  620. package/one/learning/readme-architecture.md +0 -158
  621. package/one/learning/readme.md +0 -149
  622. package/one/learning/rules.md +0 -644
  623. package/one/learning/score.md +0 -85
  624. package/one/learning/specifications.md +0 -873
  625. package/one/learning/tags.md +0 -148
  626. package/one/learning/todo-template.md +0 -269
  627. package/one/learning/todo.md +0 -269
  628. package/one/learning/troubleshooting.md +0 -434
  629. package/one/learning/typescript-patterns.md +0 -321
  630. package/one/learning/universal-generation-language.md +0 -827
  631. package/one/learning/x402-research.md +0 -104
  632. package/one/license.md +0 -107
  633. package/one/paths/a2a.md +0 -600
  634. package/one/paths/acp.md +0 -808
  635. package/one/paths/acps.md +0 -749
  636. package/one/paths/agentkit.md +0 -367
  637. package/one/paths/agui.md +0 -785
  638. package/one/paths/any-backend.md +0 -1720
  639. package/one/paths/ap2.md +0 -1072
  640. package/one/paths/api/queries-reference.md +0 -860
  641. package/one/paths/api-docs.md +0 -1909
  642. package/one/paths/api-reference.md +0 -1029
  643. package/one/paths/api.md +0 -2208
  644. package/one/paths/architecture-diagram.md +0 -112
  645. package/one/paths/communications.md +0 -467
  646. package/one/paths/connections.md +0 -357
  647. package/one/paths/copilotkit.md +0 -1577
  648. package/one/paths/cryptonetworks.md +0 -799
  649. package/one/paths/documentation.md +0 -1138
  650. package/one/paths/effect.md +0 -297
  651. package/one/paths/elizaos.md +0 -1308
  652. package/one/paths/groups.md +0 -814
  653. package/one/paths/inference.md +0 -76
  654. package/one/paths/integration-examples.md +0 -893
  655. package/one/paths/integration-guide.md +0 -887
  656. package/one/paths/integration-phase2.md +0 -754
  657. package/one/paths/kyc.md +0 -650
  658. package/one/paths/mcp.md +0 -860
  659. package/one/paths/membership.md +0 -1170
  660. package/one/paths/middleware.md +0 -1085
  661. package/one/paths/multitenant.md +0 -1359
  662. package/one/paths/n8n.md +0 -1033
  663. package/one/paths/patterns.md +0 -107
  664. package/one/paths/protocols.md +0 -297
  665. package/one/paths/relationships.md +0 -125
  666. package/one/paths/schema.md +0 -605
  667. package/one/paths/service-layer.md +0 -568
  668. package/one/paths/vectors.md +0 -225
  669. package/one/paths/wordpress.md +0 -1320
  670. package/one/paths/workflow-copy.md +0 -923
  671. package/one/paths/workflow-examples.md +0 -759
  672. package/one/paths/workflow-onboarding.md +0 -701
  673. package/one/paths/workflow.md +0 -923
  674. package/one/paths/workflows/delegation.md +0 -903
  675. package/one/paths/workflows/frontend.md +0 -1055
  676. package/one/paths/workflows/strategy.md +0 -921
  677. package/one/paths/workflows/tasks.md +0 -716
  678. package/one/paths/x402-baazar.md +0 -131
  679. package/one/paths/x402.md +0 -1353
  680. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  681. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  682. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  683. package/one/things/CHECKLIST.md +0 -407
  684. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  685. package/one/things/ONE.md +0 -529
  686. package/one/things/agents/agent-backend.md +0 -1501
  687. package/one/things/agents/agent-builder.md +0 -1064
  688. package/one/things/agents/agent-clean.md +0 -1112
  689. package/one/things/agents/agent-clone.md +0 -1324
  690. package/one/things/agents/agent-deploy.md +0 -986
  691. package/one/things/agents/agent-designer.md +0 -2305
  692. package/one/things/agents/agent-director.md +0 -1526
  693. package/one/things/agents/agent-documenter.md +0 -1129
  694. package/one/things/agents/agent-frontend.md +0 -1201
  695. package/one/things/agents/agent-integrator.md +0 -1269
  696. package/one/things/agents/agent-lawyer.md +0 -1371
  697. package/one/things/agents/agent-problem-solver.md +0 -1457
  698. package/one/things/agents/agent-quality.md +0 -1483
  699. package/one/things/agents/agent-sales.md +0 -1074
  700. package/one/things/cascade/cascade.yaml +0 -481
  701. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  702. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  703. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  704. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  705. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  706. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  707. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  708. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  709. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  710. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  711. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  712. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  713. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  714. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  715. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  716. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  717. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  718. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  719. package/one/things/cascade/docs/examples/readme.md +0 -259
  720. package/one/things/cascade/docs/getting-started.md +0 -533
  721. package/one/things/cascade/docs/workflow.md +0 -1378
  722. package/one/things/cascade/readme.md +0 -379
  723. package/one/things/cascade/templates/feature-template.md +0 -289
  724. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  725. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  726. package/one/things/claude/agents/analyst.md +0 -508
  727. package/one/things/claude/agents/architect.md +0 -505
  728. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  729. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  730. package/one/things/claude/agents/builder-repo.md +0 -532
  731. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  732. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  733. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  734. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  735. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  736. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  737. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  738. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  739. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  740. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  741. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  742. package/one/things/claude/agents/content-formatter.md +0 -571
  743. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  744. package/one/things/claude/agents/content-image-formatter.md +0 -560
  745. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  746. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  747. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  748. package/one/things/claude/agents/content-team-manager.md +0 -647
  749. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  750. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  751. package/one/things/claude/agents/core-manager.md +0 -607
  752. package/one/things/claude/agents/core-master.md +0 -426
  753. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  754. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  755. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  756. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  757. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  758. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  759. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  760. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  761. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  762. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  763. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  764. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  765. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  766. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  767. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  768. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  769. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  770. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  771. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  772. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  773. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  774. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  775. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  776. package/one/things/claude/agents/customer-success-manager.md +0 -574
  777. package/one/things/claude/agents/dev.md +0 -406
  778. package/one/things/claude/agents/documenter.md +0 -548
  779. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  780. package/one/things/claude/agents/engagement-specialist.md +0 -502
  781. package/one/things/claude/agents/engineering-architect.md +0 -387
  782. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  783. package/one/things/claude/agents/engineering-developer.md +0 -386
  784. package/one/things/claude/agents/engineering-director.md +0 -322
  785. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  786. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  787. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  788. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  789. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  790. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  791. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  792. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  793. package/one/things/claude/agents/improver.md +0 -805
  794. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  795. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  796. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  797. package/one/things/claude/agents/market-research-analyst.md +0 -435
  798. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  799. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  800. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  801. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  802. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  803. package/one/things/claude/agents/marketing-director.md +0 -402
  804. package/one/things/claude/agents/marketing-engagement.md +0 -331
  805. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  806. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  807. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  808. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  809. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  810. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  811. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  812. package/one/things/claude/agents/mission-commander.md +0 -378
  813. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  814. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  815. package/one/things/claude/agents/npx.md +0 -946
  816. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  817. package/one/things/claude/agents/one-master.md +0 -378
  818. package/one/things/claude/agents/one-orchestrator.md +0 -345
  819. package/one/things/claude/agents/one.md +0 -658
  820. package/one/things/claude/agents/playbook-generator.md +0 -526
  821. package/one/things/claude/agents/pm.md +0 -349
  822. package/one/things/claude/agents/po.md +0 -370
  823. package/one/things/claude/agents/qa.md +0 -361
  824. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  825. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  826. package/one/things/claude/agents/research-market-analyst.md +0 -324
  827. package/one/things/claude/agents/research-team-manager.md +0 -489
  828. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  829. package/one/things/claude/agents/sales-team-manager.md +0 -407
  830. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  831. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  832. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  833. package/one/things/claude/agents/service-success-manager.md +0 -324
  834. package/one/things/claude/agents/service-team-manager.md +0 -405
  835. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  836. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  837. package/one/things/claude/agents/sm.md +0 -352
  838. package/one/things/claude/agents/story-teller.md +0 -498
  839. package/one/things/claude/agents/task-master.md +0 -621
  840. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  841. package/one/things/claude/agents/tester.md +0 -595
  842. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  843. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  844. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  845. package/one/things/claude/agents/upsell-strategist.md +0 -503
  846. package/one/things/claude/agents/ux-expert.md +0 -360
  847. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  848. package/one/things/claude/claude-code-hooks-development.json +0 -21
  849. package/one/things/claude/claude-code-hooks-production.json +0 -21
  850. package/one/things/claude/claude-code-hooks.json +0 -25
  851. package/one/things/claude/commands/agent.md +0 -124
  852. package/one/things/claude/commands/cascade-status.md +0 -153
  853. package/one/things/claude/commands/ingest.md +0 -343
  854. package/one/things/claude/commands/ingestor.md +0 -158
  855. package/one/things/claude/commands/mission.md +0 -103
  856. package/one/things/claude/commands/npx.md +0 -156
  857. package/one/things/claude/commands/one.md +0 -486
  858. package/one/things/claude/commands/quality-check.md +0 -252
  859. package/one/things/claude/commands/smart-route.md +0 -261
  860. package/one/things/claude/commands/start.md +0 -139
  861. package/one/things/claude/commands/story.md +0 -103
  862. package/one/things/claude/commands/task.md +0 -193
  863. package/one/things/claude/hook-bypass.json +0 -32
  864. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  865. package/one/things/claude/hooks/build-hook.sh +0 -156
  866. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  867. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  868. package/one/things/claude/hooks/format-hook.sh +0 -43
  869. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  870. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  871. package/one/things/claude/hooks/hook-logger.sh +0 -89
  872. package/one/things/claude/hooks/lint-hook.sh +0 -140
  873. package/one/things/claude/hooks/notification-hook.sh +0 -204
  874. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  875. package/one/things/claude/hooks/performance-metrics.json +0 -25
  876. package/one/things/claude/hooks/security-hook.sh +0 -256
  877. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  878. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  879. package/one/things/claude/hooks/test-hook.sh +0 -145
  880. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  881. package/one/things/claude/settings-local.json +0 -86
  882. package/one/things/cli/cli-code.md +0 -677
  883. package/one/things/cli/cli-compiler-code.md +0 -677
  884. package/one/things/cli/cli.md +0 -871
  885. package/one/things/components/card-shadcn.md +0 -953
  886. package/one/things/components/card.md +0 -1041
  887. package/one/things/components.md +0 -1743
  888. package/one/things/componets.md +0 -19
  889. package/one/things/contracts/Move.toml +0 -12
  890. package/one/things/contracts/README.md +0 -288
  891. package/one/things/contracts/one.move +0 -762
  892. package/one/things/contracts/sdk.ts +0 -579
  893. package/one/things/creator-diagram.md +0 -184
  894. package/one/things/crypto/FEATURES.md +0 -78
  895. package/one/things/crypto/ONECORE.md +0 -62
  896. package/one/things/crypto/ONECOREFAQ.md +0 -22
  897. package/one/things/crypto/ONECOREHOW.md +0 -46
  898. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  899. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  900. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  901. package/one/things/crypto/ONEPRO.md +0 -60
  902. package/one/things/crypto/ONEPROFAQ.md +0 -22
  903. package/one/things/crypto/ONEPROHOW.md +0 -53
  904. package/one/things/crypto/READMEAGENCY.md +0 -64
  905. package/one/things/crypto/VSL.md +0 -45
  906. package/one/things/crypto/WebsiteCopy.md +0 -176
  907. package/one/things/demo-accessibility-animations.md +0 -1025
  908. package/one/things/demo-components.md +0 -1310
  909. package/one/things/demo-design-summary.md +0 -692
  910. package/one/things/demo-design-system.md +0 -973
  911. package/one/things/demo-page-layouts.md +0 -1016
  912. package/one/things/design-system.md +0 -832
  913. package/one/things/designs/accessibility-audit.md +0 -877
  914. package/one/things/designs/component-specifications.md +0 -855
  915. package/one/things/designs/design-overview.md +0 -377
  916. package/one/things/designs/design-tokens.md +0 -448
  917. package/one/things/designs/wireframes-dashboard.md +0 -710
  918. package/one/things/docs/api-requests.md +0 -987
  919. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  920. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  921. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  922. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  923. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  924. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  925. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  926. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  927. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  928. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  929. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  930. package/one/things/docs/ecommerce/demo.astro +0 -309
  931. package/one/things/examples/children/lemonade-stand.md +0 -404
  932. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  933. package/one/things/features/1-1-agent-prompts.md +0 -562
  934. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  935. package/one/things/features/1-3-event-coordination.md +0 -547
  936. package/one/things/features/1-4-knowledge-management.md +0 -652
  937. package/one/things/features/1-5-quality-loops.md +0 -725
  938. package/one/things/features/1-6-numbering-structure.md +0 -639
  939. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  940. package/one/things/features/2-2-config-system.md +0 -3242
  941. package/one/things/features/2-3-effectts-services.md +0 -1645
  942. package/one/things/features/2-4-react-hooks.md +0 -2136
  943. package/one/things/features/2-5-auth-migration.md +0 -2144
  944. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  945. package/one/things/features/2-7-alternative-providers.md +0 -2578
  946. package/one/things/features/2-7-implementation-report.md +0 -724
  947. package/one/things/features/2-cli.md +0 -1720
  948. package/one/things/features/2-design.md +0 -1770
  949. package/one/things/features/2-tests.md +0 -576
  950. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  951. package/one/things/features/DECOUPLING.md +0 -290
  952. package/one/things/features/DEPLOYMENT.md +0 -470
  953. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  954. package/one/things/features/improve.md +0 -861
  955. package/one/things/features/remove-convex-deps.md +0 -63
  956. package/one/things/features/top-features.md +0 -87
  957. package/one/things/features/use-one-backend.md +0 -1217
  958. package/one/things/features-in-english.md +0 -200
  959. package/one/things/files.yaml +0 -721
  960. package/one/things/ideas/1-create-workflow.md +0 -207
  961. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  962. package/one/things/implementation/backend-guide.md +0 -457
  963. package/one/things/interface.md +0 -257
  964. package/one/things/landing-page-implementation.md +0 -455
  965. package/one/things/legal/README.md +0 -234
  966. package/one/things/legal/privacy-policy.md +0 -1227
  967. package/one/things/legal/terms-of-service.md +0 -1432
  968. package/one/things/master-workflow-plan.md +0 -806
  969. package/one/things/pay.one.ie.md +0 -53
  970. package/one/things/plans/0-in-sync.md +0 -136
  971. package/one/things/plans/0-timeline.md +0 -36
  972. package/one/things/plans/1-create-workflow.md +0 -732
  973. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  974. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  975. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  976. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  977. package/one/things/plans/ai-elements-integration.md +0 -483
  978. package/one/things/plans/ai-elements.md +0 -1278
  979. package/one/things/plans/ai-integration-plan.md +0 -263
  980. package/one/things/plans/ai-integration.md +0 -996
  981. package/one/things/plans/ai-sdk.md +0 -798
  982. package/one/things/plans/ai-tools.md +0 -621
  983. package/one/things/plans/app.md +0 -832
  984. package/one/things/plans/architecture-summary.md +0 -312
  985. package/one/things/plans/async-ai-agents.md +0 -233
  986. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  987. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  988. package/one/things/plans/backend-ontology-conformance.md +0 -475
  989. package/one/things/plans/backend-status.md +0 -599
  990. package/one/things/plans/backend-structure.md +0 -847
  991. package/one/things/plans/backend-target-structure.md +0 -482
  992. package/one/things/plans/backend.md +0 -1175
  993. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  994. package/one/things/plans/better-auth-any-backend.md +0 -1896
  995. package/one/things/plans/better-auth-available-features.md +0 -273
  996. package/one/things/plans/big-plan.md +0 -52
  997. package/one/things/plans/cli-updates-required.md +0 -320
  998. package/one/things/plans/complete-step-by-step.md +0 -1409
  999. package/one/things/plans/components.md +0 -709
  1000. package/one/things/plans/convex-agents.md +0 -1034
  1001. package/one/things/plans/convex-better-auth.md +0 -1141
  1002. package/one/things/plans/convex-on-off.md +0 -407
  1003. package/one/things/plans/crypto-token-researcher.md +0 -629
  1004. package/one/things/plans/data-quality-metrics.md +0 -745
  1005. package/one/things/plans/deep-researcher-agent.md +0 -466
  1006. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  1007. package/one/things/plans/deployment-architecture.md +0 -469
  1008. package/one/things/plans/desktop.md +0 -1139
  1009. package/one/things/plans/development-plan.md +0 -1283
  1010. package/one/things/plans/development-workflow-tldr.md +0 -207
  1011. package/one/things/plans/development-workflow.md +0 -959
  1012. package/one/things/plans/dsl-claude-code.md +0 -1011
  1013. package/one/things/plans/effect-components.md +0 -1743
  1014. package/one/things/plans/effect-patterns-reference.md +0 -2235
  1015. package/one/things/plans/effect.md +0 -1806
  1016. package/one/things/plans/email.md +0 -966
  1017. package/one/things/plans/enhance-auth.md +0 -1692
  1018. package/one/things/plans/execution-strategy.md +0 -1291
  1019. package/one/things/plans/existing-infrastructure.md +0 -712
  1020. package/one/things/plans/feature-based-sites.md +0 -894
  1021. package/one/things/plans/frontend-effects.md +0 -1276
  1022. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  1023. package/one/things/plans/improve-codebase.md +0 -1811
  1024. package/one/things/plans/install-components.md +0 -215
  1025. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  1026. package/one/things/plans/landing.md +0 -820
  1027. package/one/things/plans/layout.md +0 -249
  1028. package/one/things/plans/mail-backend.md +0 -1361
  1029. package/one/things/plans/mail.md +0 -2677
  1030. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  1031. package/one/things/plans/mcp-simple.md +0 -248
  1032. package/one/things/plans/multi-ontology-architecture.md +0 -885
  1033. package/one/things/plans/next-features.md +0 -114
  1034. package/one/things/plans/npx-agent-safety.md +0 -785
  1035. package/one/things/plans/npx-agent.md +0 -1089
  1036. package/one/things/plans/onboarding.md +0 -51
  1037. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  1038. package/one/things/plans/one.md +0 -677
  1039. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  1040. package/one/things/plans/ontology-compliance-audit.md +0 -342
  1041. package/one/things/plans/ontology-driven-strategy.md +0 -882
  1042. package/one/things/plans/ontology-refine.md +0 -586
  1043. package/one/things/plans/ontology-ui-approach.md +0 -375
  1044. package/one/things/plans/open-agent.md +0 -840
  1045. package/one/things/plans/performace.md +0 -122
  1046. package/one/things/plans/phase-1-foundation.md +0 -620
  1047. package/one/things/plans/phase-3-implementation.md +0 -1037
  1048. package/one/things/plans/plan-connect-to-api.md +0 -146
  1049. package/one/things/plans/quick-wins.md +0 -1428
  1050. package/one/things/plans/r2.md +0 -777
  1051. package/one/things/plans/readme-backend-cleanup.md +0 -402
  1052. package/one/things/plans/release.md +0 -507
  1053. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  1054. package/one/things/plans/repos.md +0 -98
  1055. package/one/things/plans/separate-copy-2.md +0 -1349
  1056. package/one/things/plans/separate-copy-3.md +0 -2479
  1057. package/one/things/plans/separate-copy.md +0 -1349
  1058. package/one/things/plans/separate-demo.md +0 -864
  1059. package/one/things/plans/separate.md +0 -1999
  1060. package/one/things/plans/sequence.md +0 -2040
  1061. package/one/things/plans/shadcn-integration-summary.md +0 -510
  1062. package/one/things/plans/sidebar.md +0 -206
  1063. package/one/things/plans/skills.md +0 -709
  1064. package/one/things/plans/small-fixes.md +0 -23
  1065. package/one/things/plans/start-new.md +0 -764
  1066. package/one/things/plans/switch-off-auth.md +0 -42
  1067. package/one/things/plans/sync-checklist.md +0 -351
  1068. package/one/things/plans/test-backend-connection.md +0 -514
  1069. package/one/things/plans/unified-implementation-plan.md +0 -934
  1070. package/one/things/plans/update-demos.md +0 -581
  1071. package/one/things/plans/use-our-backend.md +0 -572
  1072. package/one/things/plans/video-backend.md +0 -638
  1073. package/one/things/plans/video-frontend.md +0 -490
  1074. package/one/things/plans/video-old-archived.md +0 -656
  1075. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  1076. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  1077. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  1078. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  1079. package/one/things/plans/workflow-files.md +0 -1210
  1080. package/one/things/plans/workflow.md +0 -1378
  1081. package/one/things/plans-u.md +0 -905
  1082. package/one/things/products/Blockchain Products.md +0 -6278
  1083. package/one/things/products/cascade-landing-page.md +0 -841
  1084. package/one/things/products/cascade.md +0 -1568
  1085. package/one/things/products/context-engineering.md +0 -1488
  1086. package/one/things/products/onthology.md +0 -15
  1087. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  1088. package/one/things/products/ontology-ui.md +0 -1429
  1089. package/one/things/products/ontology.md +0 -789
  1090. package/one/things/products/sdk.md +0 -573
  1091. package/one/things/promptkit.md +0 -930
  1092. package/one/things/repos/all-repos.md +0 -0
  1093. package/one/things/scripts-clean-mac.sh +0 -409
  1094. package/one/things/service-providers-new.md +0 -1052
  1095. package/one/things/service-providers.md +0 -1121
  1096. package/one/things/structure.md +0 -532
  1097. package/one/things/system.md +0 -618
  1098. package/one/things/templates.md +0 -294
  1099. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  1100. package/one/things/tests/2-1-test-analysis.md +0 -544
  1101. package/one/things/things.md +0 -384
  1102. package/one/things/todo-acp-integration.md +0 -744
  1103. package/one/things/todo-ai.md +0 -933
  1104. package/one/things/todo-api.md +0 -1078
  1105. package/one/things/todo-assignment.md +0 -580
  1106. package/one/things/todo-buy-chatgpt.md +0 -1450
  1107. package/one/things/todo-components.md +0 -1683
  1108. package/one/things/todo-connections.md +0 -278
  1109. package/one/things/todo-ecommerce-frontend.md +0 -1313
  1110. package/one/things/todo-ecommerce.md +0 -569
  1111. package/one/things/todo-effects.md +0 -1075
  1112. package/one/things/todo-frontend-effects.md +0 -977
  1113. package/one/things/todo-landing-page.md +0 -1091
  1114. package/one/things/todo-mail.md +0 -1160
  1115. package/one/things/todo-master-plan.md +0 -490
  1116. package/one/things/todo-onboard.md +0 -666
  1117. package/one/things/todo-one-ie.md +0 -538
  1118. package/one/things/todo-page.md +0 -606
  1119. package/one/things/todo-plans.md +0 -282
  1120. package/one/things/todo-projects.md +0 -241
  1121. package/one/things/todo-refactoring-plan.md +0 -366
  1122. package/one/things/todo-release.md +0 -654
  1123. package/one/things/todo-sequence.md +0 -1621
  1124. package/one/things/todo-use-our-backend.md +0 -1908
  1125. package/one/things/todo-workflow.md +0 -626
  1126. package/one/things/todo-x402.md +0 -2047
  1127. package/one/things/todo.md +0 -21
  1128. package/one/things/video/scripts-crypto.md +0 -835
  1129. package/one/things/video-script-backup.md +0 -318
  1130. package/one/things/video-script-demo.md +0 -382
  1131. package/one/things/video-script-ontology.md +0 -333
  1132. package/one/things/video-script.md +0 -361
@@ -1,2898 +0,0 @@
1
- ---
2
- title: Ontology Frontend Master
3
- dimension: knowledge
4
- category: ontology-frontend-master.md
5
- tags: 6-dimensions, architecture, backend, frontend, ontology, ui
6
- related_dimensions: events, groups, things
7
- scope: global
8
- created: 2025-11-03
9
- updated: 2025-11-03
10
- version: 1.0.0
11
- ai_context: |
12
- This document is part of the knowledge dimension in the ontology-frontend-master.md category.
13
- Location: one/knowledge/ontology-frontend-master.md
14
- Purpose: Documents frontend development ontology - master reference
15
- Related dimensions: events, groups, things
16
- For AI agents: Read this to understand ontology frontend master.
17
- ---
18
-
19
- # Frontend Development Ontology - Master Reference
20
-
21
- **Version:** 2.1.0
22
- **Type System:** Formal ontology for backend-agnostic Astro website development
23
- **Paradigm:** Pure declarative type theory + Provider pattern + Context engineering
24
-
25
- **Master Document:** Unified reference combining architecture, specifications, and patterns
26
-
27
- ---
28
-
29
- ## Table of Contents
30
-
31
- 1. [Overview](#overview)
32
- 2. [Core Axioms](#core-axioms)
33
- 3. [Architecture Overview](#architecture-overview)
34
- 4. [Provider Pattern & Context Engineering](#provider-pattern--context-engineering)
35
- 5. [Type Hierarchy](#type-hierarchy)
36
- 6. [What Frontend IS and IS NOT](#what-frontend-is-and-is-not)
37
- 7. [Frontend File Structure](#frontend-file-structure)
38
- 8. [Backend-Agnostic Data Layer](#backend-agnostic-data-layer)
39
- 9. [DataProvider Interface](#dataprovider-interface)
40
- 10. [Provider Implementations](#provider-implementations)
41
- 11. [Configuration](#configuration)
42
- 12. [State Management Hierarchy](#state-management-hierarchy)
43
- 13. [Effect.ts Service Layer](#effectts-service-layer)
44
- 14. [React Hooks & Integration](#react-hooks--integration)
45
- 15. [Component Patterns](#component-patterns)
46
- 16. [Page Patterns & SSR](#page-patterns--ssr)
47
- 17. [Real-Time Components](#real-time-components)
48
- 18. [Forms & Data Mutations](#forms--data-mutations)
49
- 19. [Multi-Tenant Routing](#multi-tenant-routing)
50
- 20. [Caching Ontology](#caching-ontology)
51
- 21. [Error Propagation & Handling](#error-propagation--handling)
52
- 22. [Testing Patterns](#testing-patterns)
53
- 23. [Common Mistakes & Solutions](#common-mistakes--solutions)
54
- 24. [Summary & Key Patterns](#summary--key-patterns)
55
-
56
- ---
57
-
58
- ## Overview
59
-
60
- The frontend is **purely a rendering and interaction layer**. It has:
61
-
62
- - ✅ ZERO database access (provider abstracts)
63
- - ✅ ZERO business logic (backend validates)
64
- - ✅ ZERO direct backend coupling (interface-based)
65
- - ✅ 100% backend-agnostic code
66
-
67
- **What Frontend Does:**
68
-
69
- 1. **Renders UI** from data via Astro + React
70
- 2. **Calls backend APIs** via abstract DataProvider interface (works with Convex, WordPress, Notion, Supabase, etc.)
71
- 3. **Manages local UI state** (loading, errors, forms, modals)
72
- 4. **Displays real-time updates** via subscriptions (if backend supports)
73
-
74
- **Backend Abstraction:**
75
-
76
- ```
77
- ┌─────────────────────────────────────────┐
78
- │ FRONTEND (Astro + React + Effect.ts) │
79
- │ ✅ Renders UI │
80
- │ ✅ Calls DataProvider interface │
81
- │ ✅ Manages UI state only │
82
- │ ❌ NO database, logic, validation │
83
- └──────────────────┬──────────────────────┘
84
- │ DataProvider Interface
85
- │ (6-dimension ontology)
86
- ↓
87
- ┌─────────────────────────────────────────┐
88
- │ BACKEND PROVIDERS (Choose One) │
89
- │ ├─ ConvexProvider │
90
- │ ├─ WordPressProvider │
91
- │ ├─ NotionProvider │
92
- │ ├─ SupabaseProvider │
93
- │ └─ CustomProvider │
94
- └─────────────────────────────────────────┘
95
- ```
96
-
97
- **Key Insight:** The 6-dimension ontology becomes a **universal data API**. Frontend doesn't care if data comes from Convex, WordPress, or Notion—it only knows the interface.
98
-
99
- ---
100
-
101
- ## Core Axioms
102
-
103
- ### Axiom 1: Everything is a Thing
104
-
105
- ```
106
- ∀x ∈ Frontend → x : Thing
107
- Thing ::= Page | Component | Content | Service | Provider | Configuration
108
- ```
109
-
110
- ### Axiom 2: All Things Have Type
111
-
112
- ```
113
- type : Thing → TypeID
114
- TypeID ::= String ∈ ontology.things.types
115
- ```
116
-
117
- ### Axiom 3: Things Connect
118
-
119
- ```
120
- connect : Thing × Thing → Connection
121
- Connection ::= { from: Thing, to: Thing, type: RelationType, metadata: Object }
122
- ```
123
-
124
- ### Axiom 4: Actions Emit Events
125
-
126
- ```
127
- action : Thing → Event
128
- Event ::= { type: EventType, actor: Thing, target: Thing, timestamp: Time, metadata: Object }
129
- ```
130
-
131
- ### Axiom 5: Patterns Compose
132
-
133
- ```
134
- compose : Pattern × Pattern → Pattern
135
- Pattern ::= { type: PatternType, inputs: [Thing], outputs: [Thing], transform: Function }
136
- ```
137
-
138
- ### Axiom 6: Backend Agnosticism
139
-
140
- ```
141
- ∀Provider. Provider implements DataProviderInterface → Frontend works with Provider
142
- DataProviderInterface ::= { organizations, people, things, connections, events, knowledge }
143
- ```
144
-
145
- ### Axiom 7: Context Minimalism
146
-
147
- ```
148
- ∀Operation. Load only required types, not implementations
149
- ContextUsed << ContextAvailable
150
- target_reduction: 98%+
151
- ```
152
-
153
- **Key Principle:** Frontend knows 6-dimension ontology, not backend implementation.
154
-
155
- ---
156
-
157
- ## Architecture Overview
158
-
159
- ### Three-Layer Backend-Agnostic Architecture
160
-
161
- ```
162
- ┌──────────────────────────────────────┐
163
- │ RENDERING LAYER (Astro + React) │
164
- │ - SSR pages (.astro files) │
165
- │ - Interactive components (.tsx) │
166
- │ - Astro islands for interactivity │
167
- └──────────────────┬───────────────────┘
168
- │ Effect.ts
169
- ↓
170
- ┌──────────────────────────────────────┐
171
- │ SERVICE LAYER (Effect.ts) │
172
- │ - ThingService │
173
- │ - ConnectionService │
174
- │ - Type-safe error handling │
175
- │ - Composable operations │
176
- └──────────────────┬───────────────────┘
177
- │ DataProviderInterface
178
- ↓
179
- ┌──────────────────────────────────────┐
180
- │ DATA LAYER (Providers) │
181
- │ - ConvexProvider (Convex backend) │
182
- │ - WordPressProvider (WordPress) │
183
- │ - NotionProvider (Notion) │
184
- │ - SupabaseProvider (PostgreSQL) │
185
- │ - CustomProvider (Any API) │
186
- └──────────────────────────────────────┘
187
- ```
188
-
189
- **Why Three Layers?**
190
-
191
- - **Rendering Layer:** HTML output (SSR fast, SEO friendly)
192
- - **Service Layer:** Type-safe business operations (Effect.ts)
193
- - **Data Layer:** Backend abstraction (swap backends by changing 1 config line)
194
-
195
- **Tech Stack:**
196
-
197
- - **Astro 5.14+** - SSR/SSG with file-based routing
198
- - **React 19** - Interactive components with islands architecture
199
- - **Effect.ts** - Type-safe, composable operations
200
- - **DataProvider Pattern** - Backend-agnostic interface
201
- - **Tailwind + shadcn/ui** - Component styling
202
- - **TypeScript 5.9+** - Strict type safety
203
-
204
- ---
205
-
206
- ## Provider Pattern & Context Engineering
207
-
208
- ### The Core Insight: Providers ARE Context Loaders
209
-
210
- **Problem:** Traditional frontend development loads massive context to interact with one backend.
211
-
212
- **Solution:** Provider pattern = 99.9% context reduction through interface abstraction.
213
-
214
- ```typescript
215
- {
216
- // ❌ Traditional: Load entire backend
217
- traditionalApproach: {
218
- load: "Full Convex schema + all implementations + all docs",
219
- tokens: 280_000,
220
- problem: "Frontend context explodes with backend knowledge"
221
- }
222
-
223
- // ✅ Provider pattern: Load only interface
224
- providerApproach: {
225
- load: "DataProviderInterface only (contract)",
226
- tokens: 300,
227
- benefit: "Frontend never loads backend implementation"
228
- }
229
-
230
- result: {
231
- context_reduction: "99.9%",
232
- backend_flexibility: "infinite (swap with config)",
233
- type_safety: "Effect.ts typed errors",
234
- testability: "Mock provider for tests"
235
- }
236
- }
237
- ```
238
-
239
- ### Context Engineering Formula
240
-
241
- ```typescript
242
- {
243
- traditional: {
244
- formula: "ContextSize = Σ(all_files + all_docs + all_examples)",
245
- typical: "50k-300k tokens per request",
246
- problem: "Hits context limits, slow, expensive"
247
- }
248
-
249
- provider: {
250
- formula: "ContextSize = interface_definition + operation_signatures",
251
- typical: "300-500 tokens per request",
252
- benefit: "Never hits limits, fast, cheap, infinite backends"
253
- }
254
-
255
- improvement: {
256
- context_reduction: "99%+",
257
- cost_reduction: "100x cheaper",
258
- speed_improvement: "10x faster",
259
- backend_flexibility: "∞ backends supported"
260
- }
261
- }
262
- ```
263
-
264
- ### Provider as Just-In-Time Loader
265
-
266
- **Traditional AI code generation:**
267
- ```typescript
268
- ❌ function generateCourseComponent_Traditional() {
269
- context = {
270
- convexSchema: loadConvexSchema(), // 15,000 tokens
271
- convexMutations: loadMutations(), // 20,000 tokens
272
- convexQueries: loadQueries(), // 18,000 tokens
273
- implementations: loadImplementations() // 50,000 tokens
274
- } // Total: 103,000 tokens
275
-
276
- return ai.generate(task, context)
277
- }
278
- ```
279
-
280
- **Provider pattern:**
281
- ```typescript
282
- ✅ function generateCourseComponent_Provider() {
283
- context = {
284
- interface: "DataProviderInterface", // 300 tokens
285
- operations: ["things.get", "things.list"] // Which operations needed
286
- } // Total: 300 tokens (99.7% reduction)
287
-
288
- // AI generates code using interface
289
- code = ai.generate(task, context)
290
- // Result: provider.things.get(id) - works with ANY backend
291
- return code
292
- }
293
- ```
294
-
295
- ---
296
-
297
- ## Type Hierarchy
298
-
299
- ### The Complete Frontend Type System
300
-
301
- ```
302
- Thing
303
- ├── Artifact // Code artifacts (what agents create)
304
- │ ├── Page
305
- │ │ ├── LandingPage
306
- │ │ ├── BlogIndex
307
- │ │ ├── BlogPost
308
- │ │ ├── AppPage
309
- │ │ ├── AccountPage
310
- │ │ └── APIRoute
311
- │ ├── Component
312
- │ │ ├── UIComponent
313
- │ │ ├── FeatureComponent
314
- │ │ ├── Layout
315
- │ │ └── Island
316
- │ ├── Content
317
- │ │ ├── Collection
318
- │ │ ├── Entry
319
- │ │ └── Schema
320
- │ ├── Service
321
- │ │ ├── GenericService // Handles all 66 types
322
- │ │ └── SpecializedService // Optional convenience
323
- │ ├── Provider
324
- │ │ ├── ConvexProvider
325
- │ │ ├── WordPressProvider
326
- │ │ ├── NotionProvider
327
- │ │ ├── SupabaseProvider
328
- │ │ └── CustomProvider
329
- │ └── Configuration
330
- │ ├── DisplayConfig // UI labels, icons, colors
331
- │ └── ProviderConfig // Backend URL, API keys
332
- ├── Pattern // Reusable templates
333
- ├── Interface // Abstract contracts
334
- └── Capability // Agent capabilities
335
- ```
336
-
337
- ---
338
-
339
- ## What Frontend IS and IS NOT
340
-
341
- ### ✅ Frontend IS Responsible For
342
-
343
- **1. Rendering**
344
- ```tsx
345
- // Display data from backend
346
- <h1>{course.name}</h1>
347
- <p>{course.properties.description}</p>
348
- ```
349
-
350
- **2. Calling Backend APIs**
351
- ```tsx
352
- // Get data from backend
353
- const courses = useQuery(api.queries.things.list, { type: 'course' })
354
-
355
- // Send data to backend
356
- const create = useMutation(api.mutations.things.create)
357
- await create({ type: 'course', name: 'Fitness 101', properties: {...} })
358
- ```
359
-
360
- **3. Managing UI State**
361
- ```tsx
362
- const [loading, setLoading] = useState(false)
363
- const [error, setError] = useState(null)
364
- const [formData, setFormData] = useState({})
365
- ```
366
-
367
- **4. User Interactions**
368
- ```tsx
369
- <button onClick={handleClick}>Create Course</button>
370
- <input onChange={handleChange} />
371
- ```
372
-
373
- **5. Client-Side Routing**
374
- ```tsx
375
- <Link href="/courses">View Courses</Link>
376
- ```
377
-
378
- **6. Component-Local UI Logic**
379
- ```typescript
380
- type FrontendResponsibility =
381
- | { type: "render"; data: any } // Display UI from data
382
- | { type: "call_provider"; operation: any } // Call DataProvider (not direct backend)
383
- | { type: "manage_ui_state"; state: any } // Form inputs, modals, loading
384
- | { type: "route"; path: string } // Client-side navigation
385
- | { type: "cache_display"; data: any }; // Cache UI data (not business data)
386
- ```
387
-
388
- ### ❌ Frontend IS NOT Responsible For
389
-
390
- **1. Database Operations**
391
- ```tsx
392
- // ❌ NEVER do this in frontend
393
- const courses = await db.query('things').filter(...).collect()
394
- ```
395
-
396
- **2. Business Logic**
397
- ```tsx
398
- // ❌ NEVER do this in frontend
399
- if (user.tokens < course.price) {
400
- // Calculate discount, check quotas, etc.
401
- }
402
- ```
403
-
404
- **3. Data Validation**
405
- ```tsx
406
- // ❌ NEVER trust frontend validation alone (UX hint only, backend MUST validate)
407
- if (formData.email.includes('@')) {
408
- // Backend MUST validate, not frontend
409
- }
410
- ```
411
-
412
- **4. Event Logging**
413
- ```tsx
414
- // ❌ NEVER log events in frontend
415
- await db.insert('events', { type: 'course_created', ... })
416
- ```
417
-
418
- **5. Authorization**
419
- ```tsx
420
- // ❌ NEVER check permissions in frontend alone (UI hint only, backend MUST authorize)
421
- if (user.role === 'admin') {
422
- // Backend MUST authorize, frontend only for UI hints
423
- }
424
- ```
425
-
426
- **6. Backend-Specific Code**
427
- ```typescript
428
- type FrontendProhibition =
429
- | { type: "database_access" }
430
- | { type: "business_logic" }
431
- | { type: "event_logging" }
432
- | { type: "authorization_enforcement" }
433
- | { type: "data_validation_enforcement" }
434
- | { type: "org_filtering" }
435
- | { type: "backend_specific_code" };
436
- ```
437
-
438
- ---
439
-
440
- ## Frontend File Structure
441
-
442
- ```
443
- frontend/ # Frontend repo (separate from backend)
444
- ├── src/
445
- │ ├── pages/ # Astro pages (SSR/SSG)
446
- │ │ ├── index.astro # Homepage
447
- │ │ ├── courses/
448
- │ │ │ ├── index.astro # Course list (SSR)
449
- │ │ │ └── [id].astro # Course detail (SSR)
450
- │ │ └── [thingType]/ # Dynamic routes
451
- │ │ ├── index.astro # Generic list page
452
- │ │ └── [id].astro # Generic detail page
453
- │ ├── components/ # React components
454
- │ │ ├── cards/
455
- │ │ │ └── ThingCard.tsx # Generic card (adapts to any type)
456
- │ │ ├── lists/
457
- │ │ │ └── ThingList.tsx # Generic list
458
- │ │ ├── forms/
459
- │ │ │ └── ThingForm.tsx # Generic form (calls backend)
460
- │ │ └── ui/ # shadcn/ui components
461
- │ ├── services/ # Effect.ts client services
462
- │ │ ├── ConvexHttpClient.ts # Convex client wrapper (required)
463
- │ │ ├── ThingClientService.ts # Thing operations (required)
464
- │ │ ├── ConnectionClientService.ts # Connection operations (required)
465
- │ │ ├── ClientLayer.ts # Dependency injection layer (required)
466
- │ │ └── CourseClientService.ts # OPTIONAL: Convenience
467
- │ ├── hooks/ # React hooks
468
- │ │ └── useEffectRunner.ts # Run Effect programs in React
469
- │ ├── layouts/
470
- │ │ └── Layout.astro # Main layout
471
- │ ├── ontology/ # Display config ONLY
472
- │ │ ├── types.ts # Type definitions (synced from backend)
473
- │ │ └── config.ts # UI display config (colors, icons, labels)
474
- │ ├── providers/ # Backend provider implementations
475
- │ │ ├── DataProvider.ts # Interface definition
476
- │ │ ├── convex/
477
- │ │ │ └── ConvexProvider.ts
478
- │ │ ├── wordpress/
479
- │ │ │ └── WordPressProvider.ts
480
- │ │ ├── notion/
481
- │ │ │ └── NotionProvider.ts
482
- │ │ └── supabase/
483
- │ │ └── SupabaseProvider.ts
484
- │ ├── lib/
485
- │ │ └── convex.ts # Backend client setup
486
- │ ├── middleware.ts # Multi-tenant routing
487
- │ └── styles/ # Tailwind + CSS
488
- ├── .env.local
489
- │ PUBLIC_CONVEX_URL=https://backend.convex.cloud
490
- └── package.json
491
- ```
492
-
493
- **Key Point:** Frontend has NO `convex/` directory. Backend-specific code lives in provider implementations only.
494
-
495
- ---
496
-
497
- ## Backend-Agnostic Data Layer
498
-
499
- **Inspired by Astro's Content Layer Pattern**
500
-
501
- Astro elegantly abstracts content sources via a universal interface. ONE applies this pattern to **data operations**:
502
-
503
- ```typescript
504
- // frontend/astro.config.ts
505
- import { defineConfig } from 'astro/config'
506
- import { convexProvider } from './src/providers/convex'
507
- // import { wordpressProvider } from './src/providers/wordpress'
508
- // import { notionProvider } from './src/providers/notion'
509
-
510
- export default defineConfig({
511
- integrations: [
512
- one({
513
- // ✅ Change this ONE line to swap backends
514
- provider: convexProvider({
515
- url: import.meta.env.PUBLIC_BACKEND_URL
516
- })
517
-
518
- // Or use WordPress:
519
- // provider: wordpressProvider({
520
- // url: 'https://yoursite.com',
521
- // apiKey: import.meta.env.WORDPRESS_API_KEY
522
- // })
523
-
524
- // Or use Notion:
525
- // provider: notionProvider({
526
- // apiKey: import.meta.env.NOTION_API_KEY,
527
- // databaseId: import.meta.env.NOTION_DB_ID
528
- // })
529
- })
530
- ]
531
- })
532
- ```
533
-
534
- **Key Principle:** Frontend components never know which backend they're talking to. The provider interface is the universal contract.
535
-
536
- ---
537
-
538
- ## DataProvider Interface
539
-
540
- **The universal ontology API that all backends must implement.**
541
-
542
- ```typescript
543
- // Error types (universal across all providers)
544
- export class ThingNotFoundError {
545
- readonly _tag = 'ThingNotFoundError'
546
- constructor(readonly thingId: string) {}
547
- }
548
-
549
- export class ConnectionCreateError {
550
- readonly _tag = 'ConnectionCreateError'
551
- constructor(readonly reason: string) {}
552
- }
553
-
554
- export class UnauthorizedError {
555
- readonly _tag = 'UnauthorizedError'
556
- }
557
-
558
- export class GroupNotFoundError {
559
- readonly _tag = 'GroupNotFoundError'
560
- constructor(readonly groupId: string) {}
561
- }
562
-
563
- export class PersonNotFoundError {
564
- readonly _tag = 'PersonNotFoundError'
565
- constructor(readonly personId: string) {}
566
- }
567
-
568
- export class PersonCreateError {
569
- readonly _tag = 'PersonCreateError'
570
- constructor(readonly reason: string) {}
571
- }
572
-
573
- // Type definitions for 6 dimensions
574
- export interface Group {
575
- _id: string
576
- slug: string
577
- name: string
578
- type: 'friend_circle' | 'business' | 'community' | 'dao' | 'government' | 'organization'
579
- parentGroupId?: string
580
- description?: string
581
- status: 'active' | 'archived'
582
- settings: {
583
- visibility: 'public' | 'private'
584
- joinPolicy: 'open' | 'invite_only' | 'approval_required'
585
- plan?: 'starter' | 'pro' | 'enterprise'
586
- }
587
- createdAt: number
588
- updatedAt: number
589
- }
590
-
591
- export interface Person {
592
- _id: string
593
- email: string
594
- username: string
595
- displayName: string
596
- emailVerified: boolean
597
- role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
598
- groupId?: string
599
- groups: string[]
600
- permissions?: string[]
601
- image?: string
602
- bio?: string
603
- createdAt: number
604
- updatedAt: number
605
- }
606
-
607
- export interface Thing {
608
- _id: string
609
- type: ThingType
610
- name: string
611
- groupId?: string
612
- properties: Record<string, any>
613
- status: 'draft' | 'active' | 'archived'
614
- createdAt: number
615
- updatedAt: number
616
- }
617
-
618
- // DataProvider interface (every backend must implement this)
619
- export interface DataProvider {
620
- // Dimension 1: Groups operations
621
- groups: {
622
- get: (id: string) => Effect.Effect<Group, GroupNotFoundError>
623
- list: (params: {
624
- status?: 'active' | 'archived'
625
- limit?: number
626
- }) => Effect.Effect<Group[], Error>
627
- update: (id: string, updates: Partial<Group>) => Effect.Effect<void, Error>
628
- }
629
-
630
- // Dimension 2: People operations
631
- people: {
632
- get: (id: string) => Effect.Effect<Person, PersonNotFoundError | UnauthorizedError>
633
- list: (params: {
634
- groupId?: string
635
- role?: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
636
- filters?: Record<string, any>
637
- limit?: number
638
- }) => Effect.Effect<Person[], Error>
639
- create: (input: {
640
- email: string
641
- displayName: string
642
- role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
643
- groupId: string
644
- password?: string
645
- }) => Effect.Effect<string, PersonCreateError>
646
- update: (id: string, updates: Partial<Person>) => Effect.Effect<void, Error>
647
- delete: (id: string) => Effect.Effect<void, Error>
648
- }
649
-
650
- // Dimension 3: Things operations
651
- things: {
652
- get: (id: string) => Effect.Effect<Thing, ThingNotFoundError | UnauthorizedError>
653
- list: (params: {
654
- type: ThingType
655
- groupId?: string
656
- filters?: Record<string, any>
657
- limit?: number
658
- }) => Effect.Effect<Thing[], Error>
659
- create: (input: {
660
- type: ThingType
661
- name: string
662
- groupId: string
663
- properties: Record<string, any>
664
- }) => Effect.Effect<string, ThingCreateError>
665
- update: (id: string, updates: Partial<Thing>) => Effect.Effect<void, Error>
666
- delete: (id: string) => Effect.Effect<void, Error>
667
- }
668
-
669
- // Dimension 4: Connections operations
670
- connections: {
671
- create: (input: {
672
- fromThingId: string
673
- toThingId: string
674
- relationshipType: ConnectionType
675
- metadata?: Record<string, any>
676
- }) => Effect.Effect<string, ConnectionCreateError>
677
- getRelated: (params: {
678
- thingId: string
679
- relationshipType: ConnectionType
680
- direction: 'from' | 'to' | 'both'
681
- }) => Effect.Effect<Thing[], Error>
682
- getCount: (thingId: string, relationshipType: ConnectionType) => Effect.Effect<number, Error>
683
- delete: (id: string) => Effect.Effect<void, Error>
684
- }
685
-
686
- // Dimension 5: Events operations
687
- events: {
688
- log: (event: {
689
- type: EventType
690
- actorId: string
691
- targetId?: string
692
- groupId: string
693
- metadata?: Record<string, any>
694
- }) => Effect.Effect<void, Error>
695
- query: (params: {
696
- type?: EventType
697
- actorId?: string
698
- targetId?: string
699
- groupId?: string
700
- from?: Date
701
- to?: Date
702
- }) => Effect.Effect<Event[], Error>
703
- }
704
-
705
- // Dimension 6: Knowledge operations
706
- knowledge: {
707
- embed: (params: {
708
- text: string
709
- sourceThingId?: string
710
- sourcePersonId?: string
711
- groupId: string
712
- labels?: string[]
713
- }) => Effect.Effect<string, Error>
714
- search: (params: {
715
- query: string
716
- groupId?: string
717
- limit?: number
718
- }) => Effect.Effect<KnowledgeMatch[], Error>
719
- }
720
-
721
- // Optional: Real-time subscriptions
722
- subscriptions?: {
723
- watchThing: (id: string) => Effect.Effect<Observable<Thing>, Error>
724
- watchList: (type: ThingType, groupId?: string) => Effect.Effect<Observable<Thing[]>, Error>
725
- }
726
- }
727
- ```
728
-
729
- **Provider Algebra:**
730
-
731
- ```typescript
732
- // Provider composition
733
- implement : Backend × DataProviderInterface → Provider
734
-
735
- // Examples:
736
- ConvexProvider = implement(ConvexBackend, DataProviderInterface)
737
- WordPressProvider = implement(WordPressBackend, DataProviderInterface)
738
- NotionProvider = implement(NotionBackend, DataProviderInterface)
739
-
740
- // Swapping backends (change ONE line in config)
741
- config.provider = ConvexProvider({ url: "..." })
742
- // OR
743
- config.provider = WordPressProvider({ url: "...", apiKey: "..." })
744
- // OR
745
- config.provider = NotionProvider({ apiKey: "...", databaseId: "..." })
746
-
747
- // Result: Frontend components don't change
748
- ```
749
-
750
- ---
751
-
752
- ## Provider Implementations
753
-
754
- ### Convex Provider
755
-
756
- ```typescript
757
- // frontend/src/providers/convex/ConvexProvider.ts
758
- import { Effect, Layer } from 'effect'
759
- import { ConvexHttpClient } from 'convex/browser'
760
- import { DataProvider } from '../DataProvider'
761
- import { api } from './api'
762
-
763
- export class ConvexProvider implements DataProvider {
764
- constructor(private client: ConvexHttpClient) {}
765
-
766
- things = {
767
- get: (id: string) =>
768
- Effect.gen(function* () {
769
- const thing = yield* Effect.tryPromise({
770
- try: () => this.client.query(api.queries.things.get, { id }),
771
- catch: (error) => new Error(String(error))
772
- })
773
-
774
- if (!thing) {
775
- return yield* Effect.fail(new ThingNotFoundError(id))
776
- }
777
-
778
- return thing
779
- }),
780
-
781
- list: (params) =>
782
- Effect.tryPromise({
783
- try: () => this.client.query(api.queries.things.list, params),
784
- catch: (error) => new Error(String(error))
785
- }),
786
-
787
- create: (input) =>
788
- Effect.tryPromise({
789
- try: () => this.client.mutation(api.mutations.things.create, input),
790
- catch: (error) => new Error(String(error))
791
- }),
792
-
793
- update: (id, updates) =>
794
- Effect.tryPromise({
795
- try: () => this.client.mutation(api.mutations.things.update, { id, updates }),
796
- catch: (error) => new Error(String(error))
797
- }),
798
-
799
- delete: (id) =>
800
- Effect.tryPromise({
801
- try: () => this.client.mutation(api.mutations.things.delete, { id }),
802
- catch: (error) => new Error(String(error))
803
- })
804
- }
805
-
806
- connections = { /* Similar implementation for connections... */ }
807
- events = { /* Similar implementation for events... */ }
808
- knowledge = { /* Similar implementation for knowledge... */ }
809
- }
810
-
811
- // Factory function
812
- export function convexProvider(config: { url: string }) {
813
- return Layer.succeed(
814
- DataProvider,
815
- new ConvexProvider(new ConvexHttpClient(config.url))
816
- )
817
- }
818
- ```
819
-
820
- ### WordPress Provider
821
-
822
- ```typescript
823
- // frontend/src/providers/wordpress/WordPressProvider.ts
824
- import { Effect, Layer } from 'effect'
825
- import { DataProvider } from '../DataProvider'
826
-
827
- export class WordPressProvider implements DataProvider {
828
- constructor(
829
- private baseUrl: string,
830
- private apiKey: string
831
- ) {}
832
-
833
- things = {
834
- get: (id: string) =>
835
- Effect.gen(function* () {
836
- // Map ONE ontology → WordPress REST API
837
- const response = yield* Effect.tryPromise({
838
- try: () =>
839
- fetch(`${this.baseUrl}/wp-json/wp/v2/posts/${id}`, {
840
- headers: { Authorization: `Bearer ${this.apiKey}` }
841
- }),
842
- catch: (error) => new Error(String(error))
843
- })
844
-
845
- if (!response.ok) {
846
- return yield* Effect.fail(new ThingNotFoundError(id))
847
- }
848
-
849
- const post = yield* Effect.tryPromise({
850
- try: () => response.json(),
851
- catch: (error) => new Error(String(error))
852
- })
853
-
854
- // Transform WordPress post → ONE thing
855
- return {
856
- _id: post.id.toString(),
857
- type: 'post' as ThingType,
858
- name: post.title.rendered,
859
- properties: {
860
- content: post.content.rendered,
861
- excerpt: post.excerpt.rendered,
862
- author: post.author,
863
- publishedAt: post.date
864
- },
865
- status: post.status,
866
- createdAt: new Date(post.date).getTime(),
867
- updatedAt: new Date(post.modified).getTime()
868
- }
869
- }),
870
-
871
- list: (params) =>
872
- Effect.gen(function* () {
873
- const query = new URLSearchParams({
874
- per_page: String(params.limit || 10)
875
- })
876
-
877
- const response = yield* Effect.tryPromise({
878
- try: () =>
879
- fetch(`${this.baseUrl}/wp-json/wp/v2/posts?${query}`, {
880
- headers: { Authorization: `Bearer ${this.apiKey}` }
881
- }),
882
- catch: (error) => new Error(String(error))
883
- })
884
-
885
- const posts = yield* Effect.tryPromise({
886
- try: () => response.json(),
887
- catch: (error) => new Error(String(error))
888
- })
889
-
890
- return posts.map((post: any) => ({
891
- _id: post.id.toString(),
892
- type: 'post' as ThingType,
893
- name: post.title.rendered,
894
- properties: {
895
- content: post.content.rendered,
896
- excerpt: post.excerpt.rendered
897
- },
898
- status: post.status,
899
- createdAt: new Date(post.date).getTime(),
900
- updatedAt: new Date(post.modified).getTime()
901
- }))
902
- }),
903
-
904
- create: (input) =>
905
- Effect.gen(function* () {
906
- const response = yield* Effect.tryPromise({
907
- try: () =>
908
- fetch(`${this.baseUrl}/wp-json/wp/v2/posts`, {
909
- method: 'POST',
910
- headers: {
911
- 'Content-Type': 'application/json',
912
- Authorization: `Bearer ${this.apiKey}`
913
- },
914
- body: JSON.stringify({
915
- title: input.name,
916
- content: input.properties.content || '',
917
- status: 'draft'
918
- })
919
- }),
920
- catch: (error) => new Error(String(error))
921
- })
922
-
923
- const post = yield* Effect.tryPromise({
924
- try: () => response.json(),
925
- catch: (error) => new Error(String(error))
926
- })
927
-
928
- return post.id.toString()
929
- }),
930
-
931
- update: (id, updates) => { /* Similar WordPress update */ },
932
- delete: (id) => { /* Similar WordPress delete */ }
933
- }
934
-
935
- connections = { /* WordPress relationships via post meta or custom tables */ }
936
- events = { /* Log to WordPress activity log */ }
937
- knowledge = { /* Elasticsearch, Algolia, or vector search */ }
938
- }
939
-
940
- // Factory function
941
- export function wordpressProvider(config: { url: string; apiKey: string }) {
942
- return Layer.succeed(
943
- DataProvider,
944
- new WordPressProvider(config.url, config.apiKey)
945
- )
946
- }
947
- ```
948
-
949
- ### Notion Provider
950
-
951
- ```typescript
952
- // frontend/src/providers/notion/NotionProvider.ts
953
- import { Effect, Layer } from 'effect'
954
- import { Client } from '@notionhq/client'
955
- import { DataProvider } from '../DataProvider'
956
-
957
- export class NotionProvider implements DataProvider {
958
- private notion: Client
959
-
960
- constructor(apiKey: string, private databaseId: string) {
961
- this.notion = new Client({ auth: apiKey })
962
- }
963
-
964
- things = {
965
- get: (id: string) =>
966
- Effect.gen(function* () {
967
- const page = yield* Effect.tryPromise({
968
- try: () => this.notion.pages.retrieve({ page_id: id }),
969
- catch: (error) => new Error(String(error))
970
- })
971
-
972
- return {
973
- _id: page.id,
974
- type: 'document' as ThingType,
975
- name: (page.properties.Name as any).title[0]?.plain_text || '',
976
- properties: {},
977
- status: 'active',
978
- createdAt: new Date(page.created_time).getTime(),
979
- updatedAt: new Date(page.last_edited_time).getTime()
980
- }
981
- }),
982
-
983
- list: (params) =>
984
- Effect.gen(function* () {
985
- const response = yield* Effect.tryPromise({
986
- try: () =>
987
- this.notion.databases.query({
988
- database_id: this.databaseId,
989
- page_size: params.limit || 10
990
- }),
991
- catch: (error) => new Error(String(error))
992
- })
993
-
994
- return response.results.map((page: any) => ({
995
- _id: page.id,
996
- type: params.type,
997
- name: page.properties.Name?.title[0]?.plain_text || '',
998
- properties: {},
999
- status: 'active',
1000
- createdAt: new Date(page.created_time).getTime(),
1001
- updatedAt: new Date(page.last_edited_time).getTime()
1002
- }))
1003
- }),
1004
-
1005
- create: (input) =>
1006
- Effect.gen(function* () {
1007
- const page = yield* Effect.tryPromise({
1008
- try: () =>
1009
- this.notion.pages.create({
1010
- parent: { database_id: this.databaseId },
1011
- properties: {
1012
- Name: { title: [{ text: { content: input.name } }] }
1013
- }
1014
- }),
1015
- catch: (error) => new Error(String(error))
1016
- })
1017
-
1018
- return page.id
1019
- }),
1020
-
1021
- update: (id, updates) => { /* Similar Notion update */ },
1022
- delete: (id) => { /* Notion archive page */ }
1023
- }
1024
-
1025
- connections = { /* Notion relations map to connections */ }
1026
- events = { /* Log to separate Notion database */ }
1027
- knowledge = { /* Notion's built-in search or external vector DB */ }
1028
- }
1029
-
1030
- // Factory function
1031
- export function notionProvider(config: { apiKey: string; databaseId: string }) {
1032
- return Layer.succeed(
1033
- DataProvider,
1034
- new NotionProvider(config.apiKey, config.databaseId)
1035
- )
1036
- }
1037
- ```
1038
-
1039
- ### Supabase Provider
1040
-
1041
- ```typescript
1042
- // frontend/src/providers/supabase/SupabaseProvider.ts
1043
- import { Effect, Layer } from 'effect'
1044
- import { createClient, SupabaseClient } from '@supabase/supabase-js'
1045
- import { DataProvider } from '../DataProvider'
1046
-
1047
- export class SupabaseProvider implements DataProvider {
1048
- private supabase: SupabaseClient
1049
-
1050
- constructor(url: string, apiKey: string) {
1051
- this.supabase = createClient(url, apiKey)
1052
- }
1053
-
1054
- things = {
1055
- get: (id: string) =>
1056
- Effect.gen(function* () {
1057
- const { data, error } = yield* Effect.tryPromise({
1058
- try: () => this.supabase.from('things').select('*').eq('id', id).single(),
1059
- catch: (err) => new Error(String(err))
1060
- })
1061
-
1062
- if (error) {
1063
- return yield* Effect.fail(new ThingNotFoundError(id))
1064
- }
1065
-
1066
- return data
1067
- }),
1068
-
1069
- list: (params) =>
1070
- Effect.gen(function* () {
1071
- let query = this.supabase
1072
- .from('things')
1073
- .select('*')
1074
- .eq('type', params.type)
1075
- .limit(params.limit || 10)
1076
-
1077
- if (params.groupId) {
1078
- query = query.eq('groupId', params.groupId)
1079
- }
1080
-
1081
- const { data, error } = yield* Effect.tryPromise({
1082
- try: () => query,
1083
- catch: (err) => new Error(String(err))
1084
- })
1085
-
1086
- if (error) {
1087
- return yield* Effect.fail(new Error(error.message))
1088
- }
1089
-
1090
- return data
1091
- }),
1092
-
1093
- create: (input) =>
1094
- Effect.gen(function* () {
1095
- const { data, error } = yield* Effect.tryPromise({
1096
- try: () =>
1097
- this.supabase.from('things').insert([input]).select().single(),
1098
- catch: (err) => new Error(String(err))
1099
- })
1100
-
1101
- if (error) {
1102
- return yield* Effect.fail(new Error(error.message))
1103
- }
1104
-
1105
- return data.id
1106
- }),
1107
-
1108
- update: (id, updates) => { /* Similar Supabase update */ },
1109
- delete: (id) => { /* Similar Supabase delete */ }
1110
- }
1111
-
1112
- connections = { /* Use Supabase 'connections' table */ }
1113
- events = { /* Use Supabase 'events' table */ }
1114
- knowledge = { /* Use pgvector extension for embeddings */ }
1115
-
1116
- // ✅ Supabase supports real-time!
1117
- subscriptions = {
1118
- watchThing: (id: string) =>
1119
- Effect.gen(function* () {
1120
- const channel = this.supabase
1121
- .channel(`thing:${id}`)
1122
- .on('postgres_changes', {
1123
- event: '*',
1124
- schema: 'public',
1125
- table: 'things',
1126
- filter: `id=eq.${id}`
1127
- }, (payload) => {
1128
- // Emit updates
1129
- })
1130
-
1131
- yield* Effect.tryPromise({
1132
- try: () => channel.subscribe(),
1133
- catch: (err) => new Error(String(err))
1134
- })
1135
-
1136
- // Return observable
1137
- })
1138
- }
1139
- }
1140
-
1141
- // Factory function
1142
- export function supabaseProvider(config: { url: string; apiKey: string }) {
1143
- return Layer.succeed(
1144
- DataProvider,
1145
- new SupabaseProvider(config.url, config.apiKey)
1146
- )
1147
- }
1148
- ```
1149
-
1150
- **Key Insight:** Each provider translates between ONE ontology ↔ backend-specific API. Frontend stays the same.
1151
-
1152
- ---
1153
-
1154
- ## Configuration
1155
-
1156
- ### Astro-Style Backend Swapping
1157
-
1158
- **Swap backends by changing ONE line:**
1159
-
1160
- ```typescript
1161
- // frontend/astro.config.ts
1162
- import { defineConfig } from 'astro/config'
1163
- import react from '@astrojs/react'
1164
- import { one } from '@one/astro-integration'
1165
-
1166
- // Import providers
1167
- import { convexProvider } from './src/providers/convex'
1168
- import { wordpressProvider } from './src/providers/wordpress'
1169
- import { notionProvider } from './src/providers/notion'
1170
- import { supabaseProvider } from './src/providers/supabase'
1171
-
1172
- export default defineConfig({
1173
- integrations: [
1174
- react(),
1175
- one({
1176
- // ✅ Choose your backend (change this ONE line)
1177
-
1178
- // Option 1: Convex (real-time, serverless)
1179
- provider: convexProvider({
1180
- url: import.meta.env.PUBLIC_CONVEX_URL
1181
- })
1182
-
1183
- // Option 2: WordPress (existing CMS)
1184
- // provider: wordpressProvider({
1185
- // url: 'https://yoursite.com',
1186
- // apiKey: import.meta.env.WORDPRESS_API_KEY
1187
- // })
1188
-
1189
- // Option 3: Notion (databases as backend)
1190
- // provider: notionProvider({
1191
- // apiKey: import.meta.env.NOTION_API_KEY,
1192
- // databaseId: import.meta.env.NOTION_DB_ID
1193
- // })
1194
-
1195
- // Option 4: Supabase (PostgreSQL + real-time)
1196
- // provider: supabaseProvider({
1197
- // url: import.meta.env.PUBLIC_SUPABASE_URL,
1198
- // apiKey: import.meta.env.PUBLIC_SUPABASE_ANON_KEY
1199
- // })
1200
-
1201
- // Option 5: Custom backend
1202
- // provider: customProvider({ ... })
1203
- })
1204
- ]
1205
- })
1206
- ```
1207
-
1208
- **Result:**
1209
- - Frontend components don't change
1210
- - UI stays the same
1211
- - Only data source changes
1212
- - Organizations can use their existing infrastructure
1213
-
1214
- ### Display Configuration (UI Only)
1215
-
1216
- Frontend needs **display configuration** for UI rendering. NOT business logic.
1217
-
1218
- ```typescript
1219
- // frontend/src/ontology/config.ts
1220
- // THIS IS NOT BUSINESS LOGIC - JUST UI CONFIGURATION
1221
-
1222
- export const thingConfigs = {
1223
- course: {
1224
- // Display names
1225
- displayName: 'Course',
1226
- displayNamePlural: 'Courses',
1227
-
1228
- // UI presentation
1229
- icon: 'BookOpen',
1230
- color: 'green',
1231
-
1232
- // Which fields to show in UI
1233
- primaryField: 'title',
1234
- secondaryField: 'description',
1235
- imageField: 'thumbnail',
1236
-
1237
- // Form fields (frontend only, backend validates)
1238
- fields: {
1239
- title: {
1240
- label: 'Course Title',
1241
- type: 'text',
1242
- required: true,
1243
- placeholder: 'e.g., Fitness 101'
1244
- },
1245
- description: {
1246
- label: 'Description',
1247
- type: 'textarea',
1248
- required: true
1249
- },
1250
- price: {
1251
- label: 'Price (USD)',
1252
- type: 'number',
1253
- required: true
1254
- }
1255
- }
1256
- },
1257
-
1258
- creator: {
1259
- displayName: 'Creator',
1260
- displayNamePlural: 'Creators',
1261
- icon: 'User',
1262
- color: 'blue',
1263
- primaryField: 'name',
1264
- secondaryField: 'bio',
1265
- imageField: 'avatar',
1266
- fields: {
1267
- name: { label: 'Name', type: 'text', required: true },
1268
- email: { label: 'Email', type: 'text', required: true },
1269
- bio: { label: 'Bio', type: 'textarea', required: false }
1270
- }
1271
- }
1272
- // ... all 66 types (UI config only)
1273
- }
1274
-
1275
- // Helper function
1276
- export function getThingConfig(type: ThingType) {
1277
- return thingConfigs[type]
1278
- }
1279
- ```
1280
-
1281
- **What This Is:**
1282
- - ✅ UI labels and placeholders
1283
- - ✅ Icon and color choices
1284
- - ✅ Which fields to display
1285
- - ✅ Form field types
1286
-
1287
- **What This Is NOT:**
1288
- - ❌ Business logic
1289
- - ❌ Validation rules (backend validates)
1290
- - ❌ Authorization rules (backend authorizes)
1291
- - ❌ Database schema (that's in backend)
1292
-
1293
- ---
1294
-
1295
- ## State Management Hierarchy
1296
-
1297
- ### Four-Layer State Architecture
1298
-
1299
- ```typescript
1300
- {
1301
- // Level 1: Server State (Provider owns - SOURCE OF TRUTH)
1302
- ServerState: {
1303
- owner: "Provider (backed by database)",
1304
- source: "Backend database",
1305
- access: "Query/Mutation via provider.interface only",
1306
- examples: [
1307
- "course list",
1308
- "user profile",
1309
- "enrollment count",
1310
- "lesson progress"
1311
- ],
1312
- caching: "Provider-level (Cloudflare KV, Edge cache)",
1313
- lifetime: "Persistent (until backend changes)",
1314
- rule: "NEVER duplicate in frontend state. Query when needed."
1315
- },
1316
-
1317
- // Level 2: SSR State (Astro owns - REQUEST SCOPED)
1318
- SSRState: {
1319
- owner: "Astro page (.astro files)",
1320
- source: "Server-side provider fetch",
1321
- access: "Props passed to components",
1322
- examples: [
1323
- "Initial page data (course details)",
1324
- "SEO metadata (title, description)",
1325
- "Organization context (from subdomain)"
1326
- ],
1327
- lifetime: "One HTTP request (not persisted)",
1328
- pattern: `
1329
- ---
1330
- const course = await provider.things.get(id)
1331
- ---
1332
- <Layout title={course.name}>
1333
- <CourseDetail course={course} />
1334
- </Layout>
1335
- `,
1336
- rule: "Use for SEO, initial render, server-only data"
1337
- },
1338
-
1339
- // Level 3: Island State (React owns - COMPONENT SCOPED)
1340
- IslandState: {
1341
- owner: "React component (useState/useReducer)",
1342
- source: "Component-local logic",
1343
- access: "Component-private (not shared)",
1344
- examples: [
1345
- "Form input values",
1346
- "Modal open/closed",
1347
- "Dropdown expanded",
1348
- "Loading spinner visible"
1349
- ],
1350
- lifetime: "Component mounted (unmount = state destroyed)",
1351
- pattern: `
1352
- export function CourseForm() {
1353
- const [title, setTitle] = useState('')
1354
- const [loading, setLoading] = useState(false)
1355
- // State dies when component unmounts
1356
- }
1357
- `,
1358
- rule: "UI-only state. Never duplicate server state."
1359
- },
1360
-
1361
- // Level 4: Shared Client State (Nanostores owns - SESSION SCOPED)
1362
- SharedState: {
1363
- owner: "Nanostores (global atoms)",
1364
- source: "Cross-component coordination",
1365
- access: "Multiple components subscribe",
1366
- examples: [
1367
- "Sidebar expanded/collapsed",
1368
- "Dark/light theme preference",
1369
- "User locale (en/es/fr)",
1370
- "Toast notifications"
1371
- ],
1372
- lifetime: "Browser session + localStorage",
1373
- pattern: `
1374
- // stores/layout.ts
1375
- export const sidebarExpanded = atom(true)
1376
-
1377
- // Component A
1378
- const expanded = useStore(sidebarExpanded)
1379
-
1380
- // Component B (synced with A)
1381
- const expanded = useStore(sidebarExpanded)
1382
- `,
1383
- rule: "UI preferences only. NOT server data."
1384
- },
1385
-
1386
- // Anti-Pattern: Duplicating Server State
1387
- antiPattern: {
1388
- problem: "Storing server data in frontend state",
1389
- bad: `
1390
- ❌ const [courses, setCourses] = useState([])
1391
- ❌ useEffect(() => {
1392
- provider.things.list('course').then(setCourses)
1393
- }, [])
1394
- // Problem: Server state duplicated in frontend
1395
- // Problem: Stale data, manual sync, cache invalidation
1396
- `,
1397
- solution: `
1398
- ✅ const courses = useQuery(api.courses.list)
1399
- // Provider handles caching, revalidation, subscriptions
1400
- // Frontend just renders. No state duplication.
1401
- `
1402
- },
1403
-
1404
- // Decision Tree
1405
- decisionTree: {
1406
- question: "Does this state persist after page reload?",
1407
- yes: {
1408
- question: "Is this data from backend?",
1409
- yes: "ServerState (provider query)",
1410
- no: "SharedState (nanostores + localStorage)"
1411
- },
1412
- no: {
1413
- question: "Do multiple components need this state?",
1414
- yes: "SharedState (nanostores, session-only)",
1415
- no: {
1416
- question: "Is this SSR data?",
1417
- yes: "SSRState (Astro props)",
1418
- no: "IslandState (useState)"
1419
- }
1420
- }
1421
- }
1422
- }
1423
- ```
1424
-
1425
- ---
1426
-
1427
- ## Effect.ts Service Layer
1428
-
1429
- **Effect.ts services consume the DataProvider interface.**
1430
-
1431
- ### Why Effect.ts?
1432
-
1433
- ```typescript
1434
- // ❌ Traditional approach - untyped errors, hard to compose
1435
- async function getCourse(id: string) {
1436
- try {
1437
- const response = await fetch(`/api/courses/${id}`)
1438
- const course = await response.json()
1439
- return course
1440
- } catch (error) {
1441
- // What type of error? Network? 404? 500?
1442
- console.error(error)
1443
- throw error
1444
- }
1445
- }
1446
-
1447
- // ✅ Effect.ts approach - typed errors, backend-agnostic
1448
- import { Effect } from 'effect'
1449
-
1450
- function getCourse(id: string) {
1451
- return Effect.gen(function* () {
1452
- const provider = yield* DataProvider
1453
-
1454
- // Works with ANY backend (Convex, WordPress, Notion, etc.)
1455
- const course = yield* provider.things.get(id)
1456
-
1457
- return course
1458
- }).pipe(
1459
- // Handle specific errors
1460
- Effect.catchTag('ThingNotFoundError', err =>
1461
- Effect.fail(new Error(`Course ${err.thingId} not found`))
1462
- )
1463
- )
1464
- }
1465
- ```
1466
-
1467
- **Key Benefits:**
1468
- 1. **Backend-Agnostic** - Works with any DataProvider implementation
1469
- 2. **Type-Safe Errors** - Compiler enforces error handling
1470
- 3. **Composability** - Small functions combine into complex flows
1471
- 4. **Testability** - Test layers replace real providers
1472
-
1473
- ### Core Principle: Generic Services Handle Everything
1474
-
1475
- The ontology has **66 thing types**, but you only need **2 generic services**:
1476
-
1477
- 1. **ThingClientService** - All CRUD for all 66 types
1478
- 2. **ConnectionClientService** - All relationships
1479
-
1480
- ```typescript
1481
- // ✅ This handles courses, lessons, products, everything
1482
- const provider = yield* DataProvider
1483
-
1484
- // Get any thing
1485
- const course = yield* provider.things.get(courseId)
1486
- const lesson = yield* provider.things.get(lessonId)
1487
-
1488
- // List any type
1489
- const courses = yield* provider.things.list({ type: 'course', groupId: orgId })
1490
- const products = yield* provider.things.list({ type: 'product', groupId: orgId })
1491
-
1492
- // Create any type
1493
- const courseId = yield* provider.things.create({
1494
- type: 'course',
1495
- name: 'Fitness 101',
1496
- properties: { price: 99, description: '...' }
1497
- })
1498
- ```
1499
-
1500
- **Specialized services are OPTIONAL** - only add them if you repeat the same multi-step operations 3+ times.
1501
-
1502
- ### Generic Service Pattern
1503
-
1504
- ```typescript
1505
- // frontend/src/services/ThingService.ts
1506
- import { Effect } from 'effect'
1507
- import { DataProvider } from '@/providers/DataProvider'
1508
-
1509
- export class ThingService extends Effect.Service<ThingService>()(
1510
- 'ThingService',
1511
- {
1512
- effect: Effect.gen(function* () {
1513
- const provider = yield* DataProvider
1514
-
1515
- return {
1516
- get: (id: string) => provider.things.get(id),
1517
-
1518
- list: (type: ThingType, orgId?: string) =>
1519
- provider.things.list({ type, groupId: orgId }),
1520
-
1521
- create: (input: { type: ThingType; name: string; properties: any }) =>
1522
- provider.things.create(input),
1523
-
1524
- update: (id: string, updates: any) =>
1525
- provider.things.update(id, updates),
1526
-
1527
- delete: (id: string) =>
1528
- provider.things.delete(id)
1529
- }
1530
- }),
1531
- dependencies: [DataProvider]
1532
- }
1533
- ) {}
1534
- ```
1535
-
1536
- **Key Point:** `ThingService` doesn't care if provider is Convex, WordPress, or Notion. It just calls `provider.things.get()`. The provider handles backend-specific logic.
1537
-
1538
- ### Specialized Service Pattern (Optional)
1539
-
1540
- **Only add if you repeat the same multi-step operation 3+ times:**
1541
-
1542
- ```typescript
1543
- // frontend/src/services/CourseClientService.ts (OPTIONAL)
1544
- import { Effect } from 'effect'
1545
- import { ThingClientService } from './ThingClientService'
1546
- import { ConnectionClientService } from './ConnectionClientService'
1547
-
1548
- export class CourseClientService extends Effect.Service<CourseClientService>()(
1549
- 'CourseClientService',
1550
- {
1551
- effect: Effect.gen(function* () {
1552
- const thingService = yield* ThingClientService
1553
- const connectionService = yield* ConnectionClientService
1554
-
1555
- return {
1556
- // Convenience: Get course with lessons
1557
- getCourseWithLessons: (courseId: string) =>
1558
- Effect.gen(function* () {
1559
- const [course, lessons] = yield* Effect.all([
1560
- thingService.get(courseId),
1561
- connectionService.getRelated(courseId, 'part_of', 'to')
1562
- ])
1563
-
1564
- return { course, lessons }
1565
- }),
1566
-
1567
- // Convenience: Clearer domain vocabulary
1568
- enrollUser: (userId: string, courseId: string) =>
1569
- Effect.gen(function* () {
1570
- return yield* connectionService.create({
1571
- fromThingId: userId,
1572
- toThingId: courseId,
1573
- relationshipType: 'enrolled_in'
1574
- })
1575
- }),
1576
-
1577
- // Convenience: Specific count query
1578
- getEnrollmentCount: (courseId: string) =>
1579
- Effect.gen(function* () {
1580
- return yield* connectionService.getCount(courseId, 'enrolled_in')
1581
- })
1582
- }
1583
- }),
1584
- dependencies: [ThingClientService.Default, ConnectionClientService.Default]
1585
- }
1586
- ) {}
1587
- ```
1588
-
1589
- **When to add specialized services:**
1590
- - ✅ Repeat the same multi-step operation 3+ times
1591
- - ✅ Want domain vocabulary (`enrollUser` vs `create connection`)
1592
- - ✅ Need to encapsulate complex business workflows
1593
- - ❌ Don't add them upfront for all 66 types
1594
- - ❌ Don't add them for simple CRUD (use ThingClientService)
1595
-
1596
- ### Dependency Injection Layer
1597
-
1598
- ```typescript
1599
- // frontend/src/services/ClientLayer.ts
1600
- import { Layer } from 'effect'
1601
- import { ConvexHttpClientLive } from './ConvexHttpClient'
1602
- import { ThingClientService } from './ThingClientService'
1603
- import { ConnectionClientService } from './ConnectionClientService'
1604
- // import { CourseClientService } from './CourseClientService' // OPTIONAL
1605
-
1606
- // ✅ Minimal layer - handles all 66 thing types
1607
- export const ClientLayer = Layer.mergeAll(
1608
- ConvexHttpClientLive,
1609
- ThingClientService.Default,
1610
- ConnectionClientService.Default
1611
- // CourseClientService.Default // Add ONLY if you created it
1612
- )
1613
- ```
1614
-
1615
- **Most apps only need the 2 generic services.** Add specialized services as you discover repeated patterns.
1616
-
1617
- ---
1618
-
1619
- ## React Hooks & Integration
1620
-
1621
- ### useEffectRunner Hook
1622
-
1623
- Custom hook for running Effect programs in React components.
1624
-
1625
- ```typescript
1626
- // frontend/src/hooks/useEffectRunner.ts
1627
- import { useCallback, useState } from 'react'
1628
- import { Effect } from 'effect'
1629
- import { ClientLayer } from '@/services/ClientLayer'
1630
-
1631
- export function useEffectRunner() {
1632
- const [loading, setLoading] = useState(false)
1633
- const [error, setError] = useState<string | null>(null)
1634
-
1635
- const run = useCallback(async <A, E>(
1636
- effect: Effect.Effect<A, E>,
1637
- options?: {
1638
- onSuccess?: (result: A) => void
1639
- onError?: (error: E) => void
1640
- }
1641
- ) => {
1642
- setLoading(true)
1643
- setError(null)
1644
-
1645
- try {
1646
- const result = await Effect.runPromise(
1647
- effect.pipe(Effect.provide(ClientLayer))
1648
- )
1649
-
1650
- options?.onSuccess?.(result)
1651
- return result
1652
- } catch (err) {
1653
- const errorMessage = err instanceof Error ? err.message : String(err)
1654
- setError(errorMessage)
1655
- options?.onError?.(err as E)
1656
- throw err
1657
- } finally {
1658
- setLoading(false)
1659
- }
1660
- }, [])
1661
-
1662
- return { run, loading, error }
1663
- }
1664
- ```
1665
-
1666
- ### Using in Components
1667
-
1668
- ```tsx
1669
- // frontend/src/components/CourseEnrollButton.tsx
1670
- import { useEffectRunner } from '@/hooks/useEffectRunner'
1671
- import { ConnectionClientService } from '@/services/ConnectionClientService'
1672
- import { Effect } from 'effect'
1673
- import { Button } from '@/components/ui/button'
1674
- import { Alert } from '@/components/ui/alert'
1675
-
1676
- interface Props {
1677
- courseId: string
1678
- userId: string
1679
- }
1680
-
1681
- export function CourseEnrollButton({ courseId, userId }: Props) {
1682
- const { run, loading, error } = useEffectRunner()
1683
-
1684
- const handleEnroll = () => {
1685
- // Define Effect program using GENERIC service
1686
- const program = Effect.gen(function* () {
1687
- const connectionService = yield* ConnectionClientService
1688
-
1689
- // Enroll = create connection (course is just a thing)
1690
- const enrollmentId = yield* connectionService.create({
1691
- fromThingId: userId,
1692
- toThingId: courseId,
1693
- relationshipType: 'enrolled_in'
1694
- })
1695
-
1696
- return enrollmentId
1697
- })
1698
-
1699
- // Run Effect program
1700
- run(program, {
1701
- onSuccess: (enrollmentId) => {
1702
- console.log('Enrolled successfully:', enrollmentId)
1703
- window.location.href = `/courses/${courseId}/learn`
1704
- },
1705
- onError: (err) => {
1706
- console.error('Enrollment failed:', err)
1707
- }
1708
- })
1709
- }
1710
-
1711
- return (
1712
- <div>
1713
- <Button onClick={handleEnroll} disabled={loading}>
1714
- {loading ? 'Enrolling...' : 'Enroll Now'}
1715
- </Button>
1716
-
1717
- {error && (
1718
- <Alert variant="destructive">{error}</Alert>
1719
- )}
1720
- </div>
1721
- )
1722
- }
1723
- ```
1724
-
1725
- ### Composable Operations
1726
-
1727
- ```tsx
1728
- // frontend/src/components/CourseCreator.tsx
1729
- import { useEffectRunner } from '@/hooks/useEffectRunner'
1730
- import { ThingClientService } from '@/services/ThingClientService'
1731
- import { ConnectionClientService } from '@/services/ConnectionClientService'
1732
- import { Effect } from 'effect'
1733
- import { useState } from 'react'
1734
-
1735
- export function CourseCreator() {
1736
- const { run, loading, error } = useEffectRunner()
1737
- const [formData, setFormData] = useState({
1738
- title: '',
1739
- description: '',
1740
- price: 0
1741
- })
1742
-
1743
- const handleSubmit = async (e: React.FormEvent) => {
1744
- e.preventDefault()
1745
-
1746
- // Define COMPLEX Effect program with ONLY generic services
1747
- const program = Effect.gen(function* () {
1748
- const thingService = yield* ThingClientService
1749
- const connectionService = yield* ConnectionClientService
1750
-
1751
- // 1. Create course (just a thing with type='course')
1752
- const courseId = yield* thingService.create({
1753
- type: 'course',
1754
- name: formData.title,
1755
- properties: {
1756
- title: formData.title,
1757
- description: formData.description,
1758
- price: formData.price
1759
- }
1760
- })
1761
-
1762
- // 2. Create default lesson (just a thing with type='lesson')
1763
- const lessonId = yield* thingService.create({
1764
- type: 'lesson',
1765
- name: 'Introduction',
1766
- properties: {
1767
- content: 'Welcome to the course!'
1768
- }
1769
- })
1770
-
1771
- // 3. Connect lesson to course (generic connection)
1772
- yield* connectionService.create({
1773
- fromThingId: lessonId,
1774
- toThingId: courseId,
1775
- relationshipType: 'part_of'
1776
- })
1777
-
1778
- // 4. Return course ID
1779
- return courseId
1780
- }).pipe(
1781
- Effect.retry({ times: 3 }),
1782
- Effect.timeout('5 seconds'),
1783
- Effect.catchTag('ThingCreateError', err =>
1784
- Effect.fail(new Error(`Failed to create course: ${err.reason}`))
1785
- )
1786
- )
1787
-
1788
- // Run the program
1789
- const courseId = await run(program, {
1790
- onSuccess: (id) => {
1791
- window.location.href = `/courses/${id}`
1792
- }
1793
- })
1794
- }
1795
-
1796
- return (
1797
- <form onSubmit={handleSubmit}>
1798
- <input
1799
- type="text"
1800
- value={formData.title}
1801
- onChange={(e) => setFormData({ ...formData, title: e.target.value })}
1802
- placeholder="Course Title"
1803
- />
1804
-
1805
- <textarea
1806
- value={formData.description}
1807
- onChange={(e) => setFormData({ ...formData, description: e.target.value })}
1808
- placeholder="Description"
1809
- />
1810
-
1811
- <input
1812
- type="number"
1813
- value={formData.price}
1814
- onChange={(e) => setFormData({ ...formData, price: parseFloat(e.target.value) })}
1815
- placeholder="Price"
1816
- />
1817
-
1818
- <button type="submit" disabled={loading}>
1819
- {loading ? 'Creating...' : 'Create Course'}
1820
- </button>
1821
-
1822
- {error && <Alert variant="destructive">{error}</Alert>}
1823
- </form>
1824
- )
1825
- }
1826
- ```
1827
-
1828
- ### Parallel Data Fetching
1829
-
1830
- ```tsx
1831
- // frontend/src/components/CourseDashboard.tsx
1832
- import { useEffect, useState } from 'react'
1833
- import { useEffectRunner } from '@/hooks/useEffectRunner'
1834
- import { ThingClientService } from '@/services/ThingClientService'
1835
- import { ConnectionClientService } from '@/services/ConnectionClientService'
1836
- import { Effect } from 'effect'
1837
-
1838
- interface Props {
1839
- courseId: string
1840
- }
1841
-
1842
- export function CourseDashboard({ courseId }: Props) {
1843
- const { run, loading } = useEffectRunner()
1844
- const [data, setData] = useState<any>(null)
1845
-
1846
- useEffect(() => {
1847
- // Fetch all data in parallel using GENERIC services
1848
- const program = Effect.gen(function* () {
1849
- const thingService = yield* ThingClientService
1850
- const connectionService = yield* ConnectionClientService
1851
-
1852
- // Parallel fetch (all run at once)
1853
- const [course, lessons, enrollmentCount] = yield* Effect.all([
1854
- thingService.get(courseId),
1855
- connectionService.getRelated(courseId, 'part_of', 'to'),
1856
- connectionService.getCount(courseId, 'enrolled_in')
1857
- ], { concurrency: 'unbounded' })
1858
-
1859
- return { course, lessons, enrollmentCount }
1860
- })
1861
-
1862
- run(program, {
1863
- onSuccess: setData
1864
- })
1865
- }, [courseId])
1866
-
1867
- if (loading) return <div>Loading...</div>
1868
- if (!data) return <div>No data</div>
1869
-
1870
- return (
1871
- <div>
1872
- <h1>{data.course.name}</h1>
1873
- <p>{data.enrollmentCount} students enrolled</p>
1874
-
1875
- <h2>Lessons</h2>
1876
- {data.lessons.map((lesson: any) => (
1877
- <div key={lesson._id}>{lesson.name}</div>
1878
- ))}
1879
- </div>
1880
- )
1881
- }
1882
- ```
1883
-
1884
- ---
1885
-
1886
- ## Component Patterns
1887
-
1888
- ### Generic Card (Pure Presentation)
1889
-
1890
- ```tsx
1891
- // frontend/src/components/cards/ThingCard.tsx
1892
- import { Card } from '@/components/ui/card'
1893
- import { getThingConfig } from '@/ontology/config'
1894
- import * as Icons from 'lucide-react'
1895
-
1896
- interface ThingCardProps {
1897
- thing: {
1898
- _id: string
1899
- type: string
1900
- name: string
1901
- properties: Record<string, any>
1902
- }
1903
- }
1904
-
1905
- export function ThingCard({ thing }: ThingCardProps) {
1906
- // Get UI config
1907
- const config = getThingConfig(thing.type as any)
1908
- const Icon = Icons[config.icon as keyof typeof Icons]
1909
-
1910
- // Extract display values
1911
- const title = thing.properties[config.primaryField] || thing.name
1912
- const subtitle = config.secondaryField
1913
- ? thing.properties[config.secondaryField]
1914
- : null
1915
- const image = config.imageField
1916
- ? thing.properties[config.imageField]
1917
- : null
1918
-
1919
- // Pure presentation - NO logic
1920
- return (
1921
- <Card>
1922
- {image && <img src={image} alt={title} />}
1923
-
1924
- <div className="p-4">
1925
- <div className="flex items-center gap-2">
1926
- <Icon className="w-5 h-5" />
1927
- <span>{config.displayName}</span>
1928
- </div>
1929
-
1930
- <h3 className="text-xl font-bold">{title}</h3>
1931
- {subtitle && <p className="text-gray-600">{subtitle}</p>}
1932
-
1933
- <a href={`/${thing.type}s/${thing._id}`}>
1934
- <button>View Details</button>
1935
- </a>
1936
- </div>
1937
- </Card>
1938
- )
1939
- }
1940
- ```
1941
-
1942
- **Key Points:**
1943
- - ✅ Receives data as props
1944
- - ✅ Uses UI config for display
1945
- - ✅ Pure presentation logic
1946
- - ❌ NO database calls
1947
- - ❌ NO business logic
1948
- - ❌ NO validation
1949
-
1950
- ---
1951
-
1952
- ## Page Patterns & SSR
1953
-
1954
- ### Fetch from Backend, Render HTML
1955
-
1956
- ```astro
1957
- ---
1958
- // frontend/src/pages/courses/[id].astro
1959
- import { getConvexClient } from '@/lib/convex'
1960
- import { api } from '@/lib/api'
1961
- import Layout from '@/layouts/Layout.astro'
1962
- import EnrollButton from '@/components/EnrollButton.tsx'
1963
-
1964
- // SSR: Fetch data from backend via HTTP
1965
- const convex = getConvexClient()
1966
-
1967
- const course = await convex.query(api.queries.things.get, {
1968
- id: Astro.params.id
1969
- })
1970
-
1971
- if (!course) {
1972
- return Astro.redirect('/404')
1973
- }
1974
-
1975
- // Get related lessons from backend
1976
- const lessons = await convex.query(api.queries.things.getRelated, {
1977
- thingId: course._id,
1978
- relationshipType: 'part_of',
1979
- direction: 'to'
1980
- })
1981
- ---
1982
-
1983
- <Layout title={course.name}>
1984
- <!-- Static HTML rendered on server -->
1985
- <header>
1986
- <h1>{course.name}</h1>
1987
- <p>{course.properties.description}</p>
1988
- <span className="text-2xl">${course.properties.price}</span>
1989
- </header>
1990
-
1991
- <!-- Lessons list (static) -->
1992
- <section>
1993
- <h2>Lessons</h2>
1994
- {lessons.map(lesson => (
1995
- <div>
1996
- <h3>{lesson.name}</h3>
1997
- <p>{lesson.properties.content}</p>
1998
- </div>
1999
- ))}
2000
- </section>
2001
-
2002
- <!-- Interactive enrollment button (React Island) -->
2003
- <EnrollButton client:load courseId={course._id} />
2004
- </Layout>
2005
- ```
2006
-
2007
- **Key Points:**
2008
- - ✅ Calls backend API to get data
2009
- - ✅ Renders static HTML
2010
- - ✅ Fast initial load (SSR)
2011
- - ❌ NO database access
2012
- - ❌ NO business logic in page
2013
-
2014
- ---
2015
-
2016
- ## Real-Time Components
2017
-
2018
- ### Subscribe to Backend Changes
2019
-
2020
- ```tsx
2021
- // frontend/src/components/LiveEnrollmentCount.tsx
2022
- import { useQuery } from 'convex/react'
2023
- import { api } from '@/lib/api'
2024
-
2025
- export function LiveEnrollmentCount({ courseId }: Props) {
2026
- // Real-time subscription to backend
2027
- // When ANYONE enrolls, this updates EVERYWHERE instantly
2028
- const count = useQuery(api.queries.connections.getCount, {
2029
- toThingId: courseId,
2030
- relationshipType: 'enrolled_in'
2031
- })
2032
-
2033
- if (count === undefined) return <div>Loading...</div>
2034
-
2035
- return (
2036
- <div>
2037
- <span className="text-3xl font-bold">{count}</span>
2038
- <span className="text-sm text-gray-600"> students enrolled</span>
2039
- </div>
2040
- )
2041
- }
2042
- ```
2043
-
2044
- **How It Works:**
2045
- 1. Component subscribes to backend query via WebSocket
2046
- 2. Backend watches database for changes
2047
- 3. When connection created → backend pushes update to frontend
2048
- 4. Component auto-re-renders
2049
- 5. **Frontend does NOTHING except display the number**
2050
-
2051
- ---
2052
-
2053
- ## Forms & Data Mutations
2054
-
2055
- ### Collect Input, Send to Backend
2056
-
2057
- ```tsx
2058
- // frontend/src/components/forms/ThingForm.tsx
2059
- import { useMutation } from 'convex/react'
2060
- import { api } from '@/lib/api'
2061
- import { getThingConfig } from '@/ontology/config'
2062
- import { useState } from 'react'
2063
-
2064
- interface ThingFormProps {
2065
- type: ThingType
2066
- onSuccess?: (id: string) => void
2067
- }
2068
-
2069
- export function ThingForm({ type, onSuccess }: ThingFormProps) {
2070
- const config = getThingConfig(type)
2071
- const [formData, setFormData] = useState({})
2072
- const [error, setError] = useState<string | null>(null)
2073
-
2074
- // Backend mutation (frontend just calls it)
2075
- const createThing = useMutation(api.mutations.things.create)
2076
-
2077
- const handleSubmit = async (e: React.FormEvent) => {
2078
- e.preventDefault()
2079
- setError(null)
2080
-
2081
- try {
2082
- // Send to backend - backend validates, creates, logs events
2083
- const id = await createThing({
2084
- type,
2085
- name: formData[config.primaryField],
2086
- properties: formData
2087
- })
2088
-
2089
- onSuccess?.(id)
2090
- } catch (err) {
2091
- // Display backend error
2092
- setError(err.message)
2093
- }
2094
- }
2095
-
2096
- return (
2097
- <form onSubmit={handleSubmit}>
2098
- {/* Form fields from UI config */}
2099
- {Object.entries(config.fields).map(([field, fieldConfig]) => (
2100
- <div key={field}>
2101
- <label>{fieldConfig.label}</label>
2102
- <input
2103
- type={fieldConfig.type}
2104
- value={formData[field] || ''}
2105
- onChange={(e) => setFormData({ ...formData, [field]: e.target.value })}
2106
- placeholder={fieldConfig.placeholder}
2107
- required={fieldConfig.required}
2108
- />
2109
- </div>
2110
- ))}
2111
-
2112
- {error && <div className="text-red-600">{error}</div>}
2113
-
2114
- <button type="submit">Create</button>
2115
- </form>
2116
- )
2117
- }
2118
- ```
2119
-
2120
- **Key Points:**
2121
- - ✅ Collects user input
2122
- - ✅ Sends to backend mutation
2123
- - ✅ Displays backend errors
2124
- - ⚠️ Frontend validation is optional (UX only)
2125
- - ❌ Backend MUST validate (security)
2126
- - ❌ Frontend does NOT create database records
2127
-
2128
- ---
2129
-
2130
- ## Multi-Tenant Routing
2131
-
2132
- ### Middleware: Extract Org from Subdomain
2133
-
2134
- ```typescript
2135
- // frontend/src/middleware.ts
2136
- import { defineMiddleware } from 'astro:middleware'
2137
- import { getConvexClient } from './lib/convex'
2138
- import { api } from './lib/api'
2139
-
2140
- export const onRequest = defineMiddleware(async (context, next) => {
2141
- const url = new URL(context.request.url)
2142
-
2143
- // Extract org slug from subdomain
2144
- // fitnesspro.one.ie → "fitnesspro"
2145
- const hostname = url.hostname
2146
- const orgSlug = hostname.split('.')[0]
2147
-
2148
- // Skip for main domains
2149
- if (['api', 'www', 'localhost'].includes(orgSlug)) {
2150
- return next()
2151
- }
2152
-
2153
- // Fetch org from backend
2154
- const convex = getConvexClient()
2155
- const org = await convex.query(api.queries.orgs.getBySlug, {
2156
- slug: orgSlug
2157
- })
2158
-
2159
- if (org) {
2160
- // Inject org context for pages to use
2161
- context.locals.org = org
2162
- context.locals.orgId = org._id
2163
- }
2164
-
2165
- return next()
2166
- })
2167
- ```
2168
-
2169
- ### Use Org Context in Pages
2170
-
2171
- ```astro
2172
- ---
2173
- // frontend/src/pages/courses/index.astro
2174
- import { getConvexClient } from '@/lib/convex'
2175
- import { api } from '@/lib/api'
2176
-
2177
- // Get org from middleware
2178
- const org = Astro.locals.org
2179
-
2180
- if (!org) {
2181
- return Astro.redirect('/404')
2182
- }
2183
-
2184
- // Fetch org's courses from backend
2185
- const convex = getConvexClient()
2186
- const courses = await convex.query(api.queries.things.list, {
2187
- type: 'course',
2188
- groupId: org._id // Backend filters by group
2189
- })
2190
- ---
2191
-
2192
- <Layout title={`${org.name} - Courses`}>
2193
- <h1>{org.name} Courses</h1>
2194
-
2195
- <!-- Display org's courses -->
2196
- {courses.map(course => (
2197
- <CourseCard thing={course} />
2198
- ))}
2199
- </Layout>
2200
- ```
2201
-
2202
- **Result:**
2203
- - `fitnesspro.one.ie/courses` → FitnessPro courses only
2204
- - `techcorp.one.ie/courses` → TechCorp courses only
2205
- - **Backend enforces data isolation, frontend just passes orgId**
2206
-
2207
- ---
2208
-
2209
- ## Caching Ontology
2210
-
2211
- ### Four-Tier Caching Architecture
2212
-
2213
- ```typescript
2214
- {
2215
- // Tier 1: Type Definition Cache (STATIC - INFINITE TTL)
2216
- L1_TypeDefinitions: {
2217
- what: "Ontology type structures",
2218
- ttl: "∞ (types never change at runtime)",
2219
- storage: "Memory (startup load)",
2220
- size: "200 tokens × 66 types = 13,200 tokens",
2221
- hitRate: "99.9%+ (loaded once)",
2222
- benefit: "AI loads 200 tokens (not 15k implementation tokens)"
2223
- },
2224
-
2225
- // Tier 2: Provider Interface Cache (STATIC - INFINITE TTL)
2226
- L2_ProviderInterface: {
2227
- what: "DataProvider method signatures",
2228
- ttl: "∞ (interface never changes)",
2229
- storage: "Memory (startup load)",
2230
- size: "300 tokens (entire interface)",
2231
- hitRate: "100% (never changes)",
2232
- benefit: "AI never loads backend implementation (0 tokens)"
2233
- },
2234
-
2235
- // Tier 3: SSR Data Cache (DYNAMIC - TTL: 1-60s)
2236
- L3_SSRData: {
2237
- what: "Server-rendered page data",
2238
- ttl: "1-60s (configurable per route)",
2239
- storage: "Cloudflare KV / Edge cache",
2240
- size: "Variable (full pages or data)",
2241
- strategy: "Stale-while-revalidate",
2242
- benefit: "Reduces provider calls by 80-95%"
2243
- },
2244
-
2245
- // Tier 4: Client Subscriptions (REALTIME - TTL: 0)
2246
- L4_RealtimeSubscriptions: {
2247
- what: "WebSocket live updates",
2248
- ttl: "0 (always fresh)",
2249
- storage: "Client memory (ephemeral)",
2250
- strategy: "Provider pushes updates",
2251
- when_to_use: [
2252
- "Real-time dashboards",
2253
- "Live enrollment counts",
2254
- "Collaborative editing",
2255
- "Chat/notifications"
2256
- ]
2257
- },
2258
-
2259
- // Cache Hierarchy Decision Tree
2260
- decisionTree: {
2261
- question: "Is this ontology type data?",
2262
- yes: "L1 (Type Definition Cache) - infinite TTL",
2263
- no: {
2264
- question: "Is this provider interface?",
2265
- yes: "L2 (Provider Interface Cache) - infinite TTL",
2266
- no: {
2267
- question: "Does data change in real-time?",
2268
- yes: "L4 (Real-time Subscriptions) - 0 TTL",
2269
- no: {
2270
- question: "Is data page-level?",
2271
- yes: "L3 (SSR Data Cache) - 1-60s TTL",
2272
- no: "No cache (fetch on demand)"
2273
- }
2274
- }
2275
- }
2276
- },
2277
-
2278
- // Golden Rule
2279
- rule: "Cache closer to definition = less context loaded. Types/interface = cached forever."
2280
- }
2281
- ```
2282
-
2283
- ### Cache Invalidation Strategies
2284
-
2285
- ```typescript
2286
- {
2287
- strategies: {
2288
- // L1 & L2: Never invalidate (static types/interface)
2289
- static: {
2290
- invalidation: "None (only invalidate on deployment)",
2291
- reason: "Types and interface don't change at runtime"
2292
- },
2293
-
2294
- // L3: Time-based + event-based
2295
- ssr: {
2296
- time_based: "TTL expires → fetch fresh",
2297
- event_based: "Backend mutation → invalidate affected pages",
2298
- example: `
2299
- // When course updated, invalidate course page cache
2300
- await provider.things.update(courseId, updates)
2301
- await cache.delete(\`course:\${courseId}\`)
2302
- `
2303
- },
2304
-
2305
- // L4: Automatic (subscription handles)
2306
- realtime: {
2307
- invalidation: "Provider pushes updates automatically",
2308
- reason: "WebSocket connection = always fresh"
2309
- }
2310
- }
2311
- }
2312
- ```
2313
-
2314
- ---
2315
-
2316
- ## Error Propagation & Handling
2317
-
2318
- ### Full Error Flow: Provider → Service → Component → UI
2319
-
2320
- ```typescript
2321
- {
2322
- errorFlow: "Provider → Service → Component → UI",
2323
-
2324
- // Level 1: Provider Errors (Effect.ts tagged errors)
2325
- providerErrors: {
2326
- ThingNotFoundError: {
2327
- _tag: "ThingNotFoundError",
2328
- fields: { thingId: string; type: ThingType },
2329
- recovery: "Show 404 page or 'Not Found' component",
2330
- httpStatus: 404
2331
- },
2332
-
2333
- UnauthorizedError: {
2334
- _tag: "UnauthorizedError",
2335
- fields: { userId?: string; requiredPermission: string },
2336
- recovery: "Redirect to /login with returnUrl",
2337
- httpStatus: 401
2338
- },
2339
-
2340
- NetworkError: {
2341
- _tag: "NetworkError",
2342
- fields: { message: string; retryable: boolean },
2343
- recovery: "Retry with exponential backoff (if retryable)",
2344
- httpStatus: 503
2345
- },
2346
-
2347
- RateLimitError: {
2348
- _tag: "RateLimitError",
2349
- fields: { retryAfter: number },
2350
- recovery: "Show 'Try again in X seconds' message",
2351
- httpStatus: 429
2352
- }
2353
- },
2354
-
2355
- // Level 2: Service Errors (Domain-specific)
2356
- serviceErrors: {
2357
- pattern: "Transform provider error → domain error",
2358
- example: `
2359
- getCourseWithLessons(id: string) {
2360
- return Effect.gen(function* () {
2361
- const course = yield* thingService.get(id)
2362
- const lessons = yield* connectionService.getRelated(id, 'part_of', 'to')
2363
- return { course, lessons }
2364
- }).pipe(
2365
- Effect.catchTag('ThingNotFoundError', (e) =>
2366
- Effect.fail(new CourseNotFoundError({
2367
- courseId: e.thingId,
2368
- message: \`Course \${e.thingId} not found\`
2369
- }))
2370
- )
2371
- )
2372
- }
2373
- `
2374
- },
2375
-
2376
- // Level 3: Component Errors (Catch and render)
2377
- componentErrors: {
2378
- pattern: "Match error._tag → Render UI component",
2379
- example: `
2380
- if (error) {
2381
- switch (error._tag) {
2382
- case 'CourseNotFoundError':
2383
- return <Alert variant="warning">Course not found</Alert>
2384
- case 'UnauthorizedError':
2385
- return <Alert variant="error">Please log in to view</Alert>
2386
- case 'NetworkError':
2387
- return <Alert variant="error">Network error. Retrying...</Alert>
2388
- default:
2389
- return <Alert variant="error">Something went wrong</Alert>
2390
- }
2391
- }
2392
- `
2393
- },
2394
-
2395
- // Level 4: UI Errors (User-facing messages)
2396
- uiErrors: {
2397
- pattern: "Error → User-friendly message + Action",
2398
- mapping: {
2399
- ThingNotFoundError: {
2400
- message: "This {type} doesn't exist",
2401
- action: "Go back or search for another",
2402
- component: "<Alert404 />"
2403
- },
2404
-
2405
- UnauthorizedError: {
2406
- message: "You need to log in to see this",
2407
- action: "Log in or Sign up",
2408
- component: "<LoginPrompt returnUrl={currentPath} />"
2409
- },
2410
-
2411
- NetworkError: {
2412
- message: "Connection issue",
2413
- action: "Retrying automatically...",
2414
- component: "<RetryAlert retrying={true} />"
2415
- }
2416
- }
2417
- },
2418
-
2419
- // Error Boundary Pattern
2420
- errorBoundary: `
2421
- export class ErrorBoundary extends React.Component {
2422
- state = { error: null }
2423
-
2424
- static getDerivedStateFromError(error) {
2425
- return { error }
2426
- }
2427
-
2428
- render() {
2429
- if (this.state.error) {
2430
- return <ErrorFallback error={this.state.error} />
2431
- }
2432
-
2433
- return this.props.children
2434
- }
2435
- }
2436
-
2437
- // Usage: Wrap islands in error boundaries
2438
- <ErrorBoundary>
2439
- <CourseDetail client:load courseId={id} />
2440
- </ErrorBoundary>
2441
- `,
2442
-
2443
- // Golden Rule
2444
- invariant: "Every error path has explicit UI recovery. No silent failures."
2445
- }
2446
- ```
2447
-
2448
- ---
2449
-
2450
- ## Testing Patterns
2451
-
2452
- ### Three-Layer Testing Strategy
2453
-
2454
- ```typescript
2455
- {
2456
- // Layer 1: Unit Tests (Service logic with mock provider)
2457
- unitTests: {
2458
- what: "Test service logic in isolation",
2459
- mock: "MockProvider (no real backend)",
2460
- fast: "Milliseconds per test",
2461
-
2462
- example: `
2463
- describe('CourseService.getCourseWithLessons', () => {
2464
- it('should return course with lessons', async () => {
2465
- // Mock provider
2466
- const MockProvider = Layer.succeed(DataProvider, {
2467
- things: {
2468
- get: (id) => Effect.succeed({
2469
- _id: id,
2470
- type: 'course',
2471
- name: 'Test Course'
2472
- })
2473
- },
2474
- connections: {
2475
- getRelated: (thingId, type, direction) => Effect.succeed([
2476
- { _id: 'lesson1', type: 'lesson', name: 'Lesson 1' },
2477
- { _id: 'lesson2', type: 'lesson', name: 'Lesson 2' }
2478
- ])
2479
- }
2480
- })
2481
-
2482
- // Test service
2483
- const result = await Effect.runPromise(
2484
- Effect.gen(function* () {
2485
- const service = yield* CourseService
2486
- return yield* service.getCourseWithLessons('course123')
2487
- }).pipe(Effect.provide(MockProvider))
2488
- )
2489
-
2490
- expect(result.course.name).toBe('Test Course')
2491
- expect(result.lessons).toHaveLength(2)
2492
- })
2493
- })
2494
- `,
2495
-
2496
- coverage: [
2497
- "Service logic (business rules)",
2498
- "Error transformations",
2499
- "Effect composition",
2500
- "Edge cases"
2501
- ]
2502
- },
2503
-
2504
- // Layer 2: Integration Tests (Service + Real Provider + Test Backend)
2505
- integrationTests: {
2506
- what: "Test service + provider + real backend",
2507
- backend: "Test Convex deployment (isolated database)",
2508
- slow: "Seconds per test (real network calls)",
2509
-
2510
- coverage: [
2511
- "Full data flow (service → provider → backend → database)",
2512
- "Real mutations and queries",
2513
- "Data consistency",
2514
- "Backend constraints"
2515
- ]
2516
- },
2517
-
2518
- // Layer 3: E2E Tests (Full UI flow in browser)
2519
- e2eTests: {
2520
- what: "Test complete user flows in browser",
2521
- tool: "Playwright (headless Chrome)",
2522
- slow: "10-30s per test (full page loads)",
2523
-
2524
- coverage: [
2525
- "User flows (click, type, navigate)",
2526
- "Visual rendering",
2527
- "Loading states",
2528
- "Error states",
2529
- "Authentication flows"
2530
- ]
2531
- },
2532
-
2533
- // Test Pyramid
2534
- pyramid: {
2535
- unit: "70% (fast, many tests, mock provider)",
2536
- integration: "20% (medium, key flows, test backend)",
2537
- e2e: "10% (slow, critical paths, real UI)"
2538
- },
2539
-
2540
- // Golden Rule
2541
- invariant: "Mock providers for unit tests. Real providers for integration. Real UI for E2E."
2542
- }
2543
- ```
2544
-
2545
- ---
2546
-
2547
- ## Common Mistakes & Solutions
2548
-
2549
- ### Top 10 Anti-Patterns to Avoid
2550
-
2551
- ```typescript
2552
- {
2553
- // Mistake 1: Coupling to specific provider
2554
- mistake1: {
2555
- problem: "Importing Convex directly in frontend code",
2556
- bad: `
2557
- // ❌ BAD
2558
- import { ConvexClient } from 'convex/browser'
2559
- const client = new ConvexClient(url)
2560
- const course = await client.query(api.courses.get, { id })
2561
- `,
2562
- good: `
2563
- // ✅ GOOD
2564
- const provider = yield* DataProvider
2565
- const course = yield* provider.things.get(id)
2566
- `,
2567
- why: "Bad code breaks when you swap backends. Good code works with ANY backend."
2568
- },
2569
-
2570
- // Mistake 2: Creating specialized services prematurely
2571
- mistake2: {
2572
- problem: "Creating CourseService before patterns emerge",
2573
- bad: `
2574
- // ❌ BAD (created after 1 use)
2575
- class CourseService {
2576
- getCourseWithLessons(id) {
2577
- // Used once, doesn't justify specialized service
2578
- }
2579
- }
2580
- `,
2581
- good: `
2582
- // ✅ GOOD (use generic services until pattern repeats 3+ times)
2583
- const course = yield* thingService.get(id)
2584
- const lessons = yield* connectionService.getRelated(id, 'part_of', 'to')
2585
-
2586
- // Only create CourseService after repeating this 3+ times
2587
- `,
2588
- why: "Premature abstraction creates unnecessary complexity. Wait for patterns."
2589
- },
2590
-
2591
- // Mistake 3: Duplicating server state in frontend
2592
- mistake3: {
2593
- problem: "Storing backend data in useState",
2594
- bad: `
2595
- // ❌ BAD
2596
- const [courses, setCourses] = useState([])
2597
- useEffect(() => {
2598
- provider.things.list({ type: 'course' })
2599
- .then(setCourses)
2600
- }, [])
2601
- `,
2602
- good: `
2603
- // ✅ GOOD
2604
- const courses = useQuery(api.courses.list)
2605
- // Provider handles caching, no state duplication
2606
- `,
2607
- why: "Duplicating state creates sync issues. Let provider handle caching."
2608
- },
2609
-
2610
- // Mistake 4: Not handling error states
2611
- mistake4: {
2612
- problem: "No UI for errors",
2613
- bad: `
2614
- // ❌ BAD
2615
- const course = await provider.things.get(id)
2616
- return <div>{course.name}</div>
2617
- // What if course is undefined? No error handling!
2618
- `,
2619
- good: `
2620
- // ✅ GOOD
2621
- try {
2622
- const course = await provider.things.get(id)
2623
- return <div>{course.name}</div>
2624
- } catch (error) {
2625
- if (error._tag === 'ThingNotFoundError') {
2626
- return <Alert>Course not found</Alert>
2627
- }
2628
- return <Alert>Error loading course</Alert>
2629
- }
2630
- `,
2631
- why: "Errors WILL happen. Always have UI for error states."
2632
- },
2633
-
2634
- // Mistake 5: Manual group filtering
2635
- mistake5: {
2636
- problem: "Manually filtering by groupId",
2637
- bad: `
2638
- // ❌ BAD
2639
- const courses = await provider.things.list({
2640
- type: 'course',
2641
- groupId: ctx.locals.groupId // Manual filtering
2642
- })
2643
- `,
2644
- good: `
2645
- // ✅ GOOD
2646
- const courses = await provider.things.list({ type: 'course' })
2647
- // Provider auto-injects groupId
2648
- `,
2649
- why: "Provider enforces multi-tenancy. Frontend shouldn't know about groups."
2650
- },
2651
-
2652
- // Mistake 6: Not testing with mock providers
2653
- mistake6: {
2654
- problem: "Testing with real backend (slow, flaky)",
2655
- bad: `
2656
- // ❌ BAD
2657
- test('gets course', async () => {
2658
- const course = await service.get('real_id_from_db')
2659
- // Depends on real database state
2660
- })
2661
- `,
2662
- good: `
2663
- // ✅ GOOD
2664
- test('gets course', async () => {
2665
- const MockProvider = Layer.succeed(DataProvider, {
2666
- things: { get: (id) => Effect.succeed(mockCourse) }
2667
- })
2668
-
2669
- const course = await service.get('any_id')
2670
- .pipe(Effect.provide(MockProvider))
2671
- // Fast, deterministic, no database
2672
- })
2673
- `,
2674
- why: "Unit tests should be fast and deterministic. Use mocks."
2675
- },
2676
-
2677
- // Mistake 7: Skipping progressive enhancement
2678
- mistake7: {
2679
- problem: "JavaScript-only forms (don't work without JS)",
2680
- bad: `
2681
- // ❌ BAD
2682
- <button onClick={() => enroll()}>Enroll</button>
2683
- // Doesn't work if JS fails to load
2684
- `,
2685
- good: `
2686
- // ✅ GOOD
2687
- <form action="/api/enroll" method="post">
2688
- <button type="submit">Enroll</button>
2689
- </form>
2690
- // Works with or without JS
2691
-
2692
- // Then enhance with JS:
2693
- <EnrollButton client:load /> // Adds optimistic UI
2694
- `,
2695
- why: "Always start with working HTML. JavaScript should enhance, not enable."
2696
- },
2697
-
2698
- // Mistake 8: Ignoring type sync
2699
- mistake8: {
2700
- problem: "Manually duplicating backend types in frontend",
2701
- bad: `
2702
- // ❌ BAD
2703
- // frontend/types.ts
2704
- type Course = {
2705
- id: string
2706
- title: string
2707
- // Manually copied from backend
2708
- }
2709
- `,
2710
- good: `
2711
- // ✅ GOOD
2712
- import type { Thing } from '@/convex/_generated/dataModel'
2713
- // Auto-synced from backend schema
2714
- `,
2715
- why: "Manual type sync breaks. Use generated types from backend."
2716
- },
2717
-
2718
- // Mistake 9: Loading too much context
2719
- mistake9: {
2720
- problem: "Loading entire codebase for AI generation",
2721
- bad: `
2722
- // ❌ BAD
2723
- const context = {
2724
- allFiles: loadFiles('**/*.ts'), // 200k tokens
2725
- allDocs: loadDocs(), // 50k tokens
2726
- allExamples: loadExamples() // 30k tokens
2727
- } // 280k tokens
2728
- `,
2729
- good: `
2730
- // ✅ GOOD
2731
- const context = {
2732
- interface: DataProviderInterface, // 300 tokens
2733
- pattern: servicePattern // 400 tokens
2734
- } // 700 tokens (99.7% reduction)
2735
- `,
2736
- why: "Context explosion wastes time and money. Load only what's needed."
2737
- },
2738
-
2739
- // Mistake 10: Business logic in frontend
2740
- mistake10: {
2741
- problem: "Validating business rules in frontend only",
2742
- bad: `
2743
- // ❌ BAD
2744
- if (user.tokens >= course.price) {
2745
- // Frontend calculates eligibility
2746
- }
2747
- `,
2748
- good: `
2749
- // ✅ GOOD
2750
- // Backend validates (frontend just shows loading)
2751
- const result = await provider.things.create(courseData)
2752
- // Backend enforces: tokens >= price
2753
- `,
2754
- why: "Frontend can be bypassed. Backend MUST enforce all rules."
2755
- }
2756
- }
2757
- ```
2758
-
2759
- ---
2760
-
2761
- ## Summary & Key Patterns
2762
-
2763
- ### Frontend Responsibilities (ONLY These)
2764
-
2765
- | What | How | Example |
2766
- |------|-----|---------|
2767
- | **Render UI** | Astro pages + React components | `<h1>{course.name}</h1>` |
2768
- | **Call Backend** | Effect.ts services or Convex hooks | `yield* courseService.get(id)` |
2769
- | **Manage UI State** | `useState`, `useReducer`, `useEffectRunner` | `const { run, loading, error } = useEffectRunner()` |
2770
- | **Route Users** | Astro routing, middleware | `/courses/[id].astro` |
2771
- | **Display Errors** | Show typed backend errors | `Effect.catchTag('NotFoundError', ...)` |
2772
-
2773
- ### The Architecture Contract
2774
-
2775
- ```typescript
2776
- // Frontend → Backend (only way to interact)
2777
-
2778
- // ✅ Frontend calls backend query
2779
- const courses = useQuery(api.queries.things.list, { type: 'course' })
2780
-
2781
- // ✅ Frontend calls backend mutation
2782
- const create = useMutation(api.mutations.things.create)
2783
- await create({ type: 'course', name: 'Fitness 101', properties: {...} })
2784
-
2785
- // ✅ Backend implements logic
2786
- export const create = mutation({
2787
- handler: async (ctx, args) => {
2788
- // Validate
2789
- // Create in database
2790
- // Log event
2791
- // Return result
2792
- }
2793
- })
2794
-
2795
- // ❌ Frontend NEVER accesses database directly
2796
- const courses = await ctx.db.query('things') // IMPOSSIBLE in frontend
2797
- ```
2798
-
2799
- ### Key Principles
2800
-
2801
- 1. **Separation:** Frontend renders, backend manages data
2802
- 2. **Type-Safe:** Effect.ts enforces error handling, backend generates types
2803
- 3. **Composability:** Effect.ts services combine into complex flows
2804
- 4. **Real-Time:** WebSocket subscriptions auto-update UI
2805
- 5. **Multi-Tenant:** Middleware extracts org → pages filter by org
2806
- 6. **Testability:** Effect.ts test layers replace mocks
2807
- 7. **Stateless:** Frontend has no state beyond UI, backend is source of truth
2808
- 8. **Backend-Agnostic:** Provider pattern works with ANY backend (Convex, WordPress, Notion, Supabase, etc.)
2809
-
2810
- ### Generic vs Specialized Services Decision Tree
2811
-
2812
- ```
2813
- ┌──────────────────────────────────────────────────┐
2814
- │ 66 Thing Types │
2815
- │ course, lesson, product, video, post, etc. │
2816
- └────────────────┬─────────────────────────────────┘
2817
- │
2818
- ↓
2819
- ┌──────────────────────────────────────────────────┐
2820
- │ 2 GENERIC SERVICES (handle everything) │
2821
- │ │
2822
- │ ThingClientService: │
2823
- │ - get(id) │
2824
- │ - list(type, orgId) │
2825
- │ - create({ type, name, properties }) │
2826
- │ - update(id, updates) │
2827
- │ - delete(id) │
2828
- │ │
2829
- │ ConnectionClientService: │
2830
- │ - create({ fromThingId, toThingId, type }) │
2831
- │ - getRelated(thingId, type, direction) │
2832
- │ - getCount(thingId, type) │
2833
- │ - delete(connectionId) │
2834
- └────────────────┬─────────────────────────────────┘
2835
- │
2836
- ↓
2837
- ┌──────────────────────────────────────────────────┐
2838
- │ SPECIALIZED SERVICES (optional, add as needed) │
2839
- │ │
2840
- │ CourseClientService (if you repeat patterns): │
2841
- │ - getCourseWithLessons() │
2842
- │ - enrollUser() │
2843
- │ - getEnrollmentCount() │
2844
- │ │
2845
- │ Add ONLY when patterns repeat 3+ times │
2846
- └──────────────────────────────────────────────────┘
2847
- ```
2848
-
2849
- **Start with generic services. Add specialized services as patterns emerge.**
2850
-
2851
- ### Context Engineering Results
2852
-
2853
- **Traditional approach:**
2854
- - Load: 50k-300k tokens per request
2855
- - Cost: $0.50-$3.00 per request
2856
- - Speed: 30-60 seconds
2857
- - Backends: 1 (tightly coupled)
2858
-
2859
- **Ontology-driven approach:**
2860
- - Load: 300-5k tokens per request (98-99% reduction)
2861
- - Cost: $0.003-$0.05 per request (100x cheaper)
2862
- - Speed: 2-5 seconds (10x faster)
2863
- - Backends: ∞ (swap with 1 line)
2864
-
2865
- ### Success Criteria
2866
-
2867
- | Level | Requirement |
2868
- |-------|-------------|
2869
- | **Layer 1: Rendering** | ✅ Pages render from backend data via SSR ✅ React islands for interactivity ✅ No database access |
2870
- | **Layer 2: Services** | ✅ Effect.ts services with typed errors ✅ Generic services handle all 66 types ✅ No backend-specific code |
2871
- | **Layer 3: Data** | ✅ DataProvider interface implemented ✅ Multiple backends work (Convex, WordPress, Notion, etc.) ✅ Swap backends with 1 config line |
2872
- | **Quality** | ✅ Unit tests with mock provider ✅ Integration tests with real backend ✅ E2E tests verify user flows ✅ TypeScript strict mode ✅ No manual type duplication |
2873
-
2874
- ### Final Checklist
2875
-
2876
- - [ ] DataProvider interface defined
2877
- - [ ] At least one provider implemented (ConvexProvider minimum)
2878
- - [ ] ThingClientService and ConnectionClientService created
2879
- - [ ] ClientLayer dependency injection set up
2880
- - [ ] useEffectRunner hook implemented
2881
- - [ ] Astro pages call backend via provider
2882
- - [ ] React components use useEffectRunner for mutations
2883
- - [ ] Error boundaries wrap interactive islands
2884
- - [ ] Real-time components use subscriptions (optional)
2885
- - [ ] Forms submit to backend (don't validate locally)
2886
- - [ ] Multi-tenant middleware extracts org from subdomain
2887
- - [ ] Unit tests use mock provider
2888
- - [ ] Integration tests use test backend
2889
- - [ ] Types synced from backend schema
2890
- - [ ] UI config for all 66 thing types
2891
- - [ ] Display components adapt to config
2892
-
2893
- ---
2894
-
2895
- **Frontend is pure rendering. Backend is everything else.**
2896
-
2897
- **Effect.ts for type-safe composability. Separate deployments. Real-time updates. Backend-agnostic forever.**
2898
-