oneie 2.0.1 → 2.0.3

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 (406) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +534 -0
  3. package/README.md +61 -4
  4. package/one/.obsidian/app.json +1 -0
  5. package/one/.obsidian/appearance.json +1 -0
  6. package/one/.obsidian/core-plugins.json +33 -0
  7. package/one/.obsidian/workspace.json +211 -0
  8. package/one/connections/a2a.md +551 -0
  9. package/one/connections/acp.md +761 -0
  10. package/one/connections/acps.md +731 -0
  11. package/one/connections/agui.md +767 -0
  12. package/one/connections/any-backend.md +1702 -0
  13. package/one/connections/ap2.md +998 -0
  14. package/one/connections/api-docs.md +1891 -0
  15. package/one/connections/api.md +2190 -0
  16. package/one/connections/architecture-diagram.md +94 -0
  17. package/one/connections/communications.md +449 -0
  18. package/one/connections/connections.md +339 -0
  19. package/one/connections/cryptonetworks.md +781 -0
  20. package/one/connections/documentation.md +1120 -0
  21. package/one/connections/effect.md +279 -0
  22. package/one/connections/elizaos.md +1290 -0
  23. package/one/connections/inference.md +58 -0
  24. package/one/connections/kyc.md +632 -0
  25. package/one/connections/mcp.md +842 -0
  26. package/one/connections/membership.md +1152 -0
  27. package/one/connections/middleware.md +1067 -0
  28. package/one/connections/multitenant.md +1341 -0
  29. package/one/connections/n8n.md +1015 -0
  30. package/one/connections/patterns.md +89 -0
  31. package/one/connections/protocols.md +279 -0
  32. package/one/connections/relationships.md +107 -0
  33. package/one/connections/schema.md +587 -0
  34. package/one/connections/service-layer.md +550 -0
  35. package/one/connections/structure.md +0 -0
  36. package/one/connections/vectors.md +207 -0
  37. package/one/connections/wordpress.md +1302 -0
  38. package/one/connections/workflow-copy.md +905 -0
  39. package/one/connections/workflow-examples.md +741 -0
  40. package/one/connections/workflow.md +905 -0
  41. package/one/connections/workflows/delegation.md +885 -0
  42. package/one/connections/workflows/frontend.md +1037 -0
  43. package/one/connections/workflows/strategy.md +903 -0
  44. package/one/connections/workflows/tasks.md +698 -0
  45. package/one/connections/x402.md +1249 -0
  46. package/one/events/events.md +545 -0
  47. package/one/knowledge/ai-platform.md +305 -0
  48. package/one/knowledge/architecture-diagram.md +94 -0
  49. package/one/knowledge/architecture-frontend.md +930 -0
  50. package/one/knowledge/architecture.md +2077 -0
  51. package/one/knowledge/crypto.md +960 -0
  52. package/one/knowledge/dsl.md +1660 -0
  53. package/one/knowledge/files.md +2471 -0
  54. package/one/knowledge/frontend.md +1038 -0
  55. package/one/knowledge/hono.md +2109 -0
  56. package/one/knowledge/implementation-examples.md +2536 -0
  57. package/one/knowledge/inference-score.md +159 -0
  58. package/one/knowledge/knowledge.md +642 -0
  59. package/one/knowledge/language.md +980 -0
  60. package/one/knowledge/lessons-learned.md +70 -0
  61. package/one/knowledge/ontology-6-dimensions.md +0 -0
  62. package/one/knowledge/ontology-documentation.md +356 -0
  63. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  64. package/one/knowledge/ontology-engineering.md +1652 -0
  65. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  66. package/one/knowledge/ontology-frontend-copy.md +753 -0
  67. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  68. package/one/knowledge/ontology-frontend.md +2427 -0
  69. package/one/knowledge/ontology-minimal.yaml +299 -0
  70. package/one/knowledge/ontology.md +2819 -0
  71. package/one/knowledge/ontology.yaml +1165 -0
  72. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  73. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  74. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  75. package/one/knowledge/patterns/backend/query-template.md +267 -0
  76. package/one/knowledge/patterns/backend/service-template.md +237 -0
  77. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  78. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  79. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  80. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  81. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  82. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  83. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  84. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  85. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  86. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  87. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  88. package/one/knowledge/quality-loop.md +401 -0
  89. package/one/knowledge/readme.md +131 -0
  90. package/one/knowledge/rules.md +626 -0
  91. package/one/knowledge/score.md +67 -0
  92. package/one/knowledge/specifications.md +855 -0
  93. package/one/knowledge/tags.md +130 -0
  94. package/one/organisation/one.md +599 -0
  95. package/one/organisation/organisation.md +438 -0
  96. package/one/organisation/revenue.md +673 -0
  97. package/one/organisation/strategy.md +869 -0
  98. package/one/organisation/vision.md +98 -0
  99. package/one/people/anthony-o-connell.md +440 -0
  100. package/one/people/people.md +567 -0
  101. package/one/repomix-output.md +92634 -0
  102. package/one/things/agentkit.md +349 -0
  103. package/one/things/agents/agent-backend.md +1401 -0
  104. package/one/things/agents/agent-builder.md +955 -0
  105. package/one/things/agents/agent-clean.md +709 -0
  106. package/one/things/agents/agent-clone.md +1341 -0
  107. package/one/things/agents/agent-designer.md +2177 -0
  108. package/one/things/agents/agent-director.md +1508 -0
  109. package/one/things/agents/agent-documenter.md +1049 -0
  110. package/one/things/agents/agent-frontend.md +1119 -0
  111. package/one/things/agents/agent-integrator.md +1192 -0
  112. package/one/things/agents/agent-problem-solver.md +1379 -0
  113. package/one/things/agents/agent-quality.md +1353 -0
  114. package/one/things/agents/agent-sales.md +986 -0
  115. package/one/things/cascade/cascade.yaml +464 -0
  116. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  117. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  118. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  119. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  120. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  121. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  122. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  123. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  124. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  125. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  126. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  127. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  128. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  129. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  130. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  131. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  132. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  133. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  134. package/one/things/cascade/docs/examples/readme.md +222 -0
  135. package/one/things/cascade/docs/getting-started.md +515 -0
  136. package/one/things/cascade/docs/workflow.md +1372 -0
  137. package/one/things/cascade/readme.md +336 -0
  138. package/one/things/cascade/templates/feature-template.md +267 -0
  139. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  140. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  141. package/one/things/claude/agents/analyst.md +483 -0
  142. package/one/things/claude/agents/architect.md +480 -0
  143. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  144. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  145. package/one/things/claude/agents/builder-repo.md +489 -0
  146. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  147. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  148. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  149. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  150. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  151. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  152. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  153. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  154. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  155. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  156. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  157. package/one/things/claude/agents/content-formatter.md +546 -0
  158. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  159. package/one/things/claude/agents/content-image-formatter.md +535 -0
  160. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  161. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  162. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  163. package/one/things/claude/agents/content-team-manager.md +622 -0
  164. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  165. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  166. package/one/things/claude/agents/core-manager.md +582 -0
  167. package/one/things/claude/agents/core-master.md +403 -0
  168. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  169. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  170. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  171. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  172. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  173. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  174. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  175. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  176. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  177. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  178. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  179. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  180. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  181. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  182. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  183. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  184. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  185. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  186. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  187. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  188. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  189. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  190. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  191. package/one/things/claude/agents/customer-success-manager.md +581 -0
  192. package/one/things/claude/agents/dev.md +413 -0
  193. package/one/things/claude/agents/documenter.md +546 -0
  194. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  195. package/one/things/claude/agents/engagement-specialist.md +509 -0
  196. package/one/things/claude/agents/engineering-architect.md +387 -0
  197. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  198. package/one/things/claude/agents/engineering-developer.md +387 -0
  199. package/one/things/claude/agents/engineering-director.md +282 -0
  200. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  201. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  202. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  203. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  204. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  205. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  206. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  207. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  208. package/one/things/claude/agents/improver.md +763 -0
  209. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  210. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  211. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  212. package/one/things/claude/agents/market-research-analyst.md +412 -0
  213. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  214. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  215. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  216. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  217. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  218. package/one/things/claude/agents/marketing-director.md +397 -0
  219. package/one/things/claude/agents/marketing-engagement.md +326 -0
  220. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  221. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  222. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  223. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  224. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  225. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  226. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  227. package/one/things/claude/agents/mission-commander.md +373 -0
  228. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  229. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  230. package/one/things/claude/agents/npx.md +890 -0
  231. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  232. package/one/things/claude/agents/one-master.md +355 -0
  233. package/one/things/claude/agents/one-orchestrator.md +315 -0
  234. package/one/things/claude/agents/one.md +601 -0
  235. package/one/things/claude/agents/playbook-generator.md +503 -0
  236. package/one/things/claude/agents/pm.md +326 -0
  237. package/one/things/claude/agents/po.md +345 -0
  238. package/one/things/claude/agents/qa.md +336 -0
  239. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  240. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  241. package/one/things/claude/agents/research-market-analyst.md +307 -0
  242. package/one/things/claude/agents/research-team-manager.md +482 -0
  243. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  244. package/one/things/claude/agents/sales-team-manager.md +400 -0
  245. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  246. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  247. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  248. package/one/things/claude/agents/service-success-manager.md +307 -0
  249. package/one/things/claude/agents/service-team-manager.md +400 -0
  250. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  251. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  252. package/one/things/claude/agents/sm.md +327 -0
  253. package/one/things/claude/agents/story-teller.md +473 -0
  254. package/one/things/claude/agents/task-master.md +596 -0
  255. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  256. package/one/things/claude/agents/tester.md +556 -0
  257. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  258. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  259. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  260. package/one/things/claude/agents/upsell-strategist.md +480 -0
  261. package/one/things/claude/agents/ux-expert.md +335 -0
  262. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  263. package/one/things/claude/claude-code-hooks-development.json +21 -0
  264. package/one/things/claude/claude-code-hooks-production.json +21 -0
  265. package/one/things/claude/claude-code-hooks.json +25 -0
  266. package/one/things/claude/commands/agent.md +104 -0
  267. package/one/things/claude/commands/cascade-status.md +128 -0
  268. package/one/things/claude/commands/ingest.md +290 -0
  269. package/one/things/claude/commands/ingestor.md +136 -0
  270. package/one/things/claude/commands/mission.md +83 -0
  271. package/one/things/claude/commands/npx.md +133 -0
  272. package/one/things/claude/commands/one.md +440 -0
  273. package/one/things/claude/commands/quality-check.md +204 -0
  274. package/one/things/claude/commands/smart-route.md +220 -0
  275. package/one/things/claude/commands/start.md +121 -0
  276. package/one/things/claude/commands/story.md +83 -0
  277. package/one/things/claude/commands/task.md +173 -0
  278. package/one/things/claude/hook-bypass.json +32 -0
  279. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  280. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  281. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  282. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  283. package/one/things/claude/hooks/build-hook.sh +156 -0
  284. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  285. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  286. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  287. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  288. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  289. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  290. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  291. package/one/things/claude/hooks/format-hook.sh +43 -0
  292. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  293. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  294. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  295. package/one/things/claude/hooks/hook-logger.sh +89 -0
  296. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  297. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  298. package/one/things/claude/hooks/lint-hook.sh +140 -0
  299. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  300. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  301. package/one/things/claude/hooks/notification-hook.sh +204 -0
  302. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  303. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  304. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  305. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  306. package/one/things/claude/hooks/performance-metrics.json +25 -0
  307. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  308. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  309. package/one/things/claude/hooks/security-hook.sh +256 -0
  310. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  311. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  312. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  313. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  314. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  315. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  316. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  317. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  318. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  319. package/one/things/claude/hooks/test-hook.sh +145 -0
  320. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  321. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  322. package/one/things/claude/settings-local.json +86 -0
  323. package/one/things/cli-code.md +652 -0
  324. package/one/things/cli-compiler-code.md +652 -0
  325. package/one/things/cli.md +1045 -0
  326. package/one/things/components/card-shadcn.md +929 -0
  327. package/one/things/components/card.md +1050 -0
  328. package/one/things/components.md +1669 -0
  329. package/one/things/componets.md +4 -0
  330. package/one/things/copilotkit.md +1559 -0
  331. package/one/things/creator-diagram.md +166 -0
  332. package/one/things/examples/children/lemonade-stand.md +366 -0
  333. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  334. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  335. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  336. package/one/things/features/1-1-agent-prompts.md +486 -0
  337. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  338. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  339. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  340. package/one/things/features/1-3-event-coordination/design.md +544 -0
  341. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  342. package/one/things/features/1-3-event-coordination.md +508 -0
  343. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  344. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  345. package/one/things/features/1-4-knowledge-management.md +577 -0
  346. package/one/things/features/1-5-quality-loops/design.md +797 -0
  347. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  348. package/one/things/features/1-5-quality-loops.md +641 -0
  349. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  350. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  351. package/one/things/features/1-6-numbering-structure.md +575 -0
  352. package/one/things/features/2-cli.md +1235 -0
  353. package/one/things/features/use-one-backend.md +1180 -0
  354. package/one/things/ideas/1-create-workflow.md +189 -0
  355. package/one/things/plans/1-create-workflow-status.md +555 -0
  356. package/one/things/plans/1-create-workflow.md +713 -0
  357. package/one/things/plans/app.md +761 -0
  358. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  359. package/one/things/plans/better-auth-any-backend.md +1852 -0
  360. package/one/things/plans/better-auth-available-features.md +235 -0
  361. package/one/things/plans/big-plan.md +38 -0
  362. package/one/things/plans/convex-better-auth.md +1109 -0
  363. package/one/things/plans/convex-on-off.md +389 -0
  364. package/one/things/plans/desktop.md +1121 -0
  365. package/one/things/plans/effect-components.md +1669 -0
  366. package/one/things/plans/effect.md +973 -0
  367. package/one/things/plans/email.md +953 -0
  368. package/one/things/plans/enhance-auth.md +1669 -0
  369. package/one/things/plans/install-components.md +198 -0
  370. package/one/things/plans/landing.md +728 -0
  371. package/one/things/plans/layout.md +205 -0
  372. package/one/things/plans/mail-backend.md +1308 -0
  373. package/one/things/plans/mail.md +2624 -0
  374. package/one/things/plans/next-features.md +83 -0
  375. package/one/things/plans/one.md +658 -0
  376. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  377. package/one/things/plans/ontology-driven-strategy.md +866 -0
  378. package/one/things/plans/ontology-ui-approach.md +357 -0
  379. package/one/things/plans/open-agent.md +785 -0
  380. package/one/things/plans/performace.md +90 -0
  381. package/one/things/plans/releases.md +809 -0
  382. package/one/things/plans/repos.md +76 -0
  383. package/one/things/plans/separate-copy-2.md +1293 -0
  384. package/one/things/plans/separate-copy-3.md +2458 -0
  385. package/one/things/plans/separate-copy.md +1293 -0
  386. package/one/things/plans/separate.md +1983 -0
  387. package/one/things/plans/shadcn-integration-summary.md +450 -0
  388. package/one/things/plans/sidebar.md +172 -0
  389. package/one/things/plans/small-fixes.md +5 -0
  390. package/one/things/plans/test-backend-connection.md +476 -0
  391. package/one/things/plans/workflow-files.md +1196 -0
  392. package/one/things/plans/workflow.md +1372 -0
  393. package/one/things/products/cascade-landing-page.md +737 -0
  394. package/one/things/products/cascade.md +1518 -0
  395. package/one/things/products/context-engineering.md +1427 -0
  396. package/one/things/products/onthology.md +0 -0
  397. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  398. package/one/things/products/ontology-ui.md +1387 -0
  399. package/one/things/products/ontology.md +717 -0
  400. package/one/things/products/sdk.md +557 -0
  401. package/one/things/promptkit.md +903 -0
  402. package/one/things/service-providers-new.md +982 -0
  403. package/one/things/service-providers.md +1092 -0
  404. package/one/things/things.md +349 -0
  405. package/one/things/todo.md +1248 -0
  406. package/package.json +5 -2
@@ -0,0 +1,930 @@
1
+ # ONE Frontend Architecture
2
+
3
+ **Building the Rendering Layer - Backend-Agnostic, Type-Safe, Composable**
4
+
5
+ ---
6
+
7
+ ## Executive Summary
8
+
9
+ The ONE frontend is **purely a rendering and interaction layer** with zero business logic. It:
10
+
11
+ 1. **Renders UI** from data provided by backends
12
+ 2. **Calls backend APIs** via abstract DataProvider interface
13
+ 3. **Manages UI state** (loading, errors, forms)
14
+ 4. **Displays real-time updates** via subscriptions
15
+
16
+ ```
17
+ ┌────────────────────────────────────────────────────────┐
18
+ │ FRONTEND (Astro + React) │
19
+ │ ✅ Renders HTML/React components │
20
+ │ ✅ Calls DataProvider interface │
21
+ │ ✅ Manages UI state only │
22
+ │ ✅ Backend-agnostic by design │
23
+ │ ❌ NO database access │
24
+ │ ❌ NO business logic │
25
+ │ ❌ NO data validation │
26
+ └──────────────────────┬─────────────────────────────────┘
27
+ │ DataProvider Interface
28
+ │ (Universal 6-Dimension API)
29
+ ↓
30
+ ┌────────────────────────────────────────────────────────┐
31
+ │ BACKEND PROVIDERS (Pluggable) │
32
+ │ │
33
+ │ ConvexProvider → Convex real-time backend │
34
+ │ WordPressProvider → WordPress CMS │
35
+ │ NotionProvider → Notion databases │
36
+ │ SupabaseProvider → Supabase PostgreSQL │
37
+ │ CustomProvider → Your own API │
38
+ │ │
39
+ │ Change backend with ONE line in config │
40
+ └────────────────────────────────────────────────────────┘
41
+ ```
42
+
43
+ **Tech Stack:**
44
+ - **Astro** - SSR/SSG (pages, layouts)
45
+ - **React 19** - Interactive components (islands)
46
+ - **Effect.ts** - Type-safe, composable operations
47
+ - **DataProvider Pattern** - Backend-agnostic interface
48
+ - **Tailwind + shadcn/ui** - Styling
49
+ - **TypeScript** - End-to-end type safety
50
+
51
+ ---
52
+
53
+ ## Table of Contents
54
+
55
+ 1. [What Frontend IS and IS NOT](#what-frontend-is-and-is-not)
56
+ 2. [Backend-Agnostic Architecture](#backend-agnostic-architecture)
57
+ 3. [DataProvider Interface](#dataprovider-interface)
58
+ 4. [Provider Implementations](#provider-implementations)
59
+ 5. [Configuration](#configuration)
60
+ 6. [Effect.ts Service Layer](#effectts-service-layer)
61
+ 7. [React Integration](#react-integration)
62
+ 8. [Component Patterns](#component-patterns)
63
+ 9. [Page Patterns (SSR)](#page-patterns-ssr)
64
+ 10. [Multi-Tenant Routing](#multi-tenant-routing)
65
+ 11. [File Structure](#file-structure)
66
+ 12. [Deployment](#deployment)
67
+
68
+ ---
69
+
70
+ ## What Frontend IS and IS NOT
71
+
72
+ ### ✅ Frontend IS Responsible For:
73
+
74
+ **1. Rendering UI**
75
+ ```tsx
76
+ <h1>{course.name}</h1>
77
+ <p>{course.properties.description}</p>
78
+ ```
79
+
80
+ **2. Calling Backend APIs**
81
+ ```tsx
82
+ const program = Effect.gen(function* () {
83
+ const provider = yield* DataProvider
84
+ return yield* provider.things.list({ type: 'course' })
85
+ })
86
+ ```
87
+
88
+ **3. Managing UI State**
89
+ ```tsx
90
+ const { run, loading, error } = useEffectRunner()
91
+ ```
92
+
93
+ **4. User Interactions**
94
+ ```tsx
95
+ <button onClick={handleClick}>Create Course</button>
96
+ ```
97
+
98
+ ### ❌ Frontend IS NOT Responsible For:
99
+
100
+ **1. Database Operations**
101
+ ```tsx
102
+ // ❌ NEVER do this in frontend
103
+ const courses = await db.query('things').filter(...).collect()
104
+ ```
105
+
106
+ **2. Business Logic**
107
+ ```tsx
108
+ // ❌ NEVER do this in frontend
109
+ if (user.tokens < course.price) {
110
+ // Backend handles pricing, quotas, calculations
111
+ }
112
+ ```
113
+
114
+ **3. Data Validation**
115
+ ```tsx
116
+ // ❌ Frontend validation is UX-only
117
+ // Backend MUST validate for security
118
+ ```
119
+
120
+ **4. Authorization**
121
+ ```tsx
122
+ // ❌ Frontend can hide UI elements
123
+ // Backend MUST authorize all operations
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Backend-Agnostic Architecture
129
+
130
+ **Inspired by Astro's Content Layer Pattern**
131
+
132
+ Frontend components never know which backend they're talking to. Change backends by editing ONE line:
133
+
134
+ ```typescript
135
+ // astro.config.ts
136
+ import { defineConfig } from 'astro/config'
137
+ import { one } from '@one/astro-integration'
138
+
139
+ // Import providers
140
+ import { convexProvider } from './src/providers/convex'
141
+ import { wordpressProvider } from './src/providers/wordpress'
142
+
143
+ export default defineConfig({
144
+ integrations: [
145
+ react(),
146
+ one({
147
+ // ✅ Change this ONE line to swap backends
148
+ provider: convexProvider({
149
+ url: import.meta.env.PUBLIC_CONVEX_URL
150
+ })
151
+
152
+ // Or use WordPress:
153
+ // provider: wordpressProvider({
154
+ // url: 'https://yoursite.com',
155
+ // apiKey: import.meta.env.WORDPRESS_API_KEY
156
+ // })
157
+ })
158
+ ]
159
+ })
160
+ ```
161
+
162
+ **Key Principle:** Frontend code stays the same. Only data source changes.
163
+
164
+ ---
165
+
166
+ ## DataProvider Interface
167
+
168
+ **The universal 6-dimension ontology API.**
169
+
170
+ Every backend provider must implement this interface:
171
+
172
+ ```typescript
173
+ // frontend/src/providers/DataProvider.ts
174
+ import { Effect, Context } from 'effect'
175
+
176
+ // Error types (universal across all providers)
177
+ export class ThingNotFoundError {
178
+ readonly _tag = 'ThingNotFoundError'
179
+ constructor(readonly thingId: string) {}
180
+ }
181
+
182
+ export class ConnectionCreateError {
183
+ readonly _tag = 'ConnectionCreateError'
184
+ constructor(readonly reason: string) {}
185
+ }
186
+
187
+ // DataProvider interface - all backends implement this
188
+ export interface DataProvider {
189
+ // Dimension 1: Organizations
190
+ organizations: {
191
+ get: (id: string) => Effect.Effect<Organization, OrganizationNotFoundError>
192
+ list: (params?: { status?: string }) => Effect.Effect<Organization[], Error>
193
+ update: (id: string, updates: Partial<Organization>) => Effect.Effect<void, Error>
194
+ }
195
+
196
+ // Dimension 2: People
197
+ people: {
198
+ get: (id: string) => Effect.Effect<Person, PersonNotFoundError>
199
+ list: (params: {
200
+ organizationId?: string
201
+ role?: string
202
+ }) => Effect.Effect<Person[], Error>
203
+ create: (input: {
204
+ email: string
205
+ displayName: string
206
+ role: string
207
+ organizationId: string
208
+ }) => Effect.Effect<string, Error>
209
+ }
210
+
211
+ // Dimension 3: Things
212
+ things: {
213
+ get: (id: string) => Effect.Effect<Thing, ThingNotFoundError>
214
+ list: (params: {
215
+ type: ThingType
216
+ organizationId?: string
217
+ filters?: Record<string, any>
218
+ }) => Effect.Effect<Thing[], Error>
219
+ create: (input: {
220
+ type: ThingType
221
+ name: string
222
+ organizationId: string
223
+ properties: Record<string, any>
224
+ }) => Effect.Effect<string, Error>
225
+ update: (id: string, updates: Partial<Thing>) => Effect.Effect<void, Error>
226
+ delete: (id: string) => Effect.Effect<void, Error>
227
+ }
228
+
229
+ // Dimension 4: Connections
230
+ connections: {
231
+ create: (input: {
232
+ fromThingId: string
233
+ toThingId: string
234
+ relationshipType: ConnectionType
235
+ metadata?: Record<string, any>
236
+ }) => Effect.Effect<string, ConnectionCreateError>
237
+ getRelated: (params: {
238
+ thingId: string
239
+ relationshipType: ConnectionType
240
+ direction: 'from' | 'to' | 'both'
241
+ }) => Effect.Effect<Thing[], Error>
242
+ getCount: (thingId: string, relationshipType: ConnectionType) => Effect.Effect<number, Error>
243
+ }
244
+
245
+ // Dimension 5: Events
246
+ events: {
247
+ log: (event: {
248
+ type: EventType
249
+ actorId: string
250
+ targetId?: string
251
+ organizationId: string
252
+ metadata?: Record<string, any>
253
+ }) => Effect.Effect<void, Error>
254
+ }
255
+
256
+ // Dimension 6: Knowledge
257
+ knowledge: {
258
+ search: (params: {
259
+ query: string
260
+ organizationId?: string
261
+ limit?: number
262
+ }) => Effect.Effect<KnowledgeMatch[], Error>
263
+ }
264
+ }
265
+
266
+ export const DataProvider = Context.GenericTag<DataProvider>('DataProvider')
267
+ ```
268
+
269
+ **Key Insight:** This interface IS the ONE ontology. Any backend that implements it can power ONE.
270
+
271
+ ---
272
+
273
+ ## Provider Implementations
274
+
275
+ ### Convex Provider
276
+
277
+ ```typescript
278
+ // frontend/src/providers/convex/ConvexProvider.ts
279
+ import { Effect, Layer } from 'effect'
280
+ import { ConvexHttpClient } from 'convex/browser'
281
+ import { DataProvider } from '../DataProvider'
282
+
283
+ export class ConvexProvider implements DataProvider {
284
+ constructor(private client: ConvexHttpClient) {}
285
+
286
+ things = {
287
+ get: (id: string) =>
288
+ Effect.tryPromise({
289
+ try: () => this.client.query(api.queries.things.get, { id }),
290
+ catch: (error) => new ThingNotFoundError(id)
291
+ }),
292
+
293
+ list: (params) =>
294
+ Effect.tryPromise({
295
+ try: () => this.client.query(api.queries.things.list, params),
296
+ catch: (error) => new Error(String(error))
297
+ }),
298
+
299
+ create: (input) =>
300
+ Effect.tryPromise({
301
+ try: () => this.client.mutation(api.mutations.things.create, input),
302
+ catch: (error) => new ConnectionCreateError(String(error))
303
+ })
304
+ }
305
+
306
+ // ... connections, events, knowledge
307
+ }
308
+
309
+ export function convexProvider(config: { url: string }) {
310
+ return Layer.succeed(
311
+ DataProvider,
312
+ new ConvexProvider(new ConvexHttpClient(config.url))
313
+ )
314
+ }
315
+ ```
316
+
317
+ ### WordPress Provider
318
+
319
+ ```typescript
320
+ // frontend/src/providers/wordpress/WordPressProvider.ts
321
+ import { Effect, Layer } from 'effect'
322
+ import { DataProvider } from '../DataProvider'
323
+
324
+ export class WordPressProvider implements DataProvider {
325
+ constructor(private baseUrl: string, private apiKey: string) {}
326
+
327
+ things = {
328
+ get: (id: string) =>
329
+ Effect.gen(function* () {
330
+ const response = yield* Effect.tryPromise({
331
+ try: () =>
332
+ fetch(`${this.baseUrl}/wp-json/wp/v2/posts/${id}`, {
333
+ headers: { Authorization: `Bearer ${this.apiKey}` }
334
+ }),
335
+ catch: (error) => new Error(String(error))
336
+ })
337
+
338
+ const post = yield* Effect.tryPromise({
339
+ try: () => response.json(),
340
+ catch: (error) => new Error(String(error))
341
+ })
342
+
343
+ // Transform WordPress post → ONE thing
344
+ return {
345
+ _id: post.id.toString(),
346
+ type: 'post' as ThingType,
347
+ name: post.title.rendered,
348
+ properties: {
349
+ content: post.content.rendered,
350
+ excerpt: post.excerpt.rendered
351
+ },
352
+ status: post.status,
353
+ createdAt: new Date(post.date).getTime()
354
+ }
355
+ })
356
+ }
357
+
358
+ // ... other dimensions
359
+ }
360
+
361
+ export function wordpressProvider(config: { url: string; apiKey: string }) {
362
+ return Layer.succeed(
363
+ DataProvider,
364
+ new WordPressProvider(config.url, config.apiKey)
365
+ )
366
+ }
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Configuration
372
+
373
+ **Swap backends by changing ONE line:**
374
+
375
+ ```typescript
376
+ // astro.config.ts
377
+ export default defineConfig({
378
+ integrations: [
379
+ react(),
380
+ one({
381
+ // Option 1: Convex (real-time, serverless)
382
+ provider: convexProvider({
383
+ url: import.meta.env.PUBLIC_CONVEX_URL
384
+ })
385
+
386
+ // Option 2: WordPress (existing CMS)
387
+ // provider: wordpressProvider({
388
+ // url: 'https://yoursite.com',
389
+ // apiKey: import.meta.env.WORDPRESS_API_KEY
390
+ // })
391
+
392
+ // Option 3: Supabase (PostgreSQL + real-time)
393
+ // provider: supabaseProvider({
394
+ // url: import.meta.env.PUBLIC_SUPABASE_URL,
395
+ // apiKey: import.meta.env.PUBLIC_SUPABASE_ANON_KEY
396
+ // })
397
+
398
+ // Option 4: Custom backend
399
+ // provider: customProvider({ ... })
400
+ })
401
+ ]
402
+ })
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Effect.ts Service Layer
408
+
409
+ **Services wrap DataProvider in type-safe, composable operations.**
410
+
411
+ ### Generic Thing Service
412
+
413
+ ```typescript
414
+ // frontend/src/services/ThingService.ts
415
+ import { Effect } from 'effect'
416
+ import { DataProvider } from '@/providers/DataProvider'
417
+
418
+ export class ThingService extends Effect.Service<ThingService>()(
419
+ 'ThingService',
420
+ {
421
+ effect: Effect.gen(function* () {
422
+ const provider = yield* DataProvider
423
+
424
+ return {
425
+ get: (id: string) => provider.things.get(id),
426
+
427
+ list: (type: ThingType, orgId?: string) =>
428
+ provider.things.list({
429
+ type,
430
+ organizationId: orgId
431
+ }),
432
+
433
+ create: (input: {
434
+ type: ThingType
435
+ name: string
436
+ properties: any
437
+ }) => provider.things.create(input),
438
+
439
+ update: (id: string, updates: any) =>
440
+ provider.things.update(id, updates),
441
+
442
+ delete: (id: string) =>
443
+ provider.things.delete(id)
444
+ }
445
+ }),
446
+ dependencies: [DataProvider]
447
+ }
448
+ ) {}
449
+ ```
450
+
451
+ ### Generic Connection Service
452
+
453
+ ```typescript
454
+ // frontend/src/services/ConnectionService.ts
455
+ import { Effect } from 'effect'
456
+ import { DataProvider } from '@/providers/DataProvider'
457
+
458
+ export class ConnectionService extends Effect.Service<ConnectionService>()(
459
+ 'ConnectionService',
460
+ {
461
+ effect: Effect.gen(function* () {
462
+ const provider = yield* DataProvider
463
+
464
+ return {
465
+ create: (input: {
466
+ fromThingId: string
467
+ toThingId: string
468
+ relationshipType: ConnectionType
469
+ }) => provider.connections.create(input),
470
+
471
+ getRelated: (thingId: string, relationshipType: ConnectionType) =>
472
+ provider.connections.getRelated({
473
+ thingId,
474
+ relationshipType,
475
+ direction: 'both'
476
+ }),
477
+
478
+ getCount: (thingId: string, relationshipType: ConnectionType) =>
479
+ provider.connections.getCount(thingId, relationshipType)
480
+ }
481
+ }),
482
+ dependencies: [DataProvider]
483
+ }
484
+ ) {}
485
+ ```
486
+
487
+ **Key Point:** These 2 generic services handle ALL 66 thing types. No specialized services needed upfront.
488
+
489
+ ---
490
+
491
+ ## React Integration
492
+
493
+ ### useEffectRunner Hook
494
+
495
+ ```typescript
496
+ // frontend/src/hooks/useEffectRunner.ts
497
+ import { useCallback, useState } from 'react'
498
+ import { Effect } from 'effect'
499
+ import { ClientLayer } from '@/services/ClientLayer'
500
+
501
+ export function useEffectRunner() {
502
+ const [loading, setLoading] = useState(false)
503
+ const [error, setError] = useState<string | null>(null)
504
+
505
+ const run = useCallback(async <A, E>(
506
+ effect: Effect.Effect<A, E>,
507
+ options?: {
508
+ onSuccess?: (result: A) => void
509
+ onError?: (error: E) => void
510
+ }
511
+ ) => {
512
+ setLoading(true)
513
+ setError(null)
514
+
515
+ try {
516
+ const result = await Effect.runPromise(
517
+ effect.pipe(Effect.provide(ClientLayer))
518
+ )
519
+
520
+ options?.onSuccess?.(result)
521
+ return result
522
+ } catch (err) {
523
+ const errorMessage = err instanceof Error ? err.message : String(err)
524
+ setError(errorMessage)
525
+ options?.onError?.(err as E)
526
+ throw err
527
+ } finally {
528
+ setLoading(false)
529
+ }
530
+ }, [])
531
+
532
+ return { run, loading, error }
533
+ }
534
+ ```
535
+
536
+ ### Using in Components
537
+
538
+ ```tsx
539
+ // frontend/src/components/CourseEnrollButton.tsx
540
+ import { useEffectRunner } from '@/hooks/useEffectRunner'
541
+ import { ConnectionService } from '@/services/ConnectionService'
542
+ import { Effect } from 'effect'
543
+
544
+ export function CourseEnrollButton({ courseId, userId }) {
545
+ const { run, loading, error } = useEffectRunner()
546
+
547
+ const handleEnroll = () => {
548
+ const program = Effect.gen(function* () {
549
+ const connections = yield* ConnectionService
550
+
551
+ // Enroll = create connection
552
+ return yield* connections.create({
553
+ fromThingId: userId,
554
+ toThingId: courseId,
555
+ relationshipType: 'enrolled_in'
556
+ })
557
+ })
558
+
559
+ run(program, {
560
+ onSuccess: (id) => {
561
+ console.log('Enrolled successfully')
562
+ window.location.href = `/courses/${courseId}/learn`
563
+ }
564
+ })
565
+ }
566
+
567
+ return (
568
+ <div>
569
+ <button onClick={handleEnroll} disabled={loading}>
570
+ {loading ? 'Enrolling...' : 'Enroll Now'}
571
+ </button>
572
+ {error && <Alert variant="destructive">{error}</Alert>}
573
+ </div>
574
+ )
575
+ }
576
+ ```
577
+
578
+ ---
579
+
580
+ ## Component Patterns
581
+
582
+ ### Generic Card Component
583
+
584
+ ```tsx
585
+ // frontend/src/components/cards/Card.tsx
586
+ import { Card } from '@/components/ui/card'
587
+ import { getThingConfig } from '@/ontology/config'
588
+ import * as Icons from 'lucide-react'
589
+
590
+ interface CardProps {
591
+ thing: {
592
+ _id: string
593
+ type: string
594
+ name: string
595
+ properties: Record<string, any>
596
+ }
597
+ }
598
+
599
+ export function Card({ thing }: CardProps) {
600
+ const config = getThingConfig(thing.type)
601
+ const Icon = Icons[config.icon]
602
+
603
+ const title = thing.properties[config.primaryField] || thing.name
604
+ const subtitle = thing.properties[config.secondaryField]
605
+ const image = thing.properties[config.imageField]
606
+
607
+ return (
608
+ <Card>
609
+ {image && <img src={image} alt={title} />}
610
+ <div className="p-4">
611
+ <div className="flex items-center gap-2">
612
+ <Icon className="w-5 h-5" />
613
+ <span>{config.displayName}</span>
614
+ </div>
615
+ <h3 className="text-xl font-bold">{title}</h3>
616
+ {subtitle && <p className="text-gray-600">{subtitle}</p>}
617
+ <a href={`/${thing.type}s/${thing._id}`}>
618
+ <button>View Details</button>
619
+ </a>
620
+ </div>
621
+ </Card>
622
+ )
623
+ }
624
+ ```
625
+
626
+ ### Composable Operations
627
+
628
+ ```tsx
629
+ // frontend/src/components/CourseCreator.tsx
630
+ import { useEffectRunner } from '@/hooks/useEffectRunner'
631
+ import { ThingService } from '@/services/ThingService'
632
+ import { ConnectionService } from '@/services/ConnectionService'
633
+ import { Effect } from 'effect'
634
+
635
+ export function CourseCreator() {
636
+ const { run, loading, error } = useEffectRunner()
637
+ const [formData, setFormData] = useState({ ... })
638
+
639
+ const handleSubmit = async (e) => {
640
+ e.preventDefault()
641
+
642
+ const program = Effect.gen(function* () {
643
+ const things = yield* ThingService
644
+ const connections = yield* ConnectionService
645
+
646
+ // 1. Create course
647
+ const courseId = yield* things.create({
648
+ type: 'course',
649
+ name: formData.title,
650
+ properties: formData
651
+ })
652
+
653
+ // 2. Create default lesson
654
+ const lessonId = yield* things.create({
655
+ type: 'lesson',
656
+ name: 'Introduction',
657
+ properties: { content: 'Welcome!' }
658
+ })
659
+
660
+ // 3. Connect lesson to course
661
+ yield* connections.create({
662
+ fromThingId: lessonId,
663
+ toThingId: courseId,
664
+ relationshipType: 'part_of'
665
+ })
666
+
667
+ return courseId
668
+ })
669
+
670
+ await run(program, {
671
+ onSuccess: (id) => window.location.href = `/courses/${id}`
672
+ })
673
+ }
674
+
675
+ return <form onSubmit={handleSubmit}>...</form>
676
+ }
677
+ ```
678
+
679
+ ---
680
+
681
+ ## Page Patterns (SSR)
682
+
683
+ ### Fetch Data, Render HTML
684
+
685
+ ```astro
686
+ ---
687
+ // frontend/src/pages/courses/[id].astro
688
+ import { getConvexClient } from '@/lib/convex'
689
+ import { api } from '@/lib/api'
690
+ import Layout from '@/layouts/Layout.astro'
691
+
692
+ // SSR: Fetch from backend
693
+ const convex = getConvexClient()
694
+
695
+ const course = await convex.query(api.queries.things.get, {
696
+ id: Astro.params.id
697
+ })
698
+
699
+ if (!course) {
700
+ return Astro.redirect('/404')
701
+ }
702
+
703
+ const lessons = await convex.query(api.queries.connections.getRelated, {
704
+ thingId: course._id,
705
+ relationshipType: 'part_of',
706
+ direction: 'to'
707
+ })
708
+ ---
709
+
710
+ <Layout title={course.name}>
711
+ <header>
712
+ <h1>{course.name}</h1>
713
+ <p>{course.properties.description}</p>
714
+ <span>${course.properties.price}</span>
715
+ </header>
716
+
717
+ <section>
718
+ <h2>Lessons</h2>
719
+ {lessons.map(lesson => (
720
+ <div>
721
+ <h3>{lesson.name}</h3>
722
+ <p>{lesson.properties.content}</p>
723
+ </div>
724
+ ))}
725
+ </section>
726
+
727
+ <!-- Interactive component (React Island) -->
728
+ <EnrollButton client:load courseId={course._id} />
729
+ </Layout>
730
+ ```
731
+
732
+ ---
733
+
734
+ ## Multi-Tenant Routing
735
+
736
+ ### Middleware: Extract Org from Subdomain
737
+
738
+ ```typescript
739
+ // frontend/src/middleware.ts
740
+ import { defineMiddleware } from 'astro:middleware'
741
+ import { getConvexClient } from './lib/convex'
742
+ import { api } from './lib/api'
743
+
744
+ export const onRequest = defineMiddleware(async (context, next) => {
745
+ const url = new URL(context.request.url)
746
+
747
+ // Extract org slug from subdomain
748
+ // fitnesspro.one.ie → "fitnesspro"
749
+ const hostname = url.hostname
750
+ const orgSlug = hostname.split('.')[0]
751
+
752
+ if (['api', 'www', 'localhost'].includes(orgSlug)) {
753
+ return next()
754
+ }
755
+
756
+ // Fetch org from backend
757
+ const convex = getConvexClient()
758
+ const org = await convex.query(api.queries.orgs.getBySlug, {
759
+ slug: orgSlug
760
+ })
761
+
762
+ if (org) {
763
+ context.locals.org = org
764
+ context.locals.orgId = org._id
765
+ }
766
+
767
+ return next()
768
+ })
769
+ ```
770
+
771
+ ### Use Org Context in Pages
772
+
773
+ ```astro
774
+ ---
775
+ // frontend/src/pages/courses/index.astro
776
+ const org = Astro.locals.org
777
+
778
+ if (!org) {
779
+ return Astro.redirect('/404')
780
+ }
781
+
782
+ const convex = getConvexClient()
783
+ const courses = await convex.query(api.queries.things.list, {
784
+ type: 'course',
785
+ organizationId: org._id
786
+ })
787
+ ---
788
+
789
+ <Layout title={`${org.name} - Courses`}>
790
+ <h1>{org.name} Courses</h1>
791
+ {courses.map(course => (
792
+ <Card thing={course} />
793
+ ))}
794
+ </Layout>
795
+ ```
796
+
797
+ ---
798
+
799
+ ## File Structure
800
+
801
+ ```
802
+ frontend/
803
+ ├── src/
804
+ │ ├── pages/ # Astro pages (SSR/SSG)
805
+ │ │ ├── index.astro
806
+ │ │ ├── courses/
807
+ │ │ │ ├── index.astro
808
+ │ │ │ └── [id].astro
809
+ │ │ └── [thingType]/
810
+ │ │ └── [id].astro
811
+ │ ├── components/ # React components
812
+ │ │ ├── cards/
813
+ │ │ │ └── Card.tsx
814
+ │ │ ├── lists/
815
+ │ │ │ └── ThingList.tsx
816
+ │ │ └── forms/
817
+ │ │ └── ThingForm.tsx
818
+ │ ├── providers/ # Backend providers
819
+ │ │ ├── DataProvider.ts # Interface
820
+ │ │ ├── convex/
821
+ │ │ │ └── ConvexProvider.ts
822
+ │ │ └── wordpress/
823
+ │ │ └── WordPressProvider.ts
824
+ │ ├── services/ # Effect.ts services
825
+ │ │ ├── ThingService.ts
826
+ │ │ ├── ConnectionService.ts
827
+ │ │ └── ClientLayer.ts
828
+ │ ├── hooks/
829
+ │ │ └── useEffectRunner.ts
830
+ │ ├── ontology/
831
+ │ │ ├── types.ts # Type definitions
832
+ │ │ └── config.ts # UI config
833
+ │ └── middleware.ts
834
+ ├── astro.config.ts # Backend provider config
835
+ └── package.json
836
+ ```
837
+
838
+ ---
839
+
840
+ ## Deployment
841
+
842
+ ### Environment Setup
843
+
844
+ ```bash
845
+ # Frontend .env
846
+ PUBLIC_CONVEX_URL=https://backend.convex.cloud
847
+
848
+ # Or WordPress
849
+ WORDPRESS_URL=https://yoursite.com
850
+ WORDPRESS_API_KEY=your-key
851
+
852
+ # Or Supabase
853
+ PUBLIC_SUPABASE_URL=https://project.supabase.co
854
+ PUBLIC_SUPABASE_ANON_KEY=your-key
855
+ ```
856
+
857
+ ### Deploy Frontend
858
+
859
+ ```bash
860
+ cd frontend
861
+ npm run build
862
+
863
+ # Deploy to:
864
+ # - Cloudflare Pages (recommended)
865
+ # - Vercel
866
+ # - Netlify
867
+ ```
868
+
869
+ ### Deploy Backend (Separate)
870
+
871
+ ```bash
872
+ cd backend
873
+ npx convex deploy
874
+ # Deployed to: https://backend.convex.cloud
875
+ ```
876
+
877
+ **Frontend and backend are completely separate deployments.**
878
+
879
+ ---
880
+
881
+ ## Summary
882
+
883
+ ### Frontend Responsibilities
884
+
885
+ | What | How |
886
+ |------|-----|
887
+ | **Render UI** | Astro pages + React components |
888
+ | **Call Backend** | Effect.ts services via DataProvider |
889
+ | **Manage UI State** | useState, useEffectRunner |
890
+ | **Route Users** | Astro routing, middleware |
891
+
892
+ ### Backend Responsibilities
893
+
894
+ | What | Where |
895
+ |------|-------|
896
+ | **Database Operations** | Backend only |
897
+ | **Business Logic** | Backend only |
898
+ | **Data Validation** | Backend only |
899
+ | **Authorization** | Backend only |
900
+
901
+ ### Key Principles
902
+
903
+ 1. **Backend-Agnostic** - Change backends with ONE line
904
+ 2. **Type-Safe** - Effect.ts enforces error handling
905
+ 3. **Composable** - Services combine into complex flows
906
+ 4. **Multi-Tenant** - Subdomain-based org isolation
907
+ 5. **Stateless** - Frontend has no state, backend is source of truth
908
+
909
+ ### Three Backend Options
910
+
911
+ **Option 1: Self-Hosted (Convex, Supabase, WordPress, etc.)**
912
+ - Full control over infrastructure
913
+ - Use existing systems
914
+ - Implement DataProvider for your backend
915
+
916
+ **Option 2: ONE Backend (BaaS)**
917
+ - Zero backend work
918
+ - Managed service at api.one.ie
919
+ - Free tier: 10K API calls/month
920
+
921
+ **Option 3: Hybrid**
922
+ - Mix multiple backends
923
+ - Auth in Convex, blog in WordPress, products in Shopify
924
+ - CompositeProvider routes by thing type
925
+
926
+ ---
927
+
928
+ **Frontend is pure rendering. Backend is everything else.**
929
+
930
+ Effect.ts for type-safety. DataProvider for flexibility. Separate deployments.