oneie 3.6.40 → 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 (984) hide show
  1. package/README.md +28 -9
  2. package/dist/admin/build.d.ts +15 -0
  3. package/dist/admin/build.d.ts.map +1 -0
  4. package/dist/admin/build.js +295 -0
  5. package/dist/admin/build.js.map +1 -0
  6. package/dist/admin/index.d.ts +24 -0
  7. package/dist/admin/index.d.ts.map +1 -0
  8. package/dist/admin/index.js +98 -0
  9. package/dist/admin/index.js.map +1 -0
  10. package/dist/admin/list.d.ts +14 -0
  11. package/dist/admin/list.d.ts.map +1 -0
  12. package/dist/admin/list.js +90 -0
  13. package/dist/admin/list.js.map +1 -0
  14. package/dist/admin/manifest.d.ts +86 -0
  15. package/dist/admin/manifest.d.ts.map +1 -0
  16. package/dist/admin/manifest.js +183 -0
  17. package/dist/admin/manifest.js.map +1 -0
  18. package/dist/admin/monorepo.d.ts +25 -0
  19. package/dist/admin/monorepo.d.ts.map +1 -0
  20. package/dist/admin/monorepo.js +59 -0
  21. package/dist/admin/monorepo.js.map +1 -0
  22. package/dist/admin/release.d.ts +17 -0
  23. package/dist/admin/release.d.ts.map +1 -0
  24. package/dist/admin/release.js +144 -0
  25. package/dist/admin/release.js.map +1 -0
  26. package/dist/admin/sync.d.ts +14 -0
  27. package/dist/admin/sync.d.ts.map +1 -0
  28. package/dist/admin/sync.js +104 -0
  29. package/dist/admin/sync.js.map +1 -0
  30. package/dist/admin/validate.d.ts +15 -0
  31. package/dist/admin/validate.d.ts.map +1 -0
  32. package/dist/admin/validate.js +169 -0
  33. package/dist/admin/validate.js.map +1 -0
  34. package/dist/commands/agent.d.ts +2 -0
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +44 -0
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/ask.d.ts +4 -0
  39. package/dist/commands/ask.d.ts.map +1 -0
  40. package/dist/commands/ask.js +8 -0
  41. package/dist/commands/ask.js.map +1 -0
  42. package/dist/commands/bounty.d.ts +4 -0
  43. package/dist/commands/bounty.d.ts.map +1 -0
  44. package/dist/commands/bounty.js +24 -0
  45. package/dist/commands/bounty.js.map +1 -0
  46. package/dist/commands/capabilities.d.ts +4 -0
  47. package/dist/commands/capabilities.d.ts.map +1 -0
  48. package/dist/commands/capabilities.js +18 -0
  49. package/dist/commands/capabilities.js.map +1 -0
  50. package/dist/commands/claw.d.ts +4 -0
  51. package/dist/commands/claw.d.ts.map +1 -0
  52. package/dist/commands/claw.js +14 -0
  53. package/dist/commands/claw.js.map +1 -0
  54. package/dist/commands/commend.d.ts +4 -0
  55. package/dist/commands/commend.d.ts.map +1 -0
  56. package/dist/commands/commend.js +13 -0
  57. package/dist/commands/commend.js.map +1 -0
  58. package/dist/commands/completion.d.ts +4 -0
  59. package/dist/commands/completion.d.ts.map +1 -0
  60. package/dist/commands/completion.js +49 -0
  61. package/dist/commands/completion.js.map +1 -0
  62. package/dist/commands/config.d.ts +4 -0
  63. package/dist/commands/config.d.ts.map +1 -0
  64. package/dist/commands/config.js +78 -0
  65. package/dist/commands/config.js.map +1 -0
  66. package/dist/commands/deploy.d.ts +4 -0
  67. package/dist/commands/deploy.d.ts.map +1 -0
  68. package/dist/commands/deploy.js +10 -0
  69. package/dist/commands/deploy.js.map +1 -0
  70. package/dist/commands/doctor.d.ts +4 -0
  71. package/dist/commands/doctor.d.ts.map +1 -0
  72. package/dist/commands/doctor.js +72 -0
  73. package/dist/commands/doctor.js.map +1 -0
  74. package/dist/commands/export.d.ts +4 -0
  75. package/dist/commands/export.d.ts.map +1 -0
  76. package/dist/commands/export.js +15 -0
  77. package/dist/commands/export.js.map +1 -0
  78. package/dist/commands/fade.d.ts +4 -0
  79. package/dist/commands/fade.d.ts.map +1 -0
  80. package/dist/commands/fade.js +15 -0
  81. package/dist/commands/fade.js.map +1 -0
  82. package/dist/commands/flag.d.ts +4 -0
  83. package/dist/commands/flag.d.ts.map +1 -0
  84. package/dist/commands/flag.js +13 -0
  85. package/dist/commands/flag.js.map +1 -0
  86. package/dist/commands/forget.d.ts +4 -0
  87. package/dist/commands/forget.d.ts.map +1 -0
  88. package/dist/commands/forget.js +16 -0
  89. package/dist/commands/forget.js.map +1 -0
  90. package/dist/commands/frontier.d.ts +4 -0
  91. package/dist/commands/frontier.d.ts.map +1 -0
  92. package/dist/commands/frontier.js +11 -0
  93. package/dist/commands/frontier.js.map +1 -0
  94. package/dist/commands/health.d.ts +4 -0
  95. package/dist/commands/health.d.ts.map +1 -0
  96. package/dist/commands/health.js +11 -0
  97. package/dist/commands/health.js.map +1 -0
  98. package/dist/commands/highways.d.ts +4 -0
  99. package/dist/commands/highways.d.ts.map +1 -0
  100. package/dist/commands/highways.js +14 -0
  101. package/dist/commands/highways.js.map +1 -0
  102. package/dist/commands/hire.d.ts +4 -0
  103. package/dist/commands/hire.d.ts.map +1 -0
  104. package/dist/commands/hire.js +16 -0
  105. package/dist/commands/hire.js.map +1 -0
  106. package/dist/commands/init.d.ts.map +1 -1
  107. package/dist/commands/init.js +69 -42
  108. package/dist/commands/init.js.map +1 -1
  109. package/dist/commands/know.d.ts +4 -0
  110. package/dist/commands/know.d.ts.map +1 -0
  111. package/dist/commands/know.js +8 -0
  112. package/dist/commands/know.js.map +1 -0
  113. package/dist/commands/launch.d.ts +4 -0
  114. package/dist/commands/launch.d.ts.map +1 -0
  115. package/dist/commands/launch.js +16 -0
  116. package/dist/commands/launch.js.map +1 -0
  117. package/dist/commands/mark.d.ts +4 -0
  118. package/dist/commands/mark.d.ts.map +1 -0
  119. package/dist/commands/mark.js +15 -0
  120. package/dist/commands/mark.js.map +1 -0
  121. package/dist/commands/pay.d.ts +4 -0
  122. package/dist/commands/pay.d.ts.map +1 -0
  123. package/dist/commands/pay.js +21 -0
  124. package/dist/commands/pay.js.map +1 -0
  125. package/dist/commands/pipe.d.ts +4 -0
  126. package/dist/commands/pipe.d.ts.map +1 -0
  127. package/dist/commands/pipe.js +35 -0
  128. package/dist/commands/pipe.js.map +1 -0
  129. package/dist/commands/publish.d.ts +4 -0
  130. package/dist/commands/publish.d.ts.map +1 -0
  131. package/dist/commands/publish.js +23 -0
  132. package/dist/commands/publish.js.map +1 -0
  133. package/dist/commands/recall.d.ts +4 -0
  134. package/dist/commands/recall.d.ts.map +1 -0
  135. package/dist/commands/recall.js +12 -0
  136. package/dist/commands/recall.js.map +1 -0
  137. package/dist/commands/repl.d.ts +4 -0
  138. package/dist/commands/repl.d.ts.map +1 -0
  139. package/dist/commands/repl.js +56 -0
  140. package/dist/commands/repl.js.map +1 -0
  141. package/dist/commands/reveal.d.ts +4 -0
  142. package/dist/commands/reveal.d.ts.map +1 -0
  143. package/dist/commands/reveal.js +11 -0
  144. package/dist/commands/reveal.js.map +1 -0
  145. package/dist/commands/revenue.d.ts +4 -0
  146. package/dist/commands/revenue.d.ts.map +1 -0
  147. package/dist/commands/revenue.js +11 -0
  148. package/dist/commands/revenue.js.map +1 -0
  149. package/dist/commands/select.d.ts +4 -0
  150. package/dist/commands/select.d.ts.map +1 -0
  151. package/dist/commands/select.js +19 -0
  152. package/dist/commands/select.js.map +1 -0
  153. package/dist/commands/signal.d.ts +4 -0
  154. package/dist/commands/signal.d.ts.map +1 -0
  155. package/dist/commands/signal.js +8 -0
  156. package/dist/commands/signal.js.map +1 -0
  157. package/dist/commands/stats.d.ts +4 -0
  158. package/dist/commands/stats.d.ts.map +1 -0
  159. package/dist/commands/stats.js +11 -0
  160. package/dist/commands/stats.js.map +1 -0
  161. package/dist/commands/status.d.ts +4 -0
  162. package/dist/commands/status.d.ts.map +1 -0
  163. package/dist/commands/status.js +18 -0
  164. package/dist/commands/status.js.map +1 -0
  165. package/dist/commands/sync.d.ts +4 -0
  166. package/dist/commands/sync.d.ts.map +1 -0
  167. package/dist/commands/sync.js +20 -0
  168. package/dist/commands/sync.js.map +1 -0
  169. package/dist/commands/tail.d.ts +4 -0
  170. package/dist/commands/tail.d.ts.map +1 -0
  171. package/dist/commands/tail.js +51 -0
  172. package/dist/commands/tail.js.map +1 -0
  173. package/dist/commands/warn.d.ts +4 -0
  174. package/dist/commands/warn.d.ts.map +1 -0
  175. package/dist/commands/warn.js +15 -0
  176. package/dist/commands/warn.js.map +1 -0
  177. package/dist/create-org-profile.js +2 -2
  178. package/dist/create-user-profile.js +2 -2
  179. package/dist/index.js +135 -7
  180. package/dist/index.js.map +1 -1
  181. package/dist/lib/args.d.ts +11 -0
  182. package/dist/lib/args.d.ts.map +1 -0
  183. package/dist/lib/args.js +57 -0
  184. package/dist/lib/args.js.map +1 -0
  185. package/dist/lib/config.d.ts +12 -0
  186. package/dist/lib/config.d.ts.map +1 -0
  187. package/dist/lib/config.js +38 -0
  188. package/dist/lib/config.js.map +1 -0
  189. package/dist/lib/http.d.ts +9 -0
  190. package/dist/lib/http.d.ts.map +1 -0
  191. package/dist/lib/http.js +25 -0
  192. package/dist/lib/http.js.map +1 -0
  193. package/dist/lib/output.d.ts +5 -0
  194. package/dist/lib/output.d.ts.map +1 -0
  195. package/dist/lib/output.js +32 -0
  196. package/dist/lib/output.js.map +1 -0
  197. package/dist/lib/sdk.d.ts +10 -0
  198. package/dist/lib/sdk.d.ts.map +1 -0
  199. package/dist/lib/sdk.js +22 -0
  200. package/dist/lib/sdk.js.map +1 -0
  201. package/dist/lib/telemetry.d.ts +4 -0
  202. package/dist/lib/telemetry.d.ts.map +1 -0
  203. package/dist/lib/telemetry.js +61 -0
  204. package/dist/lib/telemetry.js.map +1 -0
  205. package/dist/utils/file-resolver.js +1 -3
  206. package/dist/utils/file-resolver.js.map +1 -1
  207. package/dist/utils/installation-setup.d.ts +15 -0
  208. package/dist/utils/installation-setup.d.ts.map +1 -1
  209. package/dist/utils/installation-setup.js +71 -8
  210. package/dist/utils/installation-setup.js.map +1 -1
  211. package/package.json +5 -21
  212. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  213. package/.claude/agents/agent-backend.md +0 -574
  214. package/.claude/agents/agent-builder.md +0 -911
  215. package/.claude/agents/agent-claude.md +0 -645
  216. package/.claude/agents/agent-clean.md +0 -477
  217. package/.claude/agents/agent-clone.md +0 -554
  218. package/.claude/agents/agent-designer.md +0 -1080
  219. package/.claude/agents/agent-director.md +0 -2254
  220. package/.claude/agents/agent-documenter.md +0 -688
  221. package/.claude/agents/agent-frontend.md +0 -1199
  222. package/.claude/agents/agent-integrator.md +0 -670
  223. package/.claude/agents/agent-lawyer.md +0 -1320
  224. package/.claude/agents/agent-news.md +0 -363
  225. package/.claude/agents/agent-onboard.md +0 -613
  226. package/.claude/agents/agent-ontology.md +0 -585
  227. package/.claude/agents/agent-ops.md +0 -1275
  228. package/.claude/agents/agent-problem-solver.md +0 -669
  229. package/.claude/agents/agent-quality.md +0 -1042
  230. package/.claude/agents/agent-sales.md +0 -507
  231. package/.claude/agents/agent-writer.md +0 -1068
  232. package/.claude/commands/cascade.md +0 -742
  233. package/.claude/commands/chat.md +0 -728
  234. package/.claude/commands/commit.md +0 -95
  235. package/.claude/commands/create.md +0 -544
  236. package/.claude/commands/deploy.md +0 -309
  237. package/.claude/commands/fast.md +0 -636
  238. package/.claude/commands/mcp-on.md +0 -191
  239. package/.claude/commands/media-upload.md +0 -186
  240. package/.claude/commands/news.md +0 -274
  241. package/.claude/commands/onboard.md +0 -440
  242. package/.claude/commands/one.md +0 -398
  243. package/.claude/commands/optimize.md +0 -74
  244. package/.claude/commands/plan.md +0 -719
  245. package/.claude/commands/push.md +0 -214
  246. package/.claude/commands/release.md +0 -105
  247. package/.claude/commands/review.md +0 -99
  248. package/.claude/commands/server.md +0 -487
  249. package/.claude/commands/start.md +0 -227
  250. package/.claude/commands/test.md +0 -197
  251. package/.claude/commands/validate.md +0 -140
  252. package/.claude/hooks/.last-news-context +0 -1
  253. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  254. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  255. package/.claude/hooks/README-news-generation.md +0 -364
  256. package/.claude/hooks/README-root-cleanup.md +0 -200
  257. package/.claude/hooks/README.md +0 -284
  258. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  259. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  260. package/.claude/hooks/auto-format.sh +0 -106
  261. package/.claude/hooks/check-filenames.py +0 -177
  262. package/.claude/hooks/clean-post.py +0 -468
  263. package/.claude/hooks/clean-pre.py +0 -393
  264. package/.claude/hooks/clean-root-markdown.sh +0 -73
  265. package/.claude/hooks/commit-push.sh +0 -95
  266. package/.claude/hooks/done.py +0 -236
  267. package/.claude/hooks/format-hook.sh +0 -163
  268. package/.claude/hooks/formatting.py +0 -187
  269. package/.claude/hooks/hook-logger.sh +0 -173
  270. package/.claude/hooks/knowledge-post.py +0 -355
  271. package/.claude/hooks/knowledge-pre.py +0 -245
  272. package/.claude/hooks/mcp-on.sh +0 -134
  273. package/.claude/hooks/notification-hook.sh +0 -279
  274. package/.claude/hooks/ontology-validation.py +0 -255
  275. package/.claude/hooks/push.sh +0 -153
  276. package/.claude/hooks/release-cli.sh +0 -205
  277. package/.claude/hooks/root-cleanup.py +0 -217
  278. package/.claude/hooks/security-hook.sh +0 -397
  279. package/.claude/hooks/tag-all-docs.py +0 -464
  280. package/.claude/hooks/test-validate-ontology.sh +0 -170
  281. package/.claude/hooks/todo.py +0 -368
  282. package/.claude/hooks/track-changes.sh +0 -101
  283. package/.claude/hooks/validate-imports.py +0 -182
  284. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  285. package/.claude/hooks/validate-ontology-structure.py +0 -558
  286. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  287. package/.claude/hooks/validate-ontology.py +0 -140
  288. package/.claude/hooks/write-news.sh +0 -194
  289. package/.claude/skills/INDEX.md +0 -523
  290. package/.claude/skills/REGISTRY.md +0 -529
  291. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  292. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  293. package/.claude/skills/agent-frontend-create-page.md +0 -413
  294. package/.claude/skills/agents/README.md +0 -238
  295. package/.claude/skills/astro/add-content-collection.md +0 -30
  296. package/.claude/skills/astro/check-build.md +0 -29
  297. package/.claude/skills/astro/create-component.md +0 -29
  298. package/.claude/skills/astro/create-page.md +0 -30
  299. package/.claude/skills/astro/optimize-performance.md +0 -21
  300. package/.claude/skills/convex/check-deployment.md +0 -46
  301. package/.claude/skills/convex/create-mutation.md +0 -405
  302. package/.claude/skills/convex/create-query.md +0 -52
  303. package/.claude/skills/convex/read-schema.md +0 -373
  304. package/.claude/skills/convex/test-function.md +0 -50
  305. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  306. package/.claude/skills/deployment/create-release.md +0 -21
  307. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  308. package/.claude/skills/deployment/deploy-convex.md +0 -30
  309. package/.claude/skills/deployment/sync-repositories.md +0 -19
  310. package/.claude/skills/design/check-accessibility.md +0 -21
  311. package/.claude/skills/design/create-component-spec.md +0 -27
  312. package/.claude/skills/design/generate-design-tokens.md +0 -24
  313. package/.claude/skills/design/generate-wireframe.md +0 -30
  314. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  315. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  316. package/.claude/skills/documentation/generate-readme.md +0 -22
  317. package/.claude/skills/documentation/update-knowledge.md +0 -20
  318. package/.claude/skills/integration/connect-external-system.md +0 -21
  319. package/.claude/skills/integration/implement-a2a.md +0 -20
  320. package/.claude/skills/integration/implement-acp.md +0 -20
  321. package/.claude/skills/integration/verify-integration.md +0 -20
  322. package/.claude/skills/ontology/README.md +0 -255
  323. package/.claude/skills/ontology/check-dimension.md +0 -307
  324. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  325. package/.claude/skills/ontology/validate-schema.md +0 -229
  326. package/.claude/skills/ontology/verify-relationships.md +0 -310
  327. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  328. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  329. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  330. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  331. package/.claude/skills/sales/generate-demo-script.md +0 -21
  332. package/.claude/skills/sales/qualify-lead.md +0 -30
  333. package/.claude/skills/sales/track-trial.md +0 -20
  334. package/.claude/skills/sales/verify-kyc.md +0 -20
  335. package/.claude/skills/testing/analyze-coverage.md +0 -24
  336. package/.claude/skills/testing/generate-tests.md +0 -24
  337. package/.claude/skills/testing/run-tests.md +0 -27
  338. package/.claude/skills/testing/validate-e2e.md +0 -25
  339. package/AGENTS.md +0 -60
  340. package/CLAUDE.md +0 -321
  341. package/CREATE-WEBSITE.md +0 -458
  342. package/SECURITY.md +0 -31
  343. package/dist/commands/create-website.d.ts +0 -19
  344. package/dist/commands/create-website.d.ts.map +0 -1
  345. package/dist/commands/create-website.js +0 -231
  346. package/dist/commands/create-website.js.map +0 -1
  347. package/folders.yaml +0 -92
  348. package/one/README.md +0 -760
  349. package/one/connections/a2a.md +0 -600
  350. package/one/connections/acp.md +0 -808
  351. package/one/connections/acps.md +0 -749
  352. package/one/connections/agentkit.md +0 -367
  353. package/one/connections/agui.md +0 -785
  354. package/one/connections/any-backend.md +0 -1720
  355. package/one/connections/ap2.md +0 -1072
  356. package/one/connections/api/queries-reference.md +0 -860
  357. package/one/connections/api-docs.md +0 -1909
  358. package/one/connections/api-reference.md +0 -1029
  359. package/one/connections/api.md +0 -2208
  360. package/one/connections/architecture-diagram.md +0 -112
  361. package/one/connections/communications.md +0 -467
  362. package/one/connections/connections.md +0 -357
  363. package/one/connections/copilotkit.md +0 -1577
  364. package/one/connections/cryptonetworks.md +0 -799
  365. package/one/connections/documentation.md +0 -1138
  366. package/one/connections/effect.md +0 -297
  367. package/one/connections/elizaos.md +0 -1308
  368. package/one/connections/groups.md +0 -814
  369. package/one/connections/inference.md +0 -76
  370. package/one/connections/integration-examples.md +0 -893
  371. package/one/connections/integration-guide.md +0 -887
  372. package/one/connections/integration-phase2.md +0 -754
  373. package/one/connections/kyc.md +0 -650
  374. package/one/connections/mcp.md +0 -860
  375. package/one/connections/membership.md +0 -1170
  376. package/one/connections/middleware.md +0 -1085
  377. package/one/connections/multitenant.md +0 -1359
  378. package/one/connections/n8n.md +0 -1033
  379. package/one/connections/patterns.md +0 -107
  380. package/one/connections/protocols.md +0 -297
  381. package/one/connections/relationships.md +0 -125
  382. package/one/connections/schema.md +0 -605
  383. package/one/connections/service-layer.md +0 -568
  384. package/one/connections/vectors.md +0 -225
  385. package/one/connections/wordpress.md +0 -1320
  386. package/one/connections/workflow-copy.md +0 -923
  387. package/one/connections/workflow-examples.md +0 -759
  388. package/one/connections/workflow-onboarding.md +0 -701
  389. package/one/connections/workflow.md +0 -923
  390. package/one/connections/workflows/delegation.md +0 -903
  391. package/one/connections/workflows/frontend.md +0 -1055
  392. package/one/connections/workflows/strategy.md +0 -921
  393. package/one/connections/workflows/tasks.md +0 -716
  394. package/one/connections/x402-baazar.md +0 -131
  395. package/one/connections/x402.md +0 -1353
  396. package/one/groups/features.md +0 -2904
  397. package/one/groups/groups.md +0 -587
  398. package/one/groups/one.md +0 -619
  399. package/one/groups/strategy-copy.md +0 -887
  400. package/one/knowledge/.obsidian/app.json +0 -1
  401. package/one/knowledge/.obsidian/appearance.json +0 -1
  402. package/one/knowledge/.obsidian/core-plugins.json +0 -33
  403. package/one/knowledge/.obsidian/ecommerce-ontology.md +0 -210
  404. package/one/knowledge/.obsidian/workspace.json +0 -211
  405. package/one/knowledge/100-inference-quick-reference.md +0 -449
  406. package/one/knowledge/ag-ui-protocol.md +0 -613
  407. package/one/knowledge/agent-onboard-usage.md +0 -630
  408. package/one/knowledge/agentic-commerce.md +0 -146
  409. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +0 -683
  410. package/one/knowledge/ai-api-reference.md +0 -715
  411. package/one/knowledge/ai-platform.md +0 -323
  412. package/one/knowledge/ai-quickstart.md +0 -355
  413. package/one/knowledge/ai-sdk-implementation.md +0 -436
  414. package/one/knowledge/ai-token-crypto-analysis-framework.md +0 -1191
  415. package/one/knowledge/ai-token-paradigm-shift-2025.md +0 -732
  416. package/one/knowledge/altcoin-cycle-prediction-ontology.md +0 -884
  417. package/one/knowledge/altcoin-cycle-trading-strategy.md +0 -642
  418. package/one/knowledge/architecture-any-backend.md +0 -1589
  419. package/one/knowledge/architecture-diagram.md +0 -404
  420. package/one/knowledge/architecture-frontend.md +0 -1014
  421. package/one/knowledge/architecture.md +0 -1742
  422. package/one/knowledge/archived/ontology.old.md +0 -2840
  423. package/one/knowledge/astro-effect-complete-vision.md +0 -2148
  424. package/one/knowledge/astro-effect-simple-architecture.md +0 -750
  425. package/one/knowledge/audit-agent-onboard-alignment.md +0 -481
  426. package/one/knowledge/audit-agent-sales-alignment.md +0 -444
  427. package/one/knowledge/backend-api-reference.md +0 -728
  428. package/one/knowledge/cascading-context-specification.md +0 -1617
  429. package/one/knowledge/claude-code-integration.md +0 -1293
  430. package/one/knowledge/cli-claude-handoff.md +0 -736
  431. package/one/knowledge/context-engineering.md +0 -610
  432. package/one/knowledge/crypto-analysis-strategy.md +0 -1276
  433. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +0 -44
  434. package/one/knowledge/crypto.md +0 -978
  435. package/one/knowledge/develop/design.md +0 -364
  436. package/one/knowledge/develop/index.md +0 -145
  437. package/one/knowledge/development-commands.md +0 -251
  438. package/one/knowledge/docs.md +0 -627
  439. package/one/knowledge/dsl.md +0 -1678
  440. package/one/knowledge/event-driven-documentation.md +0 -270
  441. package/one/knowledge/files.md +0 -2489
  442. package/one/knowledge/frontend.md +0 -1056
  443. package/one/knowledge/games-english.md +0 -691
  444. package/one/knowledge/games.md +0 -1082
  445. package/one/knowledge/generative-ui-patterns.md +0 -559
  446. package/one/knowledge/guidelines.md +0 -314
  447. package/one/knowledge/hono.md +0 -2127
  448. package/one/knowledge/implementation-examples.md +0 -2554
  449. package/one/knowledge/installation-folders.md +0 -366
  450. package/one/knowledge/institutional-cycle-paradigm-2025.md +0 -555
  451. package/one/knowledge/knowledge.md +0 -660
  452. package/one/knowledge/language.md +0 -998
  453. package/one/knowledge/lessons-learned.md +0 -378
  454. package/one/knowledge/lessons-website-building-focus.md +0 -382
  455. package/one/knowledge/merge-report.md +0 -254
  456. package/one/knowledge/metadata-system.md +0 -504
  457. package/one/knowledge/nine-padel-playbook.md +0 -229
  458. package/one/knowledge/one-protocol-ai-agents.md +0 -892
  459. package/one/knowledge/one-protocol-executive-report.md +0 -617
  460. package/one/knowledge/one-protocol-standard.md +0 -869
  461. package/one/knowledge/one-protocol-whitepaper.md +0 -756
  462. package/one/knowledge/ontology-blog.yaml +0 -47
  463. package/one/knowledge/ontology-cheatsheet.md +0 -617
  464. package/one/knowledge/ontology-community.yaml +0 -65
  465. package/one/knowledge/ontology-core-universal.md +0 -740
  466. package/one/knowledge/ontology-core.yaml +0 -63
  467. package/one/knowledge/ontology-courses.yaml +0 -76
  468. package/one/knowledge/ontology-creator.md +0 -402
  469. package/one/knowledge/ontology-crypto.md +0 -1603
  470. package/one/knowledge/ontology-developer-guide.md +0 -814
  471. package/one/knowledge/ontology-documentation.md +0 -377
  472. package/one/knowledge/ontology-ecommerce.md +0 -269
  473. package/one/knowledge/ontology-education-game.md +0 -1654
  474. package/one/knowledge/ontology-education.md +0 -938
  475. package/one/knowledge/ontology-engineering-specification.md +0 -1310
  476. package/one/knowledge/ontology-engineering.md +0 -1676
  477. package/one/knowledge/ontology-files.yaml +0 -525
  478. package/one/knowledge/ontology-frontend-master.md +0 -2898
  479. package/one/knowledge/ontology-frontend-specifications.md +0 -2196
  480. package/one/knowledge/ontology-frontend.md +0 -2475
  481. package/one/knowledge/ontology-index.md +0 -397
  482. package/one/knowledge/ontology-minimal.yaml +0 -301
  483. package/one/knowledge/ontology-portfolio.yaml +0 -45
  484. package/one/knowledge/ontology-quickstart.md +0 -602
  485. package/one/knowledge/ontology-release.md +0 -317
  486. package/one/knowledge/ontology-shop.yaml +0 -148
  487. package/one/knowledge/ontology-tokens.yaml +0 -51
  488. package/one/knowledge/ontology-tutorial.md +0 -455
  489. package/one/knowledge/ontology-v2.md +0 -4449
  490. package/one/knowledge/ontology-video-script.md +0 -939
  491. package/one/knowledge/ontology-visual-guide.md +0 -378
  492. package/one/knowledge/ontology.md +0 -3847
  493. package/one/knowledge/ontology.yaml +0 -1653
  494. package/one/knowledge/parallel-agents.md +0 -932
  495. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +0 -130
  496. package/one/knowledge/patterns/backend/convex-query-pattern.md +0 -143
  497. package/one/knowledge/patterns/backend/mutation-template.md +0 -249
  498. package/one/knowledge/patterns/backend/query-template.md +0 -286
  499. package/one/knowledge/patterns/backend/service-template.md +0 -258
  500. package/one/knowledge/patterns/design/component-architecture.md +0 -435
  501. package/one/knowledge/patterns/design/index.md +0 -160
  502. package/one/knowledge/patterns/design/test-driven-design-pattern.md +0 -196
  503. package/one/knowledge/patterns/design/wireframe-template.md +0 -250
  504. package/one/knowledge/patterns/frontend/component-template.md +0 -246
  505. package/one/knowledge/patterns/frontend/form-template.md +0 -348
  506. package/one/knowledge/patterns/frontend/page-template.md +0 -209
  507. package/one/knowledge/patterns/frontend/react-component-pattern.md +0 -188
  508. package/one/knowledge/patterns/test/acceptance-criteria-template.md +0 -396
  509. package/one/knowledge/patterns/test/technical-test-template.md +0 -566
  510. package/one/knowledge/patterns/test/test-driven-pattern.md +0 -160
  511. package/one/knowledge/patterns/test/user-flow-template.md +0 -272
  512. package/one/knowledge/performance.md +0 -459
  513. package/one/knowledge/provider-agnostic-content.md +0 -995
  514. package/one/knowledge/provider-creation-guide.md +0 -1082
  515. package/one/knowledge/quality-loop.md +0 -419
  516. package/one/knowledge/quick-start-ontology-mapping.md +0 -773
  517. package/one/knowledge/readme-architecture.md +0 -158
  518. package/one/knowledge/readme.md +0 -149
  519. package/one/knowledge/rules.md +0 -644
  520. package/one/knowledge/score.md +0 -85
  521. package/one/knowledge/specifications.md +0 -873
  522. package/one/knowledge/tags.md +0 -148
  523. package/one/knowledge/todo-template.md +0 -269
  524. package/one/knowledge/todo.md +0 -269
  525. package/one/knowledge/troubleshooting.md +0 -434
  526. package/one/knowledge/typescript-patterns.md +0 -321
  527. package/one/knowledge/universal-generation-language.md +0 -827
  528. package/one/knowledge/x402-research.md +0 -104
  529. package/one/license.md +0 -107
  530. package/one/people/anthony-o-connell.md +0 -469
  531. package/one/people/people.md +0 -590
  532. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  533. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  534. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  535. package/one/things/CHECKLIST.md +0 -407
  536. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  537. package/one/things/ONE.md +0 -529
  538. package/one/things/agents/agent-backend.md +0 -1501
  539. package/one/things/agents/agent-builder.md +0 -1064
  540. package/one/things/agents/agent-clean.md +0 -1112
  541. package/one/things/agents/agent-clone.md +0 -1324
  542. package/one/things/agents/agent-deploy.md +0 -986
  543. package/one/things/agents/agent-designer.md +0 -2305
  544. package/one/things/agents/agent-director.md +0 -1526
  545. package/one/things/agents/agent-documenter.md +0 -1129
  546. package/one/things/agents/agent-frontend.md +0 -1201
  547. package/one/things/agents/agent-integrator.md +0 -1269
  548. package/one/things/agents/agent-lawyer.md +0 -1371
  549. package/one/things/agents/agent-problem-solver.md +0 -1457
  550. package/one/things/agents/agent-quality.md +0 -1483
  551. package/one/things/agents/agent-sales.md +0 -1074
  552. package/one/things/cascade/cascade.yaml +0 -481
  553. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  554. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  555. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  556. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  557. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  558. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  559. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  560. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  561. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  562. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  563. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  564. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  565. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  566. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  567. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  568. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  569. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  570. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  571. package/one/things/cascade/docs/examples/readme.md +0 -259
  572. package/one/things/cascade/docs/getting-started.md +0 -533
  573. package/one/things/cascade/docs/workflow.md +0 -1378
  574. package/one/things/cascade/readme.md +0 -379
  575. package/one/things/cascade/templates/feature-template.md +0 -289
  576. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  577. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  578. package/one/things/claude/agents/analyst.md +0 -508
  579. package/one/things/claude/agents/architect.md +0 -505
  580. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  581. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  582. package/one/things/claude/agents/builder-repo.md +0 -532
  583. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  584. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  585. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  586. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  587. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  588. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  589. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  590. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  591. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  592. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  593. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  594. package/one/things/claude/agents/content-formatter.md +0 -571
  595. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  596. package/one/things/claude/agents/content-image-formatter.md +0 -560
  597. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  598. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  599. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  600. package/one/things/claude/agents/content-team-manager.md +0 -647
  601. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  602. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  603. package/one/things/claude/agents/core-manager.md +0 -607
  604. package/one/things/claude/agents/core-master.md +0 -426
  605. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  606. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  607. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  608. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  609. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  610. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  611. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  612. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  613. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  614. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  615. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  616. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  617. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  618. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  619. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  620. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  621. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  622. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  623. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  624. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  625. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  626. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  627. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  628. package/one/things/claude/agents/customer-success-manager.md +0 -574
  629. package/one/things/claude/agents/dev.md +0 -406
  630. package/one/things/claude/agents/documenter.md +0 -548
  631. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  632. package/one/things/claude/agents/engagement-specialist.md +0 -502
  633. package/one/things/claude/agents/engineering-architect.md +0 -387
  634. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  635. package/one/things/claude/agents/engineering-developer.md +0 -386
  636. package/one/things/claude/agents/engineering-director.md +0 -322
  637. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  638. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  639. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  640. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  641. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  642. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  643. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  644. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  645. package/one/things/claude/agents/improver.md +0 -805
  646. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  647. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  648. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  649. package/one/things/claude/agents/market-research-analyst.md +0 -435
  650. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  651. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  652. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  653. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  654. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  655. package/one/things/claude/agents/marketing-director.md +0 -402
  656. package/one/things/claude/agents/marketing-engagement.md +0 -331
  657. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  658. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  659. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  660. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  661. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  662. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  663. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  664. package/one/things/claude/agents/mission-commander.md +0 -378
  665. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  666. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  667. package/one/things/claude/agents/npx.md +0 -946
  668. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  669. package/one/things/claude/agents/one-master.md +0 -378
  670. package/one/things/claude/agents/one-orchestrator.md +0 -345
  671. package/one/things/claude/agents/one.md +0 -658
  672. package/one/things/claude/agents/playbook-generator.md +0 -526
  673. package/one/things/claude/agents/pm.md +0 -349
  674. package/one/things/claude/agents/po.md +0 -370
  675. package/one/things/claude/agents/qa.md +0 -361
  676. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  677. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  678. package/one/things/claude/agents/research-market-analyst.md +0 -324
  679. package/one/things/claude/agents/research-team-manager.md +0 -489
  680. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  681. package/one/things/claude/agents/sales-team-manager.md +0 -407
  682. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  683. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  684. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  685. package/one/things/claude/agents/service-success-manager.md +0 -324
  686. package/one/things/claude/agents/service-team-manager.md +0 -405
  687. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  688. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  689. package/one/things/claude/agents/sm.md +0 -352
  690. package/one/things/claude/agents/story-teller.md +0 -498
  691. package/one/things/claude/agents/task-master.md +0 -621
  692. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  693. package/one/things/claude/agents/tester.md +0 -595
  694. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  695. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  696. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  697. package/one/things/claude/agents/upsell-strategist.md +0 -503
  698. package/one/things/claude/agents/ux-expert.md +0 -360
  699. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  700. package/one/things/claude/claude-code-hooks-development.json +0 -21
  701. package/one/things/claude/claude-code-hooks-production.json +0 -21
  702. package/one/things/claude/claude-code-hooks.json +0 -25
  703. package/one/things/claude/commands/agent.md +0 -124
  704. package/one/things/claude/commands/cascade-status.md +0 -153
  705. package/one/things/claude/commands/ingest.md +0 -343
  706. package/one/things/claude/commands/ingestor.md +0 -158
  707. package/one/things/claude/commands/mission.md +0 -103
  708. package/one/things/claude/commands/npx.md +0 -156
  709. package/one/things/claude/commands/one.md +0 -486
  710. package/one/things/claude/commands/quality-check.md +0 -252
  711. package/one/things/claude/commands/smart-route.md +0 -261
  712. package/one/things/claude/commands/start.md +0 -139
  713. package/one/things/claude/commands/story.md +0 -103
  714. package/one/things/claude/commands/task.md +0 -193
  715. package/one/things/claude/hook-bypass.json +0 -32
  716. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  717. package/one/things/claude/hooks/build-hook.sh +0 -156
  718. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  719. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  720. package/one/things/claude/hooks/format-hook.sh +0 -43
  721. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  722. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  723. package/one/things/claude/hooks/hook-logger.sh +0 -89
  724. package/one/things/claude/hooks/lint-hook.sh +0 -140
  725. package/one/things/claude/hooks/notification-hook.sh +0 -204
  726. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  727. package/one/things/claude/hooks/performance-metrics.json +0 -25
  728. package/one/things/claude/hooks/security-hook.sh +0 -256
  729. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  730. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  731. package/one/things/claude/hooks/test-hook.sh +0 -145
  732. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  733. package/one/things/claude/settings-local.json +0 -86
  734. package/one/things/cli/cli-code.md +0 -677
  735. package/one/things/cli/cli-compiler-code.md +0 -677
  736. package/one/things/cli/cli.md +0 -871
  737. package/one/things/components/card-shadcn.md +0 -953
  738. package/one/things/components/card.md +0 -1041
  739. package/one/things/components.md +0 -1743
  740. package/one/things/componets.md +0 -19
  741. package/one/things/contracts/Move.toml +0 -12
  742. package/one/things/contracts/README.md +0 -288
  743. package/one/things/contracts/one.move +0 -762
  744. package/one/things/contracts/sdk.ts +0 -578
  745. package/one/things/creator-diagram.md +0 -184
  746. package/one/things/crypto/FEATURES.md +0 -78
  747. package/one/things/crypto/ONECORE.md +0 -62
  748. package/one/things/crypto/ONECOREFAQ.md +0 -22
  749. package/one/things/crypto/ONECOREHOW.md +0 -46
  750. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  751. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  752. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  753. package/one/things/crypto/ONEPRO.md +0 -60
  754. package/one/things/crypto/ONEPROFAQ.md +0 -22
  755. package/one/things/crypto/ONEPROHOW.md +0 -53
  756. package/one/things/crypto/READMEAGENCY.md +0 -64
  757. package/one/things/crypto/VSL.md +0 -45
  758. package/one/things/crypto/WebsiteCopy.md +0 -176
  759. package/one/things/demo-accessibility-animations.md +0 -1025
  760. package/one/things/demo-components.md +0 -1310
  761. package/one/things/demo-design-summary.md +0 -692
  762. package/one/things/demo-design-system.md +0 -973
  763. package/one/things/demo-page-layouts.md +0 -1016
  764. package/one/things/design-system.md +0 -832
  765. package/one/things/designs/accessibility-audit.md +0 -877
  766. package/one/things/designs/component-specifications.md +0 -855
  767. package/one/things/designs/design-overview.md +0 -377
  768. package/one/things/designs/design-tokens.md +0 -448
  769. package/one/things/designs/wireframes-dashboard.md +0 -710
  770. package/one/things/docs/api-requests.md +0 -987
  771. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  772. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  773. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  774. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  775. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  776. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  777. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  778. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  779. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  780. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  781. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  782. package/one/things/docs/ecommerce/demo.astro +0 -309
  783. package/one/things/examples/children/lemonade-stand.md +0 -404
  784. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  785. package/one/things/features/1-1-agent-prompts.md +0 -562
  786. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  787. package/one/things/features/1-3-event-coordination.md +0 -547
  788. package/one/things/features/1-4-knowledge-management.md +0 -652
  789. package/one/things/features/1-5-quality-loops.md +0 -725
  790. package/one/things/features/1-6-numbering-structure.md +0 -639
  791. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  792. package/one/things/features/2-2-config-system.md +0 -3242
  793. package/one/things/features/2-3-effectts-services.md +0 -1645
  794. package/one/things/features/2-4-react-hooks.md +0 -2136
  795. package/one/things/features/2-5-auth-migration.md +0 -2144
  796. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  797. package/one/things/features/2-7-alternative-providers.md +0 -2578
  798. package/one/things/features/2-7-implementation-report.md +0 -724
  799. package/one/things/features/2-cli.md +0 -1720
  800. package/one/things/features/2-design.md +0 -1770
  801. package/one/things/features/2-tests.md +0 -576
  802. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  803. package/one/things/features/DECOUPLING.md +0 -290
  804. package/one/things/features/DEPLOYMENT.md +0 -470
  805. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  806. package/one/things/features/improve.md +0 -861
  807. package/one/things/features/remove-convex-deps.md +0 -63
  808. package/one/things/features/top-features.md +0 -87
  809. package/one/things/features/use-one-backend.md +0 -1217
  810. package/one/things/features-in-english.md +0 -200
  811. package/one/things/files.yaml +0 -721
  812. package/one/things/ideas/1-create-workflow.md +0 -207
  813. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  814. package/one/things/implementation/backend-guide.md +0 -457
  815. package/one/things/interface.md +0 -257
  816. package/one/things/landing-page-implementation.md +0 -455
  817. package/one/things/legal/README.md +0 -234
  818. package/one/things/legal/privacy-policy.md +0 -1227
  819. package/one/things/legal/terms-of-service.md +0 -1432
  820. package/one/things/master-workflow-plan.md +0 -806
  821. package/one/things/pay.one.ie.md +0 -53
  822. package/one/things/plans/0-in-sync.md +0 -136
  823. package/one/things/plans/0-timeline.md +0 -36
  824. package/one/things/plans/1-create-workflow.md +0 -732
  825. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  826. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  827. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  828. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  829. package/one/things/plans/ai-elements-integration.md +0 -483
  830. package/one/things/plans/ai-elements.md +0 -1278
  831. package/one/things/plans/ai-integration-plan.md +0 -263
  832. package/one/things/plans/ai-integration.md +0 -996
  833. package/one/things/plans/ai-sdk.md +0 -798
  834. package/one/things/plans/ai-tools.md +0 -621
  835. package/one/things/plans/app.md +0 -832
  836. package/one/things/plans/architecture-summary.md +0 -312
  837. package/one/things/plans/async-ai-agents.md +0 -233
  838. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  839. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  840. package/one/things/plans/backend-ontology-conformance.md +0 -475
  841. package/one/things/plans/backend-status.md +0 -599
  842. package/one/things/plans/backend-structure.md +0 -847
  843. package/one/things/plans/backend-target-structure.md +0 -482
  844. package/one/things/plans/backend.md +0 -1175
  845. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  846. package/one/things/plans/better-auth-any-backend.md +0 -1896
  847. package/one/things/plans/better-auth-available-features.md +0 -273
  848. package/one/things/plans/big-plan.md +0 -52
  849. package/one/things/plans/cli-updates-required.md +0 -320
  850. package/one/things/plans/complete-step-by-step.md +0 -1409
  851. package/one/things/plans/components.md +0 -709
  852. package/one/things/plans/convex-agents.md +0 -1034
  853. package/one/things/plans/convex-better-auth.md +0 -1141
  854. package/one/things/plans/convex-on-off.md +0 -407
  855. package/one/things/plans/crypto-token-researcher.md +0 -629
  856. package/one/things/plans/data-quality-metrics.md +0 -745
  857. package/one/things/plans/deep-researcher-agent.md +0 -466
  858. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  859. package/one/things/plans/deployment-architecture.md +0 -469
  860. package/one/things/plans/desktop.md +0 -1139
  861. package/one/things/plans/development-plan.md +0 -1283
  862. package/one/things/plans/development-workflow-tldr.md +0 -207
  863. package/one/things/plans/development-workflow.md +0 -959
  864. package/one/things/plans/dsl-claude-code.md +0 -1011
  865. package/one/things/plans/effect-components.md +0 -1743
  866. package/one/things/plans/effect-patterns-reference.md +0 -2235
  867. package/one/things/plans/effect.md +0 -1806
  868. package/one/things/plans/email.md +0 -966
  869. package/one/things/plans/enhance-auth.md +0 -1692
  870. package/one/things/plans/execution-strategy.md +0 -1291
  871. package/one/things/plans/existing-infrastructure.md +0 -712
  872. package/one/things/plans/feature-based-sites.md +0 -894
  873. package/one/things/plans/frontend-effects.md +0 -1276
  874. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  875. package/one/things/plans/improve-codebase.md +0 -1811
  876. package/one/things/plans/install-components.md +0 -215
  877. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  878. package/one/things/plans/landing.md +0 -820
  879. package/one/things/plans/layout.md +0 -249
  880. package/one/things/plans/mail-backend.md +0 -1361
  881. package/one/things/plans/mail.md +0 -2677
  882. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  883. package/one/things/plans/mcp-simple.md +0 -248
  884. package/one/things/plans/multi-ontology-architecture.md +0 -885
  885. package/one/things/plans/next-features.md +0 -114
  886. package/one/things/plans/npx-agent-safety.md +0 -785
  887. package/one/things/plans/npx-agent.md +0 -1089
  888. package/one/things/plans/onboarding.md +0 -51
  889. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  890. package/one/things/plans/one.md +0 -677
  891. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  892. package/one/things/plans/ontology-compliance-audit.md +0 -342
  893. package/one/things/plans/ontology-driven-strategy.md +0 -882
  894. package/one/things/plans/ontology-refine.md +0 -586
  895. package/one/things/plans/ontology-ui-approach.md +0 -375
  896. package/one/things/plans/open-agent.md +0 -840
  897. package/one/things/plans/performace.md +0 -122
  898. package/one/things/plans/phase-1-foundation.md +0 -620
  899. package/one/things/plans/phase-3-implementation.md +0 -1037
  900. package/one/things/plans/plan-connect-to-api.md +0 -146
  901. package/one/things/plans/quick-wins.md +0 -1428
  902. package/one/things/plans/r2.md +0 -777
  903. package/one/things/plans/readme-backend-cleanup.md +0 -402
  904. package/one/things/plans/release.md +0 -507
  905. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  906. package/one/things/plans/repos.md +0 -98
  907. package/one/things/plans/separate-copy-2.md +0 -1349
  908. package/one/things/plans/separate-copy-3.md +0 -2479
  909. package/one/things/plans/separate-copy.md +0 -1349
  910. package/one/things/plans/separate-demo.md +0 -864
  911. package/one/things/plans/separate.md +0 -1999
  912. package/one/things/plans/sequence.md +0 -2040
  913. package/one/things/plans/shadcn-integration-summary.md +0 -510
  914. package/one/things/plans/sidebar.md +0 -206
  915. package/one/things/plans/skills.md +0 -709
  916. package/one/things/plans/small-fixes.md +0 -23
  917. package/one/things/plans/start-new.md +0 -764
  918. package/one/things/plans/switch-off-auth.md +0 -42
  919. package/one/things/plans/sync-checklist.md +0 -351
  920. package/one/things/plans/test-backend-connection.md +0 -514
  921. package/one/things/plans/unified-implementation-plan.md +0 -934
  922. package/one/things/plans/update-demos.md +0 -581
  923. package/one/things/plans/use-our-backend.md +0 -572
  924. package/one/things/plans/video-backend.md +0 -638
  925. package/one/things/plans/video-frontend.md +0 -490
  926. package/one/things/plans/video-old-archived.md +0 -656
  927. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  928. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  929. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  930. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  931. package/one/things/plans/workflow-files.md +0 -1210
  932. package/one/things/plans/workflow.md +0 -1378
  933. package/one/things/plans-u.md +0 -905
  934. package/one/things/products/Blockchain Products.md +0 -6278
  935. package/one/things/products/cascade-landing-page.md +0 -841
  936. package/one/things/products/cascade.md +0 -1568
  937. package/one/things/products/context-engineering.md +0 -1488
  938. package/one/things/products/onthology.md +0 -15
  939. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  940. package/one/things/products/ontology-ui.md +0 -1429
  941. package/one/things/products/ontology.md +0 -789
  942. package/one/things/products/sdk.md +0 -573
  943. package/one/things/promptkit.md +0 -930
  944. package/one/things/repos/all-repos.md +0 -0
  945. package/one/things/scripts-clean-mac.sh +0 -409
  946. package/one/things/service-providers-new.md +0 -1052
  947. package/one/things/service-providers.md +0 -1121
  948. package/one/things/structure.md +0 -532
  949. package/one/things/system.md +0 -618
  950. package/one/things/templates.md +0 -294
  951. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  952. package/one/things/tests/2-1-test-analysis.md +0 -544
  953. package/one/things/things.md +0 -384
  954. package/one/things/todo-acp-integration.md +0 -744
  955. package/one/things/todo-ai.md +0 -933
  956. package/one/things/todo-api.md +0 -1078
  957. package/one/things/todo-assignment.md +0 -580
  958. package/one/things/todo-buy-chatgpt.md +0 -1450
  959. package/one/things/todo-components.md +0 -1683
  960. package/one/things/todo-connections.md +0 -278
  961. package/one/things/todo-ecommerce-frontend.md +0 -1313
  962. package/one/things/todo-ecommerce.md +0 -569
  963. package/one/things/todo-effects.md +0 -1075
  964. package/one/things/todo-frontend-effects.md +0 -977
  965. package/one/things/todo-landing-page.md +0 -1091
  966. package/one/things/todo-mail.md +0 -1160
  967. package/one/things/todo-master-plan.md +0 -490
  968. package/one/things/todo-onboard.md +0 -666
  969. package/one/things/todo-one-ie.md +0 -538
  970. package/one/things/todo-page.md +0 -606
  971. package/one/things/todo-plans.md +0 -282
  972. package/one/things/todo-projects.md +0 -241
  973. package/one/things/todo-refactoring-plan.md +0 -366
  974. package/one/things/todo-release.md +0 -654
  975. package/one/things/todo-sequence.md +0 -1621
  976. package/one/things/todo-use-our-backend.md +0 -1908
  977. package/one/things/todo-workflow.md +0 -626
  978. package/one/things/todo-x402.md +0 -2047
  979. package/one/things/todo.md +0 -21
  980. package/one/things/video/scripts-crypto.md +0 -835
  981. package/one/things/video-script-backup.md +0 -318
  982. package/one/things/video-script-demo.md +0 -382
  983. package/one/things/video-script-ontology.md +0 -333
  984. package/one/things/video-script.md +0 -361
@@ -1,2127 +0,0 @@
1
- ---
2
- title: Hono
3
- dimension: knowledge
4
- category: hono.md
5
- tags: architecture, backend
6
- related_dimensions: events, groups, people
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 hono.md category.
13
- Location: one/knowledge/hono.md
14
- Purpose: Documents hono.md - api backend architecture
15
- Related dimensions: events, groups, people
16
- For AI agents: Read this to understand hono.
17
- ---
18
-
19
- # Hono.md - API Backend Architecture
20
-
21
- ## Overview
22
-
23
- **Hono** is a lightweight, ultrafast web framework that can be used with Convex in two ways:
24
-
25
- 1. **Convex-Native** (Recommended): Hono runs inside Convex as HTTP actions (`convex/http.ts`)
26
- 2. **Separate API**: Hono runs on Cloudflare Workers, calls Convex via `ConvexHttpClient`
27
-
28
- This document covers **both approaches** with complete implementation guides.
29
-
30
- ### Quick Comparison
31
-
32
- | Feature | Convex-Native | Separate API |
33
- |---------|---------------|--------------|
34
- | **Deployment** | Single (Convex only) | Two (Workers + Convex) |
35
- | **Access to Convex** | `c.env.runQuery/Mutation` | `ConvexHttpClient` (HTTP) |
36
- | **Infrastructure** | Minimal | More complex |
37
- | **Multi-Tenancy** | Limited | Full support |
38
- | **Team Separation** | Harder | Easier |
39
- | **API Reusability** | Limited | High (web/mobile/desktop) |
40
- | **Official Pattern** | ✅ Yes ([Convex Stack](https://stack.convex.dev/hono-with-convex)) | Custom |
41
- | **Best For** | Single-tenant apps | Multi-tenant platforms |
42
-
43
- **Key Principle:** Use **Convex for ALL data storage** (including auth), not external databases.
44
-
45
- **Official Documentation:**
46
- - [Hono with Convex (Convex Stack)](https://stack.convex.dev/hono-with-convex) - Official pattern
47
- - [Hono Documentation](https://hono.dev/) - Hono framework docs
48
- - [convex-helpers](https://stack.convex.dev/convex-helpers) - Helper utilities
49
-
50
- ## Architecture Vision
51
-
52
- ```
53
- ┌─────────────────────────────────────────────────────────┐
54
- │ ASTRO FRONTEND │
55
- │ ┌──────────────────────────────────────────────────┐ │
56
- │ │ Pages, Components, UI (User Customizable) │ │
57
- │ │ - Vibe code with Convex hooks │ │
58
- │ │ - shadcn/ui components │ │
59
- │ │ - Tailwind styling │ │
60
- │ └────────────────┬─────────────────────────────────┘ │
61
- └───────────────────┼─────────────────────────────────────┘
62
- │ HTTP API Calls
63
- ▼
64
- ┌─────────────────────────────────────────────────────────┐
65
- │ HONO API BACKEND │
66
- │ ┌──────────────────────────────────────────────────┐ │
67
- │ │ Routes (Hono) │ │
68
- │ │ /api/auth/* - Better Auth endpoints │ │
69
- │ │ /api/tokens/* - Token economy endpoints │ │
70
- │ │ /api/agents/* - Agent management │ │
71
- │ │ /api/content/*- Content creation │ │
72
- │ └────────────────┬─────────────────────────────────┘ │
73
- │ │ │
74
- │ ┌────────────────┴─────────────────────────────────┐ │
75
- │ │ Business Logic (Effect.ts Services) │ │
76
- │ │ - TokenService, AgentService, etc. │ │
77
- │ │ - Pure functional logic │ │
78
- │ │ - Type-safe error handling │ │
79
- │ └────────────────┬─────────────────────────────────┘ │
80
- │ │ │
81
- │ ┌────────────────┴─────────────────────────────────┐ │
82
- │ │ Data Layer (ConvexHttpClient) │ │
83
- │ │ - Queries/mutations via HTTP │ │
84
- │ │ - Better Auth → Convex adapter │ │
85
- │ └────────────────┬─────────────────────────────────┘ │
86
- └───────────────────┼─────────────────────────────────────┘
87
- │
88
- ▼
89
- ┌─────────────────────────────────────────────────────────┐
90
- │ CONVEX BACKEND │
91
- │ - 6-dimension ontology (organizations, people, things, connections, events, knowledge)│
92
- │ - Auth data stored as entities │
93
- │ - Real-time subscriptions │
94
- │ - Typed functions │
95
- └─────────────────────────────────────────────────────────┘
96
- ```
97
-
98
- ## Technology Stack
99
-
100
- **Frontend:**
101
- - Astro 5.14+ (SSR pages)
102
- - React 19 (interactive components)
103
- - shadcn/ui (UI components)
104
- - Tailwind CSS v4 (styling)
105
- - Effect.ts (client-side error handling)
106
-
107
- **API Backend:**
108
- - Hono (routing on Cloudflare Workers)
109
- - Better Auth (authentication with Convex adapter)
110
- - Effect.ts (100% business logic coverage - see [effect.md](../connections/effect.md))
111
- - ConvexHttpClient (data access via Effect.ts wrapper)
112
-
113
- **Data Backend:**
114
- - Convex (real-time database)
115
- - 6-dimension ontology (things, connections, events, knowledge, people, protocols)
116
-
117
- **Deployment:**
118
- - Cloudflare Pages (Astro frontend)
119
- - Cloudflare Workers (Hono API)
120
- - Convex Cloud (database)
121
-
122
- **Key Principle:** Effect.ts is used throughout the entire pipeline (frontend → API → services → data) for consistent error handling, composability, and testability. See **[effect.md](../connections/effect.md)** for complete Effect.ts coverage patterns.
123
-
124
- ## Two Deployment Approaches
125
-
126
- There are **two ways** to use Hono with Convex, each with different trade-offs:
127
-
128
- ### Approach 1: Convex-Native (Recommended for Most Apps)
129
-
130
- **Pattern:** Hono runs inside Convex as HTTP actions (`convex/http.ts`)
131
-
132
- **Pros:**
133
- - ✅ Single deployment (Convex only)
134
- - ✅ Direct access to Convex functions via `c.env.runQuery/runMutation`
135
- - ✅ No separate API infrastructure needed
136
- - ✅ Simpler authentication (uses Convex auth directly)
137
- - ✅ Official Convex pattern (see [stack.convex.dev/hono-with-convex](https://stack.convex.dev/hono-with-convex))
138
-
139
- **Cons:**
140
- - ❌ Less flexible for multi-tenancy
141
- - ❌ Harder to separate concerns for large teams
142
- - ❌ Couples API lifecycle to Convex
143
-
144
- **Best For:**
145
- - Single-tenant applications
146
- - Simpler architectures
147
- - Teams that want to minimize infrastructure
148
-
149
- **Documentation:** See "Convex-Native Implementation" section below.
150
-
151
- ### Approach 2: Separate API (Cloudflare Workers)
152
-
153
- **Pattern:** Hono runs on Cloudflare Workers, calls Convex via `ConvexHttpClient`
154
-
155
- **Pros:**
156
- - ✅ Complete separation of frontend and backend
157
- - ✅ Multi-tenancy support (different frontends, shared API)
158
- - ✅ Independent deployment of API and database
159
- - ✅ API can be reused across web, mobile, desktop
160
- - ✅ Better for large teams (frontend/backend specialization)
161
-
162
- **Cons:**
163
- - ❌ More infrastructure to manage (Workers + Convex)
164
- - ❌ HTTP overhead calling Convex
165
- - ❌ More complex authentication setup
166
-
167
- **Best For:**
168
- - Multi-tenant platforms
169
- - Large teams with frontend/backend separation
170
- - APIs serving multiple client types
171
-
172
- **Documentation:** See "Separate API Implementation" section below.
173
-
174
- ---
175
-
176
- ## Convex-Native Implementation
177
-
178
- This approach runs Hono **inside Convex** as HTTP actions, following the official Convex pattern.
179
-
180
- ### Setup
181
-
182
- **1. Install dependencies:**
183
- ```bash
184
- npm install hono convex-helpers @hono/zod-validator zod
185
- ```
186
-
187
- **2. Create `convex/http.ts`:**
188
- ```typescript
189
- import { Hono } from "hono";
190
- import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono";
191
- import { ActionCtx } from "./_generated/server";
192
- import { api } from "./_generated/api";
193
- import { cors } from "hono/cors";
194
- import { zValidator } from "@hono/zod-validator";
195
- import { z } from "zod";
196
-
197
- // Hono app with Convex context
198
- const app: HonoWithConvex<ActionCtx> = new Hono();
199
-
200
- // CORS middleware
201
- app.use('/api/*', cors({
202
- origin: ['http://localhost:4321', 'https://your-frontend.pages.dev'],
203
- credentials: true,
204
- }));
205
-
206
- /**
207
- * GET /api/tokens/:id
208
- * Fetch token via Convex query
209
- */
210
- app.get("/api/tokens/:id", async (c) => {
211
- const tokenId = c.req.param("id");
212
-
213
- // Direct access to Convex via c.env
214
- const token = await c.env.runQuery(api.queries.entities.get, {
215
- id: tokenId
216
- });
217
-
218
- if (!token || token.type !== "token") {
219
- return c.json({ error: "Token not found" }, 404);
220
- }
221
-
222
- return c.json(token);
223
- });
224
-
225
- /**
226
- * POST /api/tokens/purchase
227
- * Purchase tokens with validation
228
- */
229
- app.post(
230
- "/api/tokens/purchase",
231
- zValidator(
232
- "json",
233
- z.object({
234
- tokenId: z.string(),
235
- amount: z.number().min(1).max(10000),
236
- })
237
- ),
238
- async (c) => {
239
- const { tokenId, amount } = c.req.valid("json");
240
-
241
- // Get user from auth (example - implement based on your auth strategy)
242
- const userId = c.req.header("X-User-Id");
243
- if (!userId) {
244
- return c.json({ error: "Unauthorized" }, 401);
245
- }
246
-
247
- // Call Convex mutation
248
- const result = await c.env.runMutation(api.mutations.tokens.purchase, {
249
- userId,
250
- tokenId,
251
- amount,
252
- });
253
-
254
- return c.json(result);
255
- }
256
- );
257
-
258
- /**
259
- * GET /api/messages/:userId
260
- * Dynamic route example
261
- */
262
- app.get("/api/messages/:userId{[0-9]+}", async (c) => {
263
- const userId = c.req.param("userId");
264
-
265
- const messages = await c.env.runQuery(api.queries.messages.getByAuthor, {
266
- authorNumber: userId,
267
- });
268
-
269
- return c.json(messages);
270
- });
271
-
272
- // Export as Convex HTTP router
273
- export default new HttpRouterWithHono(app);
274
- ```
275
-
276
- **3. Update `convex.json`:**
277
- ```json
278
- {
279
- "functions": "convex/",
280
- "node": {
281
- "externalPackages": ["hono"]
282
- }
283
- }
284
- ```
285
-
286
- ### Authentication with Convex Auth
287
-
288
- **Using Convex Auth in Hono routes:**
289
-
290
- ```typescript
291
- import { getAuthUserId } from "@convex-dev/auth/server";
292
-
293
- app.post("/api/protected", async (c) => {
294
- // Get authenticated user ID
295
- const userId = await getAuthUserId(c.env);
296
-
297
- if (!userId) {
298
- return c.json({ error: "Unauthorized" }, 401);
299
- }
300
-
301
- // Use userId in queries/mutations
302
- const data = await c.env.runQuery(api.queries.getUserData, { userId });
303
-
304
- return c.json(data);
305
- });
306
- ```
307
-
308
- ### Cookie Handling
309
-
310
- ```typescript
311
- import { setCookie, getCookie } from 'hono/cookie';
312
-
313
- app.post("/api/session", async (c) => {
314
- const { token } = await c.req.json();
315
-
316
- // Set cookie
317
- setCookie(c, 'session_token', token, {
318
- httpOnly: true,
319
- secure: true,
320
- maxAge: 86400, // 1 day
321
- sameSite: 'Lax',
322
- });
323
-
324
- return c.json({ success: true });
325
- });
326
-
327
- app.get("/api/session", async (c) => {
328
- // Get cookie
329
- const token = getCookie(c, 'session_token');
330
-
331
- if (!token) {
332
- return c.json({ error: "No session" }, 401);
333
- }
334
-
335
- return c.json({ token });
336
- });
337
- ```
338
-
339
- ### Error Handling
340
-
341
- ```typescript
342
- app.onError((err, c) => {
343
- console.error(`${err}`);
344
-
345
- // Handle specific error types
346
- if (err.name === 'ConvexError') {
347
- return c.json({ error: err.message }, 400);
348
- }
349
-
350
- return c.json({ error: 'Internal Server Error' }, 500);
351
- });
352
- ```
353
-
354
- ### Benefits of Convex-Native Approach
355
-
356
- 1. **Direct Function Access**: No HTTP overhead calling Convex
357
- 2. **Shared Type Safety**: Same types for routes and Convex functions
358
- 3. **Simple Deployment**: Single `npx convex deploy`
359
- 4. **Built-in Auth**: Easy integration with Convex Auth
360
- 5. **Environment Variables**: Access via `process.env` in actions
361
-
362
- ### When to Use Convex-Native
363
-
364
- ✅ **Use this approach when:**
365
- - Building a single-tenant application
366
- - Want simplest possible deployment
367
- - Don't need multi-frontend support
368
- - Team is focused on rapid development
369
- - Frontend and backend tightly coupled
370
-
371
- ❌ **Don't use when:**
372
- - Need multi-tenancy (different frontends per org)
373
- - Want to reuse API across mobile/web/desktop
374
- - Large team needs frontend/backend separation
375
- - Need API versioning or complex routing
376
-
377
- ---
378
-
379
- ## Separate API Implementation (Cloudflare Workers)
380
-
381
- This approach runs Hono on **Cloudflare Workers** separately from Convex, providing maximum flexibility.
382
-
383
- ## Why Hono + Separation?
384
-
385
- ### Problems Solved
386
-
387
- 1. **Frontend Lock-In**: Currently Astro is tightly coupled to backend logic
388
- 2. **Multi-Tenancy**: Organizations can't easily customize their frontend
389
- 3. **Development Speed**: Frontend changes require backend understanding
390
- 4. **API Portability**: Backend logic can't be reused across different frontends
391
-
392
- ### Benefits
393
-
394
- 1. **Rapid Prototyping**: Users can "vibe code" frontend with Convex hooks without touching backend
395
- 2. **Multi-Frontend Support**: Same API serves web, mobile, desktop apps
396
- 3. **Clear Contracts**: API endpoints define clear boundaries
397
- 4. **Independent Deployment**: Deploy frontend and backend separately
398
- 5. **Team Specialization**: Frontend devs work on UI, backend devs work on logic
399
- 6. **Single Database**: All data (including auth) in Convex - no separate database needed
400
-
401
- ## Implementation Pattern
402
-
403
- ### 1. Hono API Backend Structure
404
-
405
- ```
406
- api/
407
- ├── src/
408
- │ ├── index.ts # Main Hono app
409
- │ ├── auth.ts # Better Auth with Convex adapter
410
- │ ├── routes/
411
- │ │ ├── auth.ts # /api/auth/* routes
412
- │ │ ├── tokens.ts # /api/tokens/* routes
413
- │ │ ├── agents.ts # /api/agents/* routes
414
- │ │ └── content.ts # /api/content/* routes
415
- │ ├── services/
416
- │ │ ├── convex.ts # Convex integration service
417
- │ │ ├── token.ts # Token business logic (Effect.ts)
418
- │ │ ├── agent.ts # Agent business logic (Effect.ts)
419
- │ │ └── content.ts # Content business logic (Effect.ts)
420
- │ └── middleware/
421
- │ ├── auth.ts # Auth middleware
422
- │ └── cors.ts # CORS configuration
423
- ├── convex/ # Shared Convex backend
424
- │ ├── schema.ts # 6-dimension ontology schema
425
- │ ├── queries/
426
- │ │ ├── auth.ts # Auth queries (for Better Auth adapter)
427
- │ │ ├── entities.ts
428
- │ │ └── ...
429
- │ ├── mutations/
430
- │ │ ├── auth.ts # Auth mutations (for Better Auth adapter)
431
- │ │ ├── entities.ts
432
- │ │ └── ...
433
- │ └── services/ # Shared Effect.ts services
434
- ├── wrangler.toml # Cloudflare Workers config
435
- └── package.json
436
- ```
437
-
438
- ### 2. Installation
439
-
440
- ```bash
441
- # Create Hono project
442
- npm create hono@latest api
443
- cd api
444
-
445
- # Install dependencies
446
- npm install hono
447
- npm install better-auth
448
- npm install convex
449
- npm install effect
450
- npm install @effect/schema
451
-
452
- # For development
453
- npm install -D @cloudflare/workers-types
454
- npm install -D wrangler
455
- ```
456
-
457
- ### 3. Better Auth with Convex Adapter
458
-
459
- #### `api/src/auth.ts`
460
-
461
- ```typescript
462
- import { betterAuth } from 'better-auth';
463
- import { ConvexHttpClient } from 'convex/browser';
464
- import { api } from '../../convex/_generated/api';
465
-
466
- type CloudflareBindings = {
467
- BETTER_AUTH_URL: string;
468
- BETTER_AUTH_SECRET: string;
469
- CONVEX_URL: string;
470
- GITHUB_CLIENT_ID: string;
471
- GITHUB_CLIENT_SECRET: string;
472
- GOOGLE_CLIENT_ID: string;
473
- GOOGLE_CLIENT_SECRET: string;
474
- };
475
-
476
- /**
477
- * Custom Convex adapter for Better Auth
478
- * Stores all auth data in Convex entities table
479
- */
480
- function createConvexAdapter(convexUrl: string) {
481
- const client = new ConvexHttpClient(convexUrl);
482
-
483
- return {
484
- // User operations
485
- async createUser(data: any) {
486
- return client.mutation(api.mutations.auth.createUser, data);
487
- },
488
- async getUser(id: string) {
489
- return client.query(api.queries.auth.getUser, { id });
490
- },
491
- async getUserByEmail(email: string) {
492
- return client.query(api.queries.auth.getUserByEmail, { email });
493
- },
494
- async updateUser(id: string, data: any) {
495
- return client.mutation(api.mutations.auth.updateUser, { id, data });
496
- },
497
- async deleteUser(id: string) {
498
- return client.mutation(api.mutations.auth.deleteUser, { id });
499
- },
500
-
501
- // Session operations
502
- async createSession(data: any) {
503
- return client.mutation(api.mutations.auth.createSession, data);
504
- },
505
- async getSession(token: string) {
506
- return client.query(api.queries.auth.getSession, { token });
507
- },
508
- async updateSession(token: string, data: any) {
509
- return client.mutation(api.mutations.auth.updateSession, { token, data });
510
- },
511
- async deleteSession(token: string) {
512
- return client.mutation(api.mutations.auth.deleteSession, { token });
513
- },
514
-
515
- // Account operations (OAuth)
516
- async linkAccount(data: any) {
517
- return client.mutation(api.mutations.auth.linkAccount, data);
518
- },
519
- async unlinkAccount(data: any) {
520
- return client.mutation(api.mutations.auth.unlinkAccount, data);
521
- },
522
-
523
- // Verification tokens
524
- async createVerificationToken(data: any) {
525
- return client.mutation(api.mutations.auth.createVerificationToken, data);
526
- },
527
- async getVerificationToken(token: string) {
528
- return client.query(api.queries.auth.getVerificationToken, { token });
529
- },
530
- async deleteVerificationToken(token: string) {
531
- return client.mutation(api.mutations.auth.deleteVerificationToken, { token });
532
- },
533
- };
534
- }
535
-
536
- export const auth = (env: CloudflareBindings) => {
537
- return betterAuth({
538
- database: createConvexAdapter(env.CONVEX_URL),
539
- baseURL: env.BETTER_AUTH_URL,
540
- secret: env.BETTER_AUTH_SECRET,
541
- emailAndPassword: {
542
- enabled: true,
543
- requireEmailVerification: true,
544
- },
545
- socialProviders: {
546
- github: {
547
- clientId: env.GITHUB_CLIENT_ID,
548
- clientSecret: env.GITHUB_CLIENT_SECRET,
549
- },
550
- google: {
551
- clientId: env.GOOGLE_CLIENT_ID,
552
- clientSecret: env.GOOGLE_CLIENT_SECRET,
553
- },
554
- },
555
- });
556
- };
557
- ```
558
-
559
- ### 4. Convex Auth Mutations/Queries
560
-
561
- #### `convex/mutations/auth.ts`
562
-
563
- ```typescript
564
- import { v } from 'convex/values';
565
- import { mutation } from '../_generated/server';
566
-
567
- /**
568
- * Auth mutations for Better Auth Convex adapter
569
- * Stores auth data in entities table following ontology
570
- */
571
-
572
- export const createUser = mutation({
573
- args: {
574
- email: v.string(),
575
- name: v.optional(v.string()),
576
- image: v.optional(v.string()),
577
- emailVerified: v.optional(v.boolean()),
578
- },
579
- handler: async (ctx, args) => {
580
- const userId = await ctx.db.insert('entities', {
581
- type: 'user',
582
- name: args.name || args.email,
583
- properties: {
584
- email: args.email,
585
- image: args.image,
586
- emailVerified: args.emailVerified || false,
587
- role: 'user',
588
- },
589
- status: 'active',
590
- createdAt: Date.now(),
591
- updatedAt: Date.now(),
592
- });
593
-
594
- return { id: userId, ...args };
595
- },
596
- });
597
-
598
- export const updateUser = mutation({
599
- args: {
600
- id: v.id('entities'),
601
- data: v.object({
602
- email: v.optional(v.string()),
603
- name: v.optional(v.string()),
604
- image: v.optional(v.string()),
605
- emailVerified: v.optional(v.boolean()),
606
- }),
607
- },
608
- handler: async (ctx, args) => {
609
- const user = await ctx.db.get(args.id);
610
- if (!user || user.type !== 'user') {
611
- throw new Error('User not found');
612
- }
613
-
614
- await ctx.db.patch(args.id, {
615
- name: args.data.name || user.name,
616
- properties: {
617
- ...user.properties,
618
- ...args.data,
619
- },
620
- updatedAt: Date.now(),
621
- });
622
-
623
- return { id: args.id, ...args.data };
624
- },
625
- });
626
-
627
- export const deleteUser = mutation({
628
- args: { id: v.id('entities') },
629
- handler: async (ctx, args) => {
630
- await ctx.db.delete(args.id);
631
- return { success: true };
632
- },
633
- });
634
-
635
- export const createSession = mutation({
636
- args: {
637
- userId: v.id('entities'),
638
- token: v.string(),
639
- expiresAt: v.number(),
640
- },
641
- handler: async (ctx, args) => {
642
- const sessionId = await ctx.db.insert('entities', {
643
- type: 'session',
644
- name: `Session for ${args.userId}`,
645
- properties: {
646
- userId: args.userId,
647
- token: args.token,
648
- expiresAt: args.expiresAt,
649
- },
650
- status: 'active',
651
- createdAt: Date.now(),
652
- updatedAt: Date.now(),
653
- });
654
-
655
- // Create connection: user → session
656
- await ctx.db.insert('connections', {
657
- fromEntityId: args.userId,
658
- toEntityId: sessionId,
659
- relationshipType: 'has_session',
660
- createdAt: Date.now(),
661
- });
662
-
663
- return { id: sessionId, ...args };
664
- },
665
- });
666
-
667
- export const updateSession = mutation({
668
- args: {
669
- token: v.string(),
670
- data: v.object({
671
- expiresAt: v.optional(v.number()),
672
- }),
673
- },
674
- handler: async (ctx, args) => {
675
- const session = await ctx.db
676
- .query('entities')
677
- .filter((q) =>
678
- q.and(
679
- q.eq(q.field('type'), 'session'),
680
- q.eq(q.field('properties.token'), args.token)
681
- )
682
- )
683
- .first();
684
-
685
- if (!session) {
686
- throw new Error('Session not found');
687
- }
688
-
689
- await ctx.db.patch(session._id, {
690
- properties: {
691
- ...session.properties,
692
- ...args.data,
693
- },
694
- updatedAt: Date.now(),
695
- });
696
-
697
- return { token: args.token, ...args.data };
698
- },
699
- });
700
-
701
- export const deleteSession = mutation({
702
- args: { token: v.string() },
703
- handler: async (ctx, args) => {
704
- const session = await ctx.db
705
- .query('entities')
706
- .filter((q) =>
707
- q.and(
708
- q.eq(q.field('type'), 'session'),
709
- q.eq(q.field('properties.token'), args.token)
710
- )
711
- )
712
- .first();
713
-
714
- if (session) {
715
- await ctx.db.delete(session._id);
716
- }
717
-
718
- return { success: true };
719
- },
720
- });
721
-
722
- // OAuth account linking
723
- export const linkAccount = mutation({
724
- args: {
725
- userId: v.id('entities'),
726
- provider: v.string(),
727
- providerAccountId: v.string(),
728
- accessToken: v.optional(v.string()),
729
- refreshToken: v.optional(v.string()),
730
- },
731
- handler: async (ctx, args) => {
732
- const accountId = await ctx.db.insert('entities', {
733
- type: 'oauth_account',
734
- name: `${args.provider} account`,
735
- properties: {
736
- provider: args.provider,
737
- providerAccountId: args.providerAccountId,
738
- accessToken: args.accessToken,
739
- refreshToken: args.refreshToken,
740
- },
741
- status: 'active',
742
- createdAt: Date.now(),
743
- updatedAt: Date.now(),
744
- });
745
-
746
- // Connection: user → oauth_account
747
- await ctx.db.insert('connections', {
748
- fromEntityId: args.userId,
749
- toEntityId: accountId,
750
- relationshipType: 'linked_account',
751
- createdAt: Date.now(),
752
- });
753
-
754
- return { id: accountId, ...args };
755
- },
756
- });
757
-
758
- export const unlinkAccount = mutation({
759
- args: {
760
- provider: v.string(),
761
- providerAccountId: v.string(),
762
- },
763
- handler: async (ctx, args) => {
764
- const account = await ctx.db
765
- .query('entities')
766
- .filter((q) =>
767
- q.and(
768
- q.eq(q.field('type'), 'oauth_account'),
769
- q.eq(q.field('properties.provider'), args.provider),
770
- q.eq(q.field('properties.providerAccountId'), args.providerAccountId)
771
- )
772
- )
773
- .first();
774
-
775
- if (account) {
776
- await ctx.db.delete(account._id);
777
- }
778
-
779
- return { success: true };
780
- },
781
- });
782
-
783
- // Verification tokens
784
- export const createVerificationToken = mutation({
785
- args: {
786
- identifier: v.string(), // email
787
- token: v.string(),
788
- expiresAt: v.number(),
789
- },
790
- handler: async (ctx, args) => {
791
- const tokenId = await ctx.db.insert('entities', {
792
- type: 'verification_token',
793
- name: `Verification for ${args.identifier}`,
794
- properties: {
795
- identifier: args.identifier,
796
- token: args.token,
797
- expiresAt: args.expiresAt,
798
- },
799
- status: 'active',
800
- createdAt: Date.now(),
801
- updatedAt: Date.now(),
802
- });
803
-
804
- return { id: tokenId, ...args };
805
- },
806
- });
807
-
808
- export const deleteVerificationToken = mutation({
809
- args: { token: v.string() },
810
- handler: async (ctx, args) => {
811
- const token = await ctx.db
812
- .query('entities')
813
- .filter((q) =>
814
- q.and(
815
- q.eq(q.field('type'), 'verification_token'),
816
- q.eq(q.field('properties.token'), args.token)
817
- )
818
- )
819
- .first();
820
-
821
- if (token) {
822
- await ctx.db.delete(token._id);
823
- }
824
-
825
- return { success: true };
826
- },
827
- });
828
- ```
829
-
830
- #### `convex/queries/auth.ts`
831
-
832
- ```typescript
833
- import { v } from 'convex/values';
834
- import { query } from '../_generated/server';
835
-
836
- /**
837
- * Auth queries for Better Auth Convex adapter
838
- */
839
-
840
- export const getUser = query({
841
- args: { id: v.id('entities') },
842
- handler: async (ctx, args) => {
843
- const user = await ctx.db.get(args.id);
844
- if (!user || user.type !== 'user') return null;
845
-
846
- return {
847
- id: user._id,
848
- email: user.properties.email,
849
- name: user.name,
850
- image: user.properties.image,
851
- emailVerified: user.properties.emailVerified,
852
- };
853
- },
854
- });
855
-
856
- export const getUserByEmail = query({
857
- args: { email: v.string() },
858
- handler: async (ctx, args) => {
859
- const user = await ctx.db
860
- .query('entities')
861
- .filter((q) =>
862
- q.and(
863
- q.eq(q.field('type'), 'user'),
864
- q.eq(q.field('properties.email'), args.email)
865
- )
866
- )
867
- .first();
868
-
869
- if (!user) return null;
870
-
871
- return {
872
- id: user._id,
873
- email: user.properties.email,
874
- name: user.name,
875
- image: user.properties.image,
876
- emailVerified: user.properties.emailVerified,
877
- };
878
- },
879
- });
880
-
881
- export const getSession = query({
882
- args: { token: v.string() },
883
- handler: async (ctx, args) => {
884
- const session = await ctx.db
885
- .query('entities')
886
- .filter((q) =>
887
- q.and(
888
- q.eq(q.field('type'), 'session'),
889
- q.eq(q.field('properties.token'), args.token)
890
- )
891
- )
892
- .first();
893
-
894
- if (!session) return null;
895
-
896
- // Check if expired
897
- if (session.properties.expiresAt < Date.now()) {
898
- await ctx.db.delete(session._id);
899
- return null;
900
- }
901
-
902
- return {
903
- id: session._id,
904
- userId: session.properties.userId,
905
- token: args.token,
906
- expiresAt: session.properties.expiresAt,
907
- };
908
- },
909
- });
910
-
911
- export const getVerificationToken = query({
912
- args: { token: v.string() },
913
- handler: async (ctx, args) => {
914
- const token = await ctx.db
915
- .query('entities')
916
- .filter((q) =>
917
- q.and(
918
- q.eq(q.field('type'), 'verification_token'),
919
- q.eq(q.field('properties.token'), args.token)
920
- )
921
- )
922
- .first();
923
-
924
- if (!token) return null;
925
-
926
- // Check if expired
927
- if (token.properties.expiresAt < Date.now()) {
928
- await ctx.db.delete(token._id);
929
- return null;
930
- }
931
-
932
- return {
933
- identifier: token.properties.identifier,
934
- token: args.token,
935
- expiresAt: token.properties.expiresAt,
936
- };
937
- },
938
- });
939
- ```
940
-
941
- ### 5. Hono Main App
942
-
943
- #### `api/src/index.ts`
944
-
945
- ```typescript
946
- import { Hono } from 'hono';
947
- import { cors } from 'hono/cors';
948
- import { auth } from './auth';
949
- import { tokenRoutes } from './routes/tokens';
950
- import { agentRoutes } from './routes/agents';
951
- import { contentRoutes } from './routes/content';
952
-
953
- type CloudflareBindings = {
954
- BETTER_AUTH_URL: string;
955
- BETTER_AUTH_SECRET: string;
956
- CONVEX_URL: string;
957
- GITHUB_CLIENT_ID: string;
958
- GITHUB_CLIENT_SECRET: string;
959
- GOOGLE_CLIENT_ID: string;
960
- GOOGLE_CLIENT_SECRET: string;
961
- };
962
-
963
- const app = new Hono<{ Bindings: CloudflareBindings }>();
964
-
965
- // CORS for Astro frontend
966
- app.use('/*', cors({
967
- origin: ['http://localhost:4321', 'https://your-astro-frontend.pages.dev'],
968
- credentials: true,
969
- }));
970
-
971
- // Better Auth endpoints (handles sign-in, sign-up, OAuth, etc.)
972
- app.on(['GET', 'POST'], '/api/auth/*', (c) => {
973
- return auth(c.env).handler(c.req.raw);
974
- });
975
-
976
- // Business logic routes
977
- app.route('/api/tokens', tokenRoutes);
978
- app.route('/api/agents', agentRoutes);
979
- app.route('/api/content', contentRoutes);
980
-
981
- // Health check
982
- app.get('/health', (c) => c.json({ status: 'ok' }));
983
-
984
- export default app;
985
- ```
986
-
987
- ### 6. Convex Integration Service (Effect.ts Wrapper)
988
-
989
- #### `api/src/services/convex.ts`
990
-
991
- ```typescript
992
- import { Effect, Context, Layer } from 'effect';
993
- import { ConvexHttpClient } from 'convex/browser';
994
- import { api } from '../../../convex/_generated/api';
995
- import type { Id } from '../../../convex/_generated/dataModel';
996
-
997
- /**
998
- * Convex Database Error
999
- */
1000
- export class ConvexDatabaseError {
1001
- readonly _tag = 'ConvexDatabaseError';
1002
- constructor(readonly operation: string, readonly cause: unknown) {}
1003
- }
1004
-
1005
- /**
1006
- * Convex Database Service (Effect.ts wrapper)
1007
- * Provides typed access to Convex functions with Effect error handling
1008
- *
1009
- * See effect.md for complete Effect.ts integration patterns
1010
- */
1011
- export class ConvexDatabase extends Context.Tag('ConvexDatabase')<
1012
- ConvexDatabase,
1013
- {
1014
- // Generic operations
1015
- query: <T>(name: any, args: any) => Effect.Effect<T, ConvexDatabaseError>;
1016
- mutation: <T>(name: any, args: any) => Effect.Effect<T, ConvexDatabaseError>;
1017
- action: <T>(name: any, args: any) => Effect.Effect<T, ConvexDatabaseError>;
1018
-
1019
- // Convenience methods for common operations
1020
- getEntity: (id: Id<'entities'>) => Effect.Effect<any, ConvexDatabaseError>;
1021
- listEntities: (type: string) => Effect.Effect<any[], ConvexDatabaseError>;
1022
- }
1023
- >() {
1024
- /**
1025
- * Live implementation (production)
1026
- */
1027
- static readonly Live = Layer.effect(
1028
- ConvexDatabase,
1029
- Effect.gen(function* () {
1030
- // Get Convex URL from environment
1031
- const convexUrl = yield* Effect.sync(() => process.env.CONVEX_URL);
1032
-
1033
- if (!convexUrl) {
1034
- return yield* Effect.fail(
1035
- new ConvexDatabaseError('init', 'CONVEX_URL not set')
1036
- );
1037
- }
1038
-
1039
- const client = new ConvexHttpClient(convexUrl);
1040
-
1041
- return {
1042
- // Generic query/mutation/action
1043
- query: <T>(name: any, args: any) =>
1044
- Effect.tryPromise({
1045
- try: () => client.query(name, args) as Promise<T>,
1046
- catch: (error) => new ConvexDatabaseError('query', error),
1047
- }),
1048
-
1049
- mutation: <T>(name: any, args: any) =>
1050
- Effect.tryPromise({
1051
- try: () => client.mutation(name, args) as Promise<T>,
1052
- catch: (error) => new ConvexDatabaseError('mutation', error),
1053
- }),
1054
-
1055
- action: <T>(name: any, args: any) =>
1056
- Effect.tryPromise({
1057
- try: () => client.action(name, args) as Promise<T>,
1058
- catch: (error) => new ConvexDatabaseError('action', error),
1059
- }),
1060
-
1061
- // Convenience methods
1062
- getEntity: (id: Id<'entities'>) =>
1063
- Effect.tryPromise({
1064
- try: () => client.query(api.queries.entities.get, { id }),
1065
- catch: (error) => new ConvexDatabaseError('getEntity', error),
1066
- }),
1067
-
1068
- listEntities: (type: string) =>
1069
- Effect.tryPromise({
1070
- try: () => client.query(api.queries.entities.list, { type }),
1071
- catch: (error) => new ConvexDatabaseError('listEntities', error),
1072
- }),
1073
- };
1074
- })
1075
- );
1076
-
1077
- /**
1078
- * Create layer from environment
1079
- */
1080
- static fromEnv = (convexUrl: string) =>
1081
- Layer.succeed(ConvexDatabase, {
1082
- query: <T>(name: any, args: any) => {
1083
- const client = new ConvexHttpClient(convexUrl);
1084
- return Effect.tryPromise({
1085
- try: () => client.query(name, args) as Promise<T>,
1086
- catch: (error) => new ConvexDatabaseError('query', error),
1087
- });
1088
- },
1089
- mutation: <T>(name: any, args: any) => {
1090
- const client = new ConvexHttpClient(convexUrl);
1091
- return Effect.tryPromise({
1092
- try: () => client.mutation(name, args) as Promise<T>,
1093
- catch: (error) => new ConvexDatabaseError('mutation', error),
1094
- });
1095
- },
1096
- action: <T>(name: any, args: any) => {
1097
- const client = new ConvexHttpClient(convexUrl);
1098
- return Effect.tryPromise({
1099
- try: () => client.action(name, args) as Promise<T>,
1100
- catch: (error) => new ConvexDatabaseError('action', error),
1101
- });
1102
- },
1103
- getEntity: (id: Id<'entities'>) => {
1104
- const client = new ConvexHttpClient(convexUrl);
1105
- return Effect.tryPromise({
1106
- try: () => client.query(api.queries.entities.get, { id }),
1107
- catch: (error) => new ConvexDatabaseError('getEntity', error),
1108
- });
1109
- },
1110
- listEntities: (type: string) => {
1111
- const client = new ConvexHttpClient(convexUrl);
1112
- return Effect.tryPromise({
1113
- try: () => client.query(api.queries.entities.list, { type }),
1114
- catch: (error) => new ConvexDatabaseError('listEntities', error),
1115
- });
1116
- },
1117
- });
1118
- }
1119
- ```
1120
-
1121
- #### `api/src/lib/effect-handler.ts`
1122
-
1123
- ```typescript
1124
- import { Effect, Exit } from 'effect';
1125
- import type { Context } from 'hono';
1126
-
1127
- /**
1128
- * Run Effect program in Hono route handler
1129
- * Automatically converts Effect errors to HTTP responses
1130
- *
1131
- * See effect.md for complete usage patterns
1132
- */
1133
- export async function runEffectHandler<E, A>(
1134
- c: Context,
1135
- program: Effect.Effect<A, E>,
1136
- errorHandler?: (error: E) => { status: number; body: any }
1137
- ): Promise<Response> {
1138
- const exit = await Effect.runPromiseExit(program);
1139
-
1140
- return Exit.match(exit, {
1141
- onSuccess: (value) => c.json(value),
1142
- onFailure: (cause) => {
1143
- // Extract the error
1144
- const failures = cause.failures;
1145
- const error = failures.length > 0 ? failures[0] : null;
1146
-
1147
- // Use custom error handler if provided
1148
- if (errorHandler && error) {
1149
- const { status, body } = errorHandler(error as E);
1150
- return c.json(body, status);
1151
- }
1152
-
1153
- // Default error handling based on error tag
1154
- if (error && typeof error === 'object' && '_tag' in error) {
1155
- switch ((error as any)._tag) {
1156
- case 'UnauthorizedError':
1157
- return c.json({ error: 'Unauthorized' }, 401);
1158
- case 'NotFoundError':
1159
- return c.json({ error: 'Not found' }, 404);
1160
- case 'ValidationError':
1161
- return c.json({ error: (error as any).message }, 400);
1162
- case 'QuotaExceededError':
1163
- return c.json({
1164
- error: (error as any).message,
1165
- code: 'QUOTA_EXCEEDED'
1166
- }, 403);
1167
- case 'ConvexDatabaseError':
1168
- return c.json({
1169
- error: 'Database error',
1170
- operation: (error as any).operation
1171
- }, 500);
1172
- default:
1173
- return c.json({ error: 'Internal server error' }, 500);
1174
- }
1175
- }
1176
-
1177
- return c.json({ error: 'Internal server error' }, 500);
1178
- },
1179
- });
1180
- }
1181
-
1182
- /**
1183
- * Hono Context as Effect Service
1184
- */
1185
- import { Context as EffectContext } from 'effect';
1186
-
1187
- export class HonoContextService extends EffectContext.Tag('HonoContext')<
1188
- HonoContextService,
1189
- {
1190
- req: Context['req'];
1191
- env: any;
1192
- orgId?: string;
1193
- session?: any;
1194
- }
1195
- >() {}
1196
-
1197
- /**
1198
- * Extract Hono context into Effect layer
1199
- */
1200
- export const createHonoLayer = (c: Context) => {
1201
- return Layer.succeed(HonoContextService, {
1202
- req: c.req,
1203
- env: c.env,
1204
- orgId: c.get('orgId'),
1205
- session: c.get('session'),
1206
- });
1207
- };
1208
- ```
1209
-
1210
- ### 7. Business Logic with Effect.ts
1211
-
1212
- #### `api/src/services/token.ts`
1213
-
1214
- ```typescript
1215
- import { Effect } from 'effect';
1216
- import { ConvexService } from './convex';
1217
-
1218
- /**
1219
- * Token business logic service
1220
- * Pure Effect.ts service - no side effects
1221
- */
1222
-
1223
- // Tagged errors
1224
- export class TokenNotFoundError {
1225
- readonly _tag = 'TokenNotFoundError';
1226
- constructor(readonly tokenId: string) {}
1227
- }
1228
-
1229
- export class InsufficientFundsError {
1230
- readonly _tag = 'InsufficientFundsError';
1231
- constructor(readonly required: number, readonly available: number) {}
1232
- }
1233
-
1234
- export class TokenService {
1235
- constructor(private convex: ConvexService) {}
1236
-
1237
- /**
1238
- * Purchase tokens with validation
1239
- */
1240
- purchase = (args: {
1241
- userId: string;
1242
- tokenId: string;
1243
- amount: number;
1244
- }): Effect.Effect<
1245
- { success: true; newBalance: number },
1246
- TokenNotFoundError | InsufficientFundsError
1247
- > =>
1248
- Effect.gen(this, function* () {
1249
- // Validate token exists
1250
- const token = yield* Effect.promise(() => this.convex.getEntity(args.tokenId));
1251
-
1252
- if (!token || token.type !== 'token') {
1253
- return yield* Effect.fail(new TokenNotFoundError(args.tokenId));
1254
- }
1255
-
1256
- // Calculate cost
1257
- const cost = args.amount * token.properties.price;
1258
-
1259
- // TODO: Verify user has funds (integrate with payment provider)
1260
- // For now, assume purchase succeeds
1261
-
1262
- // Execute purchase via Convex
1263
- const result = yield* Effect.promise(() =>
1264
- this.convex.purchaseTokens(args.userId, args.tokenId, args.amount)
1265
- );
1266
-
1267
- return {
1268
- success: true as const,
1269
- newBalance: result.balance,
1270
- };
1271
- });
1272
-
1273
- /**
1274
- * Get token balance
1275
- */
1276
- getBalance = (args: {
1277
- userId: string;
1278
- tokenId: string;
1279
- }): Effect.Effect<number, TokenNotFoundError> =>
1280
- Effect.gen(this, function* () {
1281
- const balance = yield* Effect.promise(() =>
1282
- this.convex.getTokenBalance(args.userId, args.tokenId)
1283
- );
1284
-
1285
- return balance;
1286
- });
1287
- }
1288
- ```
1289
-
1290
- ### 8. API Routes with Effect.ts
1291
-
1292
- #### `api/src/routes/tokens.ts`
1293
-
1294
- ```typescript
1295
- import { Hono } from 'hono';
1296
- import { Effect, Layer } from 'effect';
1297
- import { runEffectHandler, createHonoLayer, HonoContextService } from '../lib/effect-handler';
1298
- import { ConvexDatabase } from '../services/convex';
1299
- import { TokenService } from '../../../convex/services/tokens/token';
1300
- import { AuthService } from '../services/auth';
1301
- import { StripeProvider } from '../services/providers/stripe';
1302
- import { auth } from '../auth';
1303
-
1304
- const app = new Hono();
1305
-
1306
- /**
1307
- * GET /api/tokens/:id
1308
- * Fetch token details
1309
- */
1310
- app.get('/:id', async (c) => {
1311
- const tokenId = c.req.param('id');
1312
-
1313
- // Build Effect program
1314
- const program = Effect.gen(function* () {
1315
- const db = yield* ConvexDatabase;
1316
-
1317
- // Get token entity
1318
- const token = yield* db.getEntity(tokenId);
1319
-
1320
- if (!token || token.type !== 'token') {
1321
- return yield* Effect.fail(new NotFoundError('Token not found'));
1322
- }
1323
-
1324
- return token;
1325
- });
1326
-
1327
- // Create layer with dependencies
1328
- const layer = ConvexDatabase.fromEnv(c.env.CONVEX_URL);
1329
-
1330
- // Run Effect program with automatic error handling
1331
- return runEffectHandler(c, program.pipe(Effect.provide(layer)));
1332
- });
1333
-
1334
- /**
1335
- * POST /api/tokens/purchase
1336
- * Purchase tokens (complete Effect.ts flow)
1337
- */
1338
- app.post('/purchase', async (c) => {
1339
- const { tokenId, amount } = await c.req.json();
1340
-
1341
- // Build Effect program
1342
- const program = Effect.gen(function* () {
1343
- // Get dependencies
1344
- const ctx = yield* HonoContextService;
1345
- const authService = yield* AuthService;
1346
- const tokenService = yield* TokenService;
1347
-
1348
- // Verify authentication
1349
- const session = yield* authService.getSession(ctx.req.raw.headers);
1350
- if (!session) {
1351
- return yield* Effect.fail(new UnauthorizedError());
1352
- }
1353
-
1354
- // Check organization membership (if multi-tenant)
1355
- if (ctx.orgId) {
1356
- const isMember = yield* authService.checkOrgMembership({
1357
- userId: session.user.id,
1358
- orgId: ctx.orgId,
1359
- });
1360
-
1361
- if (!isMember) {
1362
- return yield* Effect.fail(
1363
- new ForbiddenError('Not a member of this organization')
1364
- );
1365
- }
1366
- }
1367
-
1368
- // Execute token purchase (Effect.ts service)
1369
- const result = yield* tokenService.purchase({
1370
- userId: session.user.id,
1371
- tokenId,
1372
- amount,
1373
- orgId: ctx.orgId,
1374
- });
1375
-
1376
- // Log success
1377
- yield* Effect.logInfo('Token purchase completed', {
1378
- userId: session.user.id,
1379
- tokenId,
1380
- amount,
1381
- newBalance: result.newBalance,
1382
- });
1383
-
1384
- return result;
1385
- });
1386
-
1387
- // Create layer with all dependencies
1388
- const layer = Layer.mergeAll(
1389
- createHonoLayer(c),
1390
- ConvexDatabase.fromEnv(c.env.CONVEX_URL),
1391
- StripeProvider.Live,
1392
- AuthService.Default,
1393
- TokenService.Default
1394
- );
1395
-
1396
- // Run Effect program (errors automatically converted to HTTP responses)
1397
- return runEffectHandler(c, program.pipe(Effect.provide(layer)));
1398
- });
1399
-
1400
- /**
1401
- * GET /api/tokens/balance/:tokenId
1402
- * Get user's token balance
1403
- */
1404
- app.get('/balance/:tokenId', async (c) => {
1405
- const tokenId = c.req.param('tokenId');
1406
-
1407
- const program = Effect.gen(function* () {
1408
- const ctx = yield* HonoContextService;
1409
- const authService = yield* AuthService;
1410
- const tokenService = yield* TokenService;
1411
-
1412
- // Verify authentication
1413
- const session = yield* authService.getSession(ctx.req.raw.headers);
1414
- if (!session) {
1415
- return yield* Effect.fail(new UnauthorizedError());
1416
- }
1417
-
1418
- // Get balance
1419
- const balance = yield* tokenService.getBalance({
1420
- userId: session.user.id,
1421
- tokenId,
1422
- orgId: ctx.orgId,
1423
- });
1424
-
1425
- return { balance };
1426
- });
1427
-
1428
- const layer = Layer.mergeAll(
1429
- createHonoLayer(c),
1430
- ConvexDatabase.fromEnv(c.env.CONVEX_URL),
1431
- AuthService.Default,
1432
- TokenService.Default
1433
- );
1434
-
1435
- return runEffectHandler(c, program.pipe(Effect.provide(layer)));
1436
- });
1437
-
1438
- export const tokenRoutes = app;
1439
-
1440
- /**
1441
- * Tagged Errors
1442
- */
1443
- class NotFoundError {
1444
- readonly _tag = 'NotFoundError';
1445
- constructor(readonly message: string) {}
1446
- }
1447
-
1448
- class UnauthorizedError {
1449
- readonly _tag = 'UnauthorizedError';
1450
- }
1451
-
1452
- class ForbiddenError {
1453
- readonly _tag = 'ForbiddenError';
1454
- constructor(readonly message: string) {}
1455
- }
1456
- ```
1457
-
1458
- **Key Benefits of This Pattern:**
1459
-
1460
- 1. **Type-Safe Error Handling** - All errors are typed with `_tag`
1461
- 2. **Automatic HTTP Conversion** - `runEffectHandler` converts Effect errors to HTTP responses
1462
- 3. **Composable Logic** - Effect programs compose cleanly
1463
- 4. **Testable** - Easy to test with mock layers
1464
- 5. **Observable** - Built-in logging via `Effect.logInfo`
1465
-
1466
- For complete Effect.ts patterns and examples, see **[effect.md](../connections/effect.md)**.
1467
-
1468
- ### 9. Astro Frontend Integration
1469
-
1470
- #### `src/lib/api.ts` (API Client)
1471
-
1472
- ```typescript
1473
- /**
1474
- * API client for Hono backend
1475
- * Provides typed methods for all API endpoints
1476
- */
1477
- export class APIClient {
1478
- private baseURL: string;
1479
-
1480
- constructor(baseURL: string = import.meta.env.PUBLIC_API_URL) {
1481
- this.baseURL = baseURL;
1482
- }
1483
-
1484
- private async request(
1485
- path: string,
1486
- options: RequestInit = {}
1487
- ): Promise<Response> {
1488
- return fetch(`${this.baseURL}${path}`, {
1489
- ...options,
1490
- credentials: 'include', // Important for Better Auth cookies
1491
- headers: {
1492
- 'Content-Type': 'application/json',
1493
- ...options.headers,
1494
- },
1495
- });
1496
- }
1497
-
1498
- // Auth methods (Better Auth endpoints)
1499
- async signIn(email: string, password: string) {
1500
- return this.request('/api/auth/sign-in', {
1501
- method: 'POST',
1502
- body: JSON.stringify({ email, password }),
1503
- });
1504
- }
1505
-
1506
- async signUp(email: string, password: string, name: string) {
1507
- return this.request('/api/auth/sign-up', {
1508
- method: 'POST',
1509
- body: JSON.stringify({ email, password, name }),
1510
- });
1511
- }
1512
-
1513
- async signOut() {
1514
- return this.request('/api/auth/sign-out', { method: 'POST' });
1515
- }
1516
-
1517
- async getSession() {
1518
- const res = await this.request('/api/auth/session');
1519
- return res.json();
1520
- }
1521
-
1522
- // Token methods
1523
- async getToken(id: string) {
1524
- const res = await this.request(`/api/tokens/${id}`);
1525
- return res.json();
1526
- }
1527
-
1528
- async purchaseTokens(tokenId: string, amount: number) {
1529
- const res = await this.request('/api/tokens/purchase', {
1530
- method: 'POST',
1531
- body: JSON.stringify({ tokenId, amount }),
1532
- });
1533
- return res.json();
1534
- }
1535
-
1536
- async getTokenBalance(tokenId: string) {
1537
- const res = await this.request(`/api/tokens/balance/${tokenId}`);
1538
- return res.json();
1539
- }
1540
-
1541
- // Agent methods
1542
- async createAgent(config: any) {
1543
- const res = await this.request('/api/agents', {
1544
- method: 'POST',
1545
- body: JSON.stringify(config),
1546
- });
1547
- return res.json();
1548
- }
1549
-
1550
- async getAgent(id: string) {
1551
- const res = await this.request(`/api/agents/${id}`);
1552
- return res.json();
1553
- }
1554
-
1555
- // Content methods
1556
- async createContent(content: any) {
1557
- const res = await this.request('/api/content', {
1558
- method: 'POST',
1559
- body: JSON.stringify(content),
1560
- });
1561
- return res.json();
1562
- }
1563
-
1564
- async listContent() {
1565
- const res = await this.request('/api/content');
1566
- return res.json();
1567
- }
1568
- }
1569
-
1570
- export const api = new APIClient();
1571
- ```
1572
-
1573
- ### 10. Dual Integration Pattern (Hono + Convex + Effect.ts)
1574
-
1575
- #### `src/components/features/tokens/TokenPurchase.tsx`
1576
-
1577
- ```typescript
1578
- import { useState } from 'react';
1579
- import { Effect } from 'effect';
1580
- import { useQuery } from 'convex/react';
1581
- import { api as convexApi } from '@/convex/_generated/api'; // Convex hooks
1582
- import { TokenClientService } from '@/lib/effects/token-client';
1583
- import { ClientLayer } from '@/lib/effects/layers';
1584
- import { Button } from '@/components/ui/button';
1585
- import { useToast } from '@/hooks/use-toast';
1586
- import type { Id } from '@/convex/_generated/dataModel';
1587
-
1588
- /**
1589
- * Token purchase component demonstrating triple integration:
1590
- * 1. Convex hooks for real-time data (live balance updates)
1591
- * 2. Effect.ts client service for API calls (type-safe errors)
1592
- * 3. Hono API backend for business logic (auth, validation, payment)
1593
- *
1594
- * See effect.md for complete Effect.ts client patterns
1595
- */
1596
- export function TokenPurchase({ tokenId }: { tokenId: Id<'entities'> }) {
1597
- const { toast } = useToast();
1598
- const [loading, setLoading] = useState(false);
1599
-
1600
- // Real-time token data via Convex (live updates!)
1601
- const token = useQuery(convexApi.queries.tokens.get, { id: tokenId });
1602
-
1603
- /**
1604
- * Purchase handler using Effect.ts client service
1605
- * Provides type-safe error handling and automatic retry
1606
- */
1607
- const handlePurchase = async (amount: number) => {
1608
- setLoading(true);
1609
-
1610
- // Build Effect program
1611
- const program = Effect.gen(function* () {
1612
- const tokenService = yield* TokenClientService;
1613
-
1614
- // Purchase tokens (calls Hono API)
1615
- const result = yield* tokenService.purchase({ tokenId, amount });
1616
-
1617
- return result;
1618
- });
1619
-
1620
- // Run Effect program with error handling
1621
- const result = await Effect.runPromise(
1622
- program.pipe(
1623
- // Provide client dependencies
1624
- Effect.provide(ClientLayer),
1625
-
1626
- // Automatic retry on network errors
1627
- Effect.retry({
1628
- times: 3,
1629
- schedule: Effect.Schedule.exponential('1 second'),
1630
- }),
1631
-
1632
- // Timeout after 30 seconds
1633
- Effect.timeout('30 seconds'),
1634
-
1635
- // Handle success
1636
- Effect.tap(() =>
1637
- Effect.sync(() =>
1638
- toast({
1639
- title: 'Success!',
1640
- description: `Purchased ${amount} tokens`,
1641
- })
1642
- )
1643
- ),
1644
-
1645
- // Type-safe error handling
1646
- Effect.catchTag('UnauthorizedError', () =>
1647
- Effect.sync(() => {
1648
- toast({
1649
- title: 'Unauthorized',
1650
- description: 'Please sign in to purchase tokens',
1651
- variant: 'destructive',
1652
- });
1653
- window.location.href = '/signin';
1654
- return { success: false as const };
1655
- })
1656
- ),
1657
-
1658
- Effect.catchTag('TokenPurchaseError', (error) =>
1659
- Effect.sync(() => {
1660
- toast({
1661
- title: 'Purchase Failed',
1662
- description: error.message,
1663
- variant: 'destructive',
1664
- });
1665
- return { success: false as const };
1666
- })
1667
- ),
1668
-
1669
- Effect.catchTag('NetworkError', (error) =>
1670
- Effect.sync(() => {
1671
- toast({
1672
- title: 'Network Error',
1673
- description: 'Please check your connection and try again',
1674
- variant: 'destructive',
1675
- });
1676
- return { success: false as const };
1677
- })
1678
- ),
1679
-
1680
- Effect.catchTag('TimeoutException', () =>
1681
- Effect.sync(() => {
1682
- toast({
1683
- title: 'Request Timeout',
1684
- description: 'Purchase took too long, please try again',
1685
- variant: 'destructive',
1686
- });
1687
- return { success: false as const };
1688
- })
1689
- )
1690
- )
1691
- );
1692
-
1693
- setLoading(false);
1694
-
1695
- // Convex subscription automatically updates balance in real-time!
1696
- };
1697
-
1698
- if (!token) return <div>Loading...</div>;
1699
-
1700
- return (
1701
- <div className="space-y-4">
1702
- <h2 className="text-2xl font-bold">{token.name}</h2>
1703
- <p className="text-muted-foreground">
1704
- Price: ${token.properties.price}
1705
- </p>
1706
-
1707
- {/* Real-time balance via Convex subscription */}
1708
- <p className="text-sm text-muted-foreground">
1709
- Your balance: {token.properties.balance || 0} tokens
1710
- </p>
1711
-
1712
- <Button onClick={() => handlePurchase(100)} disabled={loading}>
1713
- {loading ? 'Processing...' : 'Buy 100 Tokens'}
1714
- </Button>
1715
- </div>
1716
- );
1717
- }
1718
- ```
1719
-
1720
- **Key Benefits of Triple Integration:**
1721
-
1722
- 1. **Real-Time Data** - Convex hooks provide live subscriptions (balance updates automatically)
1723
- 2. **Type-Safe Errors** - Effect.ts client catches all error types with `catchTag`
1724
- 3. **Automatic Retry** - Effect retries network failures with exponential backoff
1725
- 4. **Timeout Protection** - Effect prevents hanging requests
1726
- 5. **Composable Logic** - Effect programs combine cleanly
1727
- 6. **Better UX** - User sees optimistic updates + error messages
1728
-
1729
- For complete Effect.ts client patterns, see **[effect.md](../connections/effect.md)**.
1730
-
1731
- ### 11. Environment Variables
1732
-
1733
- #### Hono API (`.dev.vars` / Cloudflare Workers settings)
1734
-
1735
- ```bash
1736
- # Better Auth
1737
- BETTER_AUTH_URL=http://localhost:8787
1738
- BETTER_AUTH_SECRET=your-secret-key
1739
-
1740
- # Convex
1741
- CONVEX_URL=https://xxx.convex.cloud
1742
- CONVEX_DEPLOY_KEY=xxx
1743
-
1744
- # OAuth (optional)
1745
- GITHUB_CLIENT_ID=xxx
1746
- GITHUB_CLIENT_SECRET=xxx
1747
- GOOGLE_CLIENT_ID=xxx
1748
- GOOGLE_CLIENT_SECRET=xxx
1749
- ```
1750
-
1751
- #### Astro Frontend (`.env`)
1752
-
1753
- ```bash
1754
- # Public URLs
1755
- PUBLIC_API_URL=http://localhost:8787
1756
- PUBLIC_CONVEX_URL=https://xxx.convex.cloud
1757
- ```
1758
-
1759
- ## Development Workflow
1760
-
1761
- ### Terminal Setup
1762
-
1763
- ```bash
1764
- # Terminal 1: Hono API
1765
- cd api
1766
- bun run dev # Runs on localhost:8787
1767
-
1768
- # Terminal 2: Convex backend
1769
- npx convex dev # Runs Convex functions locally
1770
-
1771
- # Terminal 3: Astro frontend
1772
- cd ..
1773
- bun run dev # Runs on localhost:4321
1774
- ```
1775
-
1776
- ### "Vibe Code" Workflow
1777
-
1778
- ```
1779
- 1. User designs UI mockup
1780
- 2. User writes React component with Convex hooks
1781
- 3. Component shows real-time data (no backend changes!)
1782
- 4. User deploys frontend to Cloudflare Pages
1783
- 5. Done! ✅
1784
- ```
1785
-
1786
- **Example: Building a dashboard page**
1787
-
1788
- ```astro
1789
- ---
1790
- // src/pages/dashboard.astro
1791
- import CreatorStats from '@/components/dashboard/CreatorStats';
1792
- ---
1793
-
1794
- <Layout>
1795
- <div class="container py-8">
1796
- <h1>Dashboard</h1>
1797
-
1798
- {/* Real-time stats with Convex hooks - zero backend code! */}
1799
- <CreatorStats client:load />
1800
- </div>
1801
- </Layout>
1802
- ```
1803
-
1804
- ```typescript
1805
- // src/components/dashboard/CreatorStats.tsx
1806
- import { useQuery } from 'convex/react';
1807
- import { api } from '@/convex/_generated/api';
1808
-
1809
- export function CreatorStats() {
1810
- // Real-time data - updates automatically!
1811
- const stats = useQuery(api.queries.dashboard.getStats);
1812
-
1813
- return (
1814
- <div className="grid grid-cols-3 gap-4">
1815
- <Card>
1816
- <CardTitle>Revenue</CardTitle>
1817
- <CardContent>${stats?.revenue || 0}</CardContent>
1818
- </Card>
1819
- {/* More cards... */}
1820
- </div>
1821
- );
1822
- }
1823
- ```
1824
-
1825
- ## When to Use Hono API vs Convex Direct
1826
-
1827
- ### Use Hono API For:
1828
-
1829
- - **Authentication**: Login, signup, password reset, OAuth
1830
- - **Business Logic**: Token purchases, payment processing, complex workflows
1831
- - **External APIs**: Stripe, Resend, third-party services
1832
- - **Heavy Computation**: Data aggregation, report generation
1833
- - **Rate Limiting**: API throttling, abuse prevention
1834
- - **REST API Contracts**: External integrations, mobile apps
1835
-
1836
- ### Use Convex Direct For:
1837
-
1838
- - **Real-time Updates**: Live data, subscriptions, WebSocket-like behavior
1839
- - **Simple Queries**: Fetching entities, connections, events
1840
- - **Client-Side Logic**: Filtering, sorting, pagination
1841
- - **Optimistic Updates**: Instant UI feedback
1842
- - **Dashboard Data**: Live metrics, analytics
1843
-
1844
- ### Example: Token Purchase Flow
1845
-
1846
- ```
1847
- User clicks "Buy Tokens"
1848
- ↓
1849
- Component calls Hono API (POST /api/tokens/purchase)
1850
- ↓
1851
- Hono validates session (Better Auth)
1852
- ↓
1853
- Effect.ts service processes business logic
1854
- ↓
1855
- Service calls Convex mutation to update balance
1856
- ↓
1857
- Convex updates entities table
1858
- ↓
1859
- Convex real-time subscription pushes update to UI
1860
- ↓
1861
- Component re-renders with new balance ✅
1862
- ```
1863
-
1864
- ## Deployment
1865
-
1866
- ### Production Architecture
1867
-
1868
- ```
1869
- ┌────────────────────────────────────────┐
1870
- │ Cloudflare Pages (Astro Frontend) │
1871
- │ https://oneie.pages.dev │
1872
- └──────────────┬─────────────────────────┘
1873
- │ HTTPS
1874
- ▼
1875
- ┌────────────────────────────────────────┐
1876
- │ Cloudflare Workers (Hono API) │
1877
- │ https://api.oneieworkers.dev │
1878
- └──────────────┬─────────────────────────┘
1879
- │ HTTPS
1880
- ▼
1881
- ┌────────────────────────────────────────┐
1882
- │ Convex Cloud (Database + Functions) │
1883
- │ https://xxx.convex.cloud │
1884
- └────────────────────────────────────────┘
1885
- ```
1886
-
1887
- ### Deploy Commands
1888
-
1889
- ```bash
1890
- # 1. Deploy Convex functions
1891
- npx convex deploy
1892
-
1893
- # 2. Deploy Hono API to Cloudflare Workers
1894
- cd api
1895
- wrangler deploy
1896
-
1897
- # 3. Deploy Astro frontend to Cloudflare Pages
1898
- cd ..
1899
- bun run build
1900
- wrangler pages deploy dist --project-name=one-platform
1901
- ```
1902
-
1903
- ## Migration Strategy
1904
-
1905
- ### Phase 1: Add Hono API (Parallel)
1906
-
1907
- - Create `api/` directory
1908
- - Set up Hono with Better Auth + Convex adapter
1909
- - Keep existing Astro auth working
1910
- - Deploy Hono API to Workers
1911
- - Test API endpoints independently
1912
-
1913
- ### Phase 2: Migrate Authentication
1914
-
1915
- - Update Astro to use Hono API for auth
1916
- - Migrate Better Auth logic from Astro to Hono
1917
- - Update all auth-related components
1918
- - Test session management across both systems
1919
-
1920
- ### Phase 3: Extract Business Logic
1921
-
1922
- - Move token purchase logic to Hono routes + Effect.ts
1923
- - Move agent creation to Hono routes + Effect.ts
1924
- - Move content creation to Hono routes + Effect.ts
1925
- - Keep Convex for data layer + real-time subscriptions
1926
-
1927
- ### Phase 4: Optimize Frontend
1928
-
1929
- - Remove server-side business logic from Astro
1930
- - Use API client for all mutations/actions
1931
- - Use Convex hooks for real-time data
1932
- - Deploy as static site to Pages (if desired)
1933
-
1934
- ### Phase 5: Multi-Tenant Support
1935
-
1936
- - Add org-specific API keys
1937
- - Enable frontend customization per org
1938
- - Deploy custom frontends to subdomains
1939
- - Share same Hono API + Convex backend
1940
-
1941
- ## Integration with 6-Dimension Ontology
1942
-
1943
- The Hono API fully respects the ontology:
1944
-
1945
- ### Entities
1946
-
1947
- - Auth data (users, sessions, accounts) stored as entities
1948
- - All business objects (tokens, agents, content) are entities
1949
- - Hono routes operate on entities via Convex
1950
-
1951
- ### Connections
1952
-
1953
- - User → session connections (has_session)
1954
- - User → OAuth account connections (linked_account)
1955
- - User → token connections (holds_tokens)
1956
- - Creator → content connections (authored)
1957
-
1958
- ### Events
1959
-
1960
- - Every API call logs an event
1961
- - Auth events: sign_in, sign_up, sign_out
1962
- - Business events: tokens_purchased, agent_created, content_published
1963
- - Events enable audit trails and analytics
1964
-
1965
- ### Tags
1966
-
1967
- - Entities can be tagged via API
1968
- - Tags enable categorization and filtering
1969
- - Query entities by tags
1970
-
1971
- ## Benefits Summary
1972
-
1973
- 1. **Single Database**: All data (including auth) in Convex - no external DB needed
1974
- 2. **Type Safety**: End-to-end TypeScript from frontend → Hono → Effect.ts → Convex
1975
- 3. **Real-Time**: Convex subscriptions for live updates
1976
- 4. **Functional**: Pure Effect.ts services with explicit error handling
1977
- 5. **Separation**: API backend vs frontend - deploy independently
1978
- 6. **Multi-Tenant**: Custom frontends sharing backend
1979
- 7. **Vibe Code**: Rapid frontend development with Convex hooks
1980
- 8. **Performance**: Edge SSR on Cloudflare Workers
1981
- 9. **Security**: Better Auth session management
1982
- 10. **Scalability**: Independent scaling of frontend, API, and database
1983
-
1984
- ## Next Steps
1985
-
1986
- 1. Create `api/` directory for Hono backend
1987
- 2. Implement Better Auth with Convex adapter
1988
- 3. Create Convex auth mutations/queries (entities table)
1989
- 4. Set up ConvexService integration layer
1990
- 5. Implement Effect.ts business logic services
1991
- 6. Create Hono API routes
1992
- 7. Build Astro API client (`src/lib/api.ts`)
1993
- 8. Update React components to use dual integration
1994
- 9. Test authentication flow end-to-end
1995
- 10. Deploy to Cloudflare Workers + Pages
1996
-
1997
- **Result:** A clean, scalable architecture where users can rapidly customize frontends while the platform team maintains a robust, shared backend powered by Convex + Effect.ts.
1998
-
1999
- ---
2000
-
2001
- ## Decision Guide: Which Approach to Use?
2002
-
2003
- ### Choose Convex-Native When:
2004
-
2005
- ✅ **Simple Single-Tenant App**
2006
- - You're building one application for one organization
2007
- - Don't need multiple custom frontends
2008
- - Want fastest development velocity
2009
-
2010
- ✅ **MVP or Prototype**
2011
- - Need to validate idea quickly
2012
- - Minimum infrastructure complexity
2013
- - Can iterate rapidly
2014
-
2015
- ✅ **Small Team**
2016
- - 1-5 developers
2017
- - Everyone works on full-stack features
2018
- - Don't need strict frontend/backend separation
2019
-
2020
- ✅ **Direct Convex Access is Critical**
2021
- - Need real-time subscriptions in API routes
2022
- - Want to avoid HTTP overhead
2023
- - Leveraging Convex-specific features
2024
-
2025
- **Example Use Cases:**
2026
- - SaaS dashboard for single company
2027
- - Internal tools
2028
- - Rapid prototypes
2029
- - Blog with custom API endpoints
2030
-
2031
- ### Choose Separate API When:
2032
-
2033
- ✅ **Multi-Tenant Platform**
2034
- - Different organizations need custom frontends
2035
- - Shared backend across tenants
2036
- - White-label solutions
2037
-
2038
- ✅ **Large Team**
2039
- - 10+ developers
2040
- - Clear frontend/backend team split
2041
- - Need independent deployment cycles
2042
-
2043
- ✅ **Multi-Client Architecture**
2044
- - API serves web, mobile, desktop
2045
- - Third-party integrations
2046
- - Public API for external developers
2047
-
2048
- ✅ **Complex Business Logic**
2049
- - Need Effect.ts services everywhere
2050
- - External API integrations (Stripe, OpenAI, etc.)
2051
- - Advanced error handling and retry logic
2052
-
2053
- **Example Use Cases:**
2054
- - Creator economy platform (ONE)
2055
- - E-commerce with mobile app
2056
- - API-first products
2057
- - Enterprise SaaS with customization
2058
-
2059
- ### Hybrid Approach (Advanced)
2060
-
2061
- You can use **both** approaches together:
2062
-
2063
- ```
2064
- Convex-Native (convex/http.ts):
2065
- ├─ Internal admin endpoints
2066
- ├─ Webhooks from external services
2067
- └─ Simple read-only APIs
2068
-
2069
- Separate API (Cloudflare Workers):
2070
- ├─ Public-facing REST API
2071
- ├─ Complex business logic (Effect.ts)
2072
- └─ Multi-tenant routing
2073
- ```
2074
-
2075
- **Benefits:**
2076
- - Simple endpoints stay in Convex (less overhead)
2077
- - Complex logic in separate API (better separation)
2078
- - Best of both worlds
2079
-
2080
- **Trade-offs:**
2081
- - More complexity to manage
2082
- - Two deployment processes
2083
- - Documentation overhead
2084
-
2085
- ### Migration Path
2086
-
2087
- **Start with Convex-Native → Move to Separate API:**
2088
-
2089
- 1. **Phase 1:** Build MVP with Convex-Native
2090
- 2. **Phase 2:** Extract business logic to Effect.ts services
2091
- 3. **Phase 3:** Move services to separate Hono API on Workers
2092
- 4. **Phase 4:** Keep simple endpoints in Convex, complex in Workers
2093
-
2094
- **This is the recommended path for most projects.**
2095
-
2096
- ---
2097
-
2098
- ## Summary
2099
-
2100
- **Convex-Native:**
2101
- - ✅ Official Convex pattern
2102
- - ✅ Simplest deployment
2103
- - ✅ Direct Convex access
2104
- - ❌ Limited multi-tenancy
2105
- - ❌ Harder to separate teams
2106
-
2107
- **Separate API:**
2108
- - ✅ Multi-tenant support
2109
- - ✅ Team separation
2110
- - ✅ API reusability
2111
- - ❌ More infrastructure
2112
- - ❌ HTTP overhead to Convex
2113
-
2114
- **Both approaches use:**
2115
- - Hono for routing
2116
- - Convex for data storage (6-dimension ontology)
2117
- - Effect.ts for business logic (optional but recommended)
2118
- - Type-safe validation (Zod)
2119
- - CORS middleware
2120
-
2121
- **Official Resources:**
2122
- - [Hono with Convex](https://stack.convex.dev/hono-with-convex) - Convex Stack guide
2123
- - [convex-helpers](https://stack.convex.dev/convex-helpers) - Helper library
2124
- - [Hono Documentation](https://hono.dev/) - Hono framework
2125
- - [Effect.ts Documentation](https://effect.website/) - Functional programming
2126
-
2127
- Choose the approach that matches your team size, architecture needs, and deployment preferences. When in doubt, **start with Convex-Native** and migrate to Separate API when you need multi-tenancy or team separation.