oneie 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +534 -0
  3. package/one/.obsidian/app.json +1 -0
  4. package/one/.obsidian/appearance.json +1 -0
  5. package/one/.obsidian/core-plugins.json +33 -0
  6. package/one/.obsidian/workspace.json +211 -0
  7. package/one/connections/a2a.md +551 -0
  8. package/one/connections/acp.md +761 -0
  9. package/one/connections/acps.md +731 -0
  10. package/one/connections/agui.md +767 -0
  11. package/one/connections/any-backend.md +1702 -0
  12. package/one/connections/ap2.md +998 -0
  13. package/one/connections/api-docs.md +1891 -0
  14. package/one/connections/api.md +2190 -0
  15. package/one/connections/architecture-diagram.md +94 -0
  16. package/one/connections/communications.md +449 -0
  17. package/one/connections/connections.md +339 -0
  18. package/one/connections/cryptonetworks.md +781 -0
  19. package/one/connections/documentation.md +1120 -0
  20. package/one/connections/effect.md +279 -0
  21. package/one/connections/elizaos.md +1290 -0
  22. package/one/connections/inference.md +58 -0
  23. package/one/connections/kyc.md +632 -0
  24. package/one/connections/mcp.md +842 -0
  25. package/one/connections/membership.md +1152 -0
  26. package/one/connections/middleware.md +1067 -0
  27. package/one/connections/multitenant.md +1341 -0
  28. package/one/connections/n8n.md +1015 -0
  29. package/one/connections/patterns.md +89 -0
  30. package/one/connections/protocols.md +279 -0
  31. package/one/connections/relationships.md +107 -0
  32. package/one/connections/schema.md +587 -0
  33. package/one/connections/service-layer.md +550 -0
  34. package/one/connections/structure.md +0 -0
  35. package/one/connections/vectors.md +207 -0
  36. package/one/connections/wordpress.md +1302 -0
  37. package/one/connections/workflow-copy.md +905 -0
  38. package/one/connections/workflow-examples.md +741 -0
  39. package/one/connections/workflow.md +905 -0
  40. package/one/connections/workflows/delegation.md +885 -0
  41. package/one/connections/workflows/frontend.md +1037 -0
  42. package/one/connections/workflows/strategy.md +903 -0
  43. package/one/connections/workflows/tasks.md +698 -0
  44. package/one/connections/x402.md +1249 -0
  45. package/one/events/events.md +545 -0
  46. package/one/knowledge/ai-platform.md +305 -0
  47. package/one/knowledge/architecture-diagram.md +94 -0
  48. package/one/knowledge/architecture-frontend.md +930 -0
  49. package/one/knowledge/architecture.md +2077 -0
  50. package/one/knowledge/crypto.md +960 -0
  51. package/one/knowledge/dsl.md +1660 -0
  52. package/one/knowledge/files.md +2471 -0
  53. package/one/knowledge/frontend.md +1038 -0
  54. package/one/knowledge/hono.md +2109 -0
  55. package/one/knowledge/implementation-examples.md +2536 -0
  56. package/one/knowledge/inference-score.md +159 -0
  57. package/one/knowledge/knowledge.md +642 -0
  58. package/one/knowledge/language.md +980 -0
  59. package/one/knowledge/lessons-learned.md +70 -0
  60. package/one/knowledge/ontology-6-dimensions.md +0 -0
  61. package/one/knowledge/ontology-documentation.md +356 -0
  62. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  63. package/one/knowledge/ontology-engineering.md +1652 -0
  64. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  65. package/one/knowledge/ontology-frontend-copy.md +753 -0
  66. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  67. package/one/knowledge/ontology-frontend.md +2427 -0
  68. package/one/knowledge/ontology-minimal.yaml +299 -0
  69. package/one/knowledge/ontology.md +2819 -0
  70. package/one/knowledge/ontology.yaml +1165 -0
  71. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  72. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  73. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  74. package/one/knowledge/patterns/backend/query-template.md +267 -0
  75. package/one/knowledge/patterns/backend/service-template.md +237 -0
  76. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  77. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  78. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  79. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  80. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  81. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  82. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  83. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  84. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  85. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  86. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  87. package/one/knowledge/quality-loop.md +401 -0
  88. package/one/knowledge/readme.md +131 -0
  89. package/one/knowledge/rules.md +626 -0
  90. package/one/knowledge/score.md +67 -0
  91. package/one/knowledge/specifications.md +855 -0
  92. package/one/knowledge/tags.md +130 -0
  93. package/one/organisation/one.md +599 -0
  94. package/one/organisation/organisation.md +438 -0
  95. package/one/organisation/revenue.md +673 -0
  96. package/one/organisation/strategy.md +869 -0
  97. package/one/organisation/vision.md +98 -0
  98. package/one/people/anthony-o-connell.md +440 -0
  99. package/one/people/people.md +567 -0
  100. package/one/repomix-output.md +92634 -0
  101. package/one/things/agentkit.md +349 -0
  102. package/one/things/agents/agent-backend.md +1401 -0
  103. package/one/things/agents/agent-builder.md +955 -0
  104. package/one/things/agents/agent-clean.md +709 -0
  105. package/one/things/agents/agent-clone.md +1341 -0
  106. package/one/things/agents/agent-designer.md +2177 -0
  107. package/one/things/agents/agent-director.md +1508 -0
  108. package/one/things/agents/agent-documenter.md +1049 -0
  109. package/one/things/agents/agent-frontend.md +1119 -0
  110. package/one/things/agents/agent-integrator.md +1192 -0
  111. package/one/things/agents/agent-problem-solver.md +1379 -0
  112. package/one/things/agents/agent-quality.md +1353 -0
  113. package/one/things/agents/agent-sales.md +986 -0
  114. package/one/things/cascade/cascade.yaml +464 -0
  115. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  116. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  117. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  118. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  119. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  120. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  121. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  122. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  123. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  124. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  125. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  126. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  127. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  128. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  129. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  130. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  131. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  132. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  133. package/one/things/cascade/docs/examples/readme.md +222 -0
  134. package/one/things/cascade/docs/getting-started.md +515 -0
  135. package/one/things/cascade/docs/workflow.md +1372 -0
  136. package/one/things/cascade/readme.md +336 -0
  137. package/one/things/cascade/templates/feature-template.md +267 -0
  138. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  139. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  140. package/one/things/claude/agents/analyst.md +483 -0
  141. package/one/things/claude/agents/architect.md +480 -0
  142. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  143. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  144. package/one/things/claude/agents/builder-repo.md +489 -0
  145. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  146. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  147. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  148. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  149. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  150. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  151. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  152. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  153. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  154. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  155. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  156. package/one/things/claude/agents/content-formatter.md +546 -0
  157. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  158. package/one/things/claude/agents/content-image-formatter.md +535 -0
  159. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  160. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  161. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  162. package/one/things/claude/agents/content-team-manager.md +622 -0
  163. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  164. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  165. package/one/things/claude/agents/core-manager.md +582 -0
  166. package/one/things/claude/agents/core-master.md +403 -0
  167. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  168. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  169. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  170. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  171. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  172. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  173. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  174. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  175. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  176. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  177. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  178. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  179. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  180. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  181. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  182. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  183. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  184. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  185. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  186. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  187. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  188. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  189. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  190. package/one/things/claude/agents/customer-success-manager.md +581 -0
  191. package/one/things/claude/agents/dev.md +413 -0
  192. package/one/things/claude/agents/documenter.md +546 -0
  193. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  194. package/one/things/claude/agents/engagement-specialist.md +509 -0
  195. package/one/things/claude/agents/engineering-architect.md +387 -0
  196. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  197. package/one/things/claude/agents/engineering-developer.md +387 -0
  198. package/one/things/claude/agents/engineering-director.md +282 -0
  199. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  200. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  201. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  202. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  203. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  204. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  205. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  206. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  207. package/one/things/claude/agents/improver.md +763 -0
  208. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  209. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  210. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  211. package/one/things/claude/agents/market-research-analyst.md +412 -0
  212. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  213. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  214. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  215. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  216. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  217. package/one/things/claude/agents/marketing-director.md +397 -0
  218. package/one/things/claude/agents/marketing-engagement.md +326 -0
  219. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  220. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  221. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  222. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  223. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  224. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  225. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  226. package/one/things/claude/agents/mission-commander.md +373 -0
  227. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  228. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  229. package/one/things/claude/agents/npx.md +890 -0
  230. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  231. package/one/things/claude/agents/one-master.md +355 -0
  232. package/one/things/claude/agents/one-orchestrator.md +315 -0
  233. package/one/things/claude/agents/one.md +601 -0
  234. package/one/things/claude/agents/playbook-generator.md +503 -0
  235. package/one/things/claude/agents/pm.md +326 -0
  236. package/one/things/claude/agents/po.md +345 -0
  237. package/one/things/claude/agents/qa.md +336 -0
  238. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  239. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  240. package/one/things/claude/agents/research-market-analyst.md +307 -0
  241. package/one/things/claude/agents/research-team-manager.md +482 -0
  242. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  243. package/one/things/claude/agents/sales-team-manager.md +400 -0
  244. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  245. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  246. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  247. package/one/things/claude/agents/service-success-manager.md +307 -0
  248. package/one/things/claude/agents/service-team-manager.md +400 -0
  249. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  250. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  251. package/one/things/claude/agents/sm.md +327 -0
  252. package/one/things/claude/agents/story-teller.md +473 -0
  253. package/one/things/claude/agents/task-master.md +596 -0
  254. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  255. package/one/things/claude/agents/tester.md +556 -0
  256. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  257. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  258. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  259. package/one/things/claude/agents/upsell-strategist.md +480 -0
  260. package/one/things/claude/agents/ux-expert.md +335 -0
  261. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  262. package/one/things/claude/claude-code-hooks-development.json +21 -0
  263. package/one/things/claude/claude-code-hooks-production.json +21 -0
  264. package/one/things/claude/claude-code-hooks.json +25 -0
  265. package/one/things/claude/commands/agent.md +104 -0
  266. package/one/things/claude/commands/cascade-status.md +128 -0
  267. package/one/things/claude/commands/ingest.md +290 -0
  268. package/one/things/claude/commands/ingestor.md +136 -0
  269. package/one/things/claude/commands/mission.md +83 -0
  270. package/one/things/claude/commands/npx.md +133 -0
  271. package/one/things/claude/commands/one.md +440 -0
  272. package/one/things/claude/commands/quality-check.md +204 -0
  273. package/one/things/claude/commands/smart-route.md +220 -0
  274. package/one/things/claude/commands/start.md +121 -0
  275. package/one/things/claude/commands/story.md +83 -0
  276. package/one/things/claude/commands/task.md +173 -0
  277. package/one/things/claude/hook-bypass.json +32 -0
  278. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  279. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  280. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  281. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  282. package/one/things/claude/hooks/build-hook.sh +156 -0
  283. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  284. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  285. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  286. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  287. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  288. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  289. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  290. package/one/things/claude/hooks/format-hook.sh +43 -0
  291. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  292. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  293. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  294. package/one/things/claude/hooks/hook-logger.sh +89 -0
  295. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  296. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  297. package/one/things/claude/hooks/lint-hook.sh +140 -0
  298. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  299. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  300. package/one/things/claude/hooks/notification-hook.sh +204 -0
  301. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  302. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  303. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  304. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  305. package/one/things/claude/hooks/performance-metrics.json +25 -0
  306. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  307. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  308. package/one/things/claude/hooks/security-hook.sh +256 -0
  309. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  310. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  311. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  312. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  313. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  314. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  315. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  316. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  317. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  318. package/one/things/claude/hooks/test-hook.sh +145 -0
  319. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  320. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  321. package/one/things/claude/settings-local.json +86 -0
  322. package/one/things/cli-code.md +652 -0
  323. package/one/things/cli-compiler-code.md +652 -0
  324. package/one/things/cli.md +1045 -0
  325. package/one/things/components/card-shadcn.md +929 -0
  326. package/one/things/components/card.md +1050 -0
  327. package/one/things/components.md +1669 -0
  328. package/one/things/componets.md +4 -0
  329. package/one/things/copilotkit.md +1559 -0
  330. package/one/things/creator-diagram.md +166 -0
  331. package/one/things/examples/children/lemonade-stand.md +366 -0
  332. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  333. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  334. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  335. package/one/things/features/1-1-agent-prompts.md +486 -0
  336. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  337. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  338. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  339. package/one/things/features/1-3-event-coordination/design.md +544 -0
  340. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  341. package/one/things/features/1-3-event-coordination.md +508 -0
  342. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  343. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  344. package/one/things/features/1-4-knowledge-management.md +577 -0
  345. package/one/things/features/1-5-quality-loops/design.md +797 -0
  346. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  347. package/one/things/features/1-5-quality-loops.md +641 -0
  348. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  349. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  350. package/one/things/features/1-6-numbering-structure.md +575 -0
  351. package/one/things/features/2-cli.md +1235 -0
  352. package/one/things/features/use-one-backend.md +1180 -0
  353. package/one/things/ideas/1-create-workflow.md +189 -0
  354. package/one/things/plans/1-create-workflow-status.md +555 -0
  355. package/one/things/plans/1-create-workflow.md +713 -0
  356. package/one/things/plans/app.md +761 -0
  357. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  358. package/one/things/plans/better-auth-any-backend.md +1852 -0
  359. package/one/things/plans/better-auth-available-features.md +235 -0
  360. package/one/things/plans/big-plan.md +38 -0
  361. package/one/things/plans/convex-better-auth.md +1109 -0
  362. package/one/things/plans/convex-on-off.md +389 -0
  363. package/one/things/plans/desktop.md +1121 -0
  364. package/one/things/plans/effect-components.md +1669 -0
  365. package/one/things/plans/effect.md +973 -0
  366. package/one/things/plans/email.md +953 -0
  367. package/one/things/plans/enhance-auth.md +1669 -0
  368. package/one/things/plans/install-components.md +198 -0
  369. package/one/things/plans/landing.md +728 -0
  370. package/one/things/plans/layout.md +205 -0
  371. package/one/things/plans/mail-backend.md +1308 -0
  372. package/one/things/plans/mail.md +2624 -0
  373. package/one/things/plans/next-features.md +83 -0
  374. package/one/things/plans/one.md +658 -0
  375. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  376. package/one/things/plans/ontology-driven-strategy.md +866 -0
  377. package/one/things/plans/ontology-ui-approach.md +357 -0
  378. package/one/things/plans/open-agent.md +785 -0
  379. package/one/things/plans/performace.md +90 -0
  380. package/one/things/plans/releases.md +809 -0
  381. package/one/things/plans/repos.md +76 -0
  382. package/one/things/plans/separate-copy-2.md +1293 -0
  383. package/one/things/plans/separate-copy-3.md +2458 -0
  384. package/one/things/plans/separate-copy.md +1293 -0
  385. package/one/things/plans/separate.md +1983 -0
  386. package/one/things/plans/shadcn-integration-summary.md +450 -0
  387. package/one/things/plans/sidebar.md +172 -0
  388. package/one/things/plans/small-fixes.md +5 -0
  389. package/one/things/plans/test-backend-connection.md +476 -0
  390. package/one/things/plans/workflow-files.md +1196 -0
  391. package/one/things/plans/workflow.md +1372 -0
  392. package/one/things/products/cascade-landing-page.md +737 -0
  393. package/one/things/products/cascade.md +1518 -0
  394. package/one/things/products/context-engineering.md +1427 -0
  395. package/one/things/products/onthology.md +0 -0
  396. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  397. package/one/things/products/ontology-ui.md +1387 -0
  398. package/one/things/products/ontology.md +717 -0
  399. package/one/things/products/sdk.md +557 -0
  400. package/one/things/promptkit.md +903 -0
  401. package/one/things/service-providers-new.md +982 -0
  402. package/one/things/service-providers.md +1092 -0
  403. package/one/things/things.md +349 -0
  404. package/one/things/todo.md +1248 -0
  405. package/package.json +5 -2
@@ -0,0 +1,1293 @@
1
+ # Frontend-Backend Separation Plan
2
+
3
+ ## Executive Summary
4
+
5
+ **Goal:** Transform the current tightly-coupled architecture into a fully headless, API-first architecture where:
6
+ - Frontend: Pure Astro/React UI (no Convex dependency)
7
+ - Backend: Hono API + Convex (standalone service)
8
+ - Connection: REST API with API key authentication
9
+
10
+ **Current State:** Frontend directly imports Convex hooks (`useQuery`, `useMutation`) and calls Convex functions.
11
+
12
+ **Target State:** Frontend only knows about REST API endpoints, authenticates with API keys, and has zero knowledge of Convex.
13
+
14
+ ---
15
+
16
+ ## Table of Contents
17
+
18
+ 1. [Architecture Comparison](#architecture-comparison)
19
+ 2. [Benefits of Separation](#benefits-of-separation)
20
+ 3. [Migration Strategy](#migration-strategy)
21
+ 4. [API Key Authentication](#api-key-authentication)
22
+ 5. [File Structure Changes](#file-structure-changes)
23
+ 6. [Implementation Steps](#implementation-steps)
24
+ 7. [Testing Strategy](#testing-strategy)
25
+ 8. [Deployment Changes](#deployment-changes)
26
+
27
+ ---
28
+
29
+ ## Architecture Comparison
30
+
31
+ ### Current Architecture (Coupled)
32
+
33
+ ```
34
+ ┌─────────────────────────────────────────────────────────┐
35
+ │ FRONTEND (Astro + React) │
36
+ │ ┌──────────────────────────────────────────────────┐ │
37
+ │ │ Pages & Components │ │
38
+ │ │ ├─ import { useQuery } from 'convex/react' │ │
39
+ │ │ ├─ import { api } from 'convex/_generated/api' │ │
40
+ │ │ └─ const data = useQuery(api.entities.get) │ │
41
+ │ └──────────────────────────────────────────────────┘ │
42
+ │ │
43
+ │ frontend/convex/* (schema, mutations, queries) │
44
+ │ ↓ Direct WebSocket Connection │
45
+ └─────────────────────────────────────────────────────────┘
46
+ │
47
+ ▼
48
+ ┌───────────────────────┐
49
+ │ CONVEX BACKEND │
50
+ │ (Real-time DB) │
51
+ └───────────────────────┘
52
+ ```
53
+
54
+ **Problems:**
55
+ - ❌ Frontend tightly coupled to Convex
56
+ - ❌ Can't swap backend without rewriting frontend
57
+ - ❌ Hard to version API (breaking changes impact frontend immediately)
58
+ - ❌ No clear API boundary
59
+ - ❌ Can't reuse backend for mobile/desktop apps without Convex SDK
60
+ - ❌ Multi-tenancy requires each frontend to have own Convex deployment
61
+
62
+ ---
63
+
64
+ ### Target Architecture (Separated)
65
+
66
+ ```
67
+ ┌─────────────────────────────────────────────────────────┐
68
+ │ FRONTEND (Headless) │
69
+ │ ┌──────────────────────────────────────────────────┐ │
70
+ │ │ Pages & Components │ │
71
+ │ │ ├─ import { apiClient } from '@/lib/api' │ │
72
+ │ │ ├─ const data = await api.tokens.get(id) │ │
73
+ │ │ └─ No Convex imports! │ │
74
+ │ └──────────────────────────────────────────────────┘ │
75
+ │ │
76
+ │ HTTP Requests with API Key │
77
+ │ Authorization: Bearer sk_live_xxx │
78
+ └─────────────────────────────────────────────────────────┘
79
+ │
80
+ ↓ HTTPS/REST
81
+ ┌─────────────────────────────────────────────────────────┐
82
+ │ BACKEND API (Hono + Convex) │
83
+ │ ┌──────────────────────────────────────────────────┐ │
84
+ │ │ API Routes (Hono on Cloudflare Workers) │ │
85
+ │ │ /api/auth/* - Authentication │ │
86
+ │ │ /api/tokens/* - Token operations │ │
87
+ │ │ /api/agents/* - Agent management │ │
88
+ │ │ /api/content/*- Content CRUD │ │
89
+ │ └────────────────┬─────────────────────────────────┘ │
90
+ │ │ │
91
+ │ ┌────────────────┴─────────────────────────────────┐ │
92
+ │ │ Middleware │ │
93
+ │ │ ├─ API Key Validation │ │
94
+ │ │ ├─ Rate Limiting │ │
95
+ │ │ ├─ CORS │ │
96
+ │ │ └─ Request Logging │ │
97
+ │ └────────────────┬─────────────────────────────────┘ │
98
+ │ │ │
99
+ │ ┌────────────────┴─────────────────────────────────┐ │
100
+ │ │ Business Logic (Effect.ts Services) │ │
101
+ │ │ - TokenService, AgentService, etc. │ │
102
+ │ │ - Pure functional logic │ │
103
+ │ │ - Type-safe error handling │ │
104
+ │ └────────────────┬─────────────────────────────────┘ │
105
+ │ │ │
106
+ │ ┌────────────────┴─────────────────────────────────┐ │
107
+ │ │ Data Layer (ConvexHttpClient) │ │
108
+ │ │ - Queries/mutations via HTTP │ │
109
+ │ │ - 6-dimension ontology access │ │
110
+ │ └────────────────┬─────────────────────────────────┘ │
111
+ └───────────────────┼─────────────────────────────────────┘
112
+ │
113
+ ▼
114
+ ┌───────────────────────┐
115
+ │ CONVEX BACKEND │
116
+ │ - entities │
117
+ │ - connections │
118
+ │ - events │
119
+ │ - knowledge │
120
+ │ - API keys (stored) │
121
+ └───────────────────────┘
122
+ ```
123
+
124
+ **Benefits:**
125
+ - ✅ Frontend can be swapped/rebuilt independently
126
+ - ✅ Backend API can serve web, mobile, desktop, CLI
127
+ - ✅ Clear API versioning (/api/v1, /api/v2)
128
+ - ✅ API keys enable multi-tenancy (one backend, many frontends)
129
+ - ✅ Standard REST patterns (easy for any dev to understand)
130
+ - ✅ Can rate limit, monitor, version API independently
131
+
132
+ ---
133
+
134
+ ## Benefits of Separation
135
+
136
+ ### 1. Multi-Tenancy Support
137
+
138
+ **Before:**
139
+ ```
140
+ Org A → Frontend A → Convex Deployment A
141
+ Org B → Frontend B → Convex Deployment B
142
+ Org C → Frontend C → Convex Deployment C
143
+
144
+ ❌ 3 orgs = 3 Convex deployments (expensive, hard to manage)
145
+ ```
146
+
147
+ **After:**
148
+ ```
149
+ Org A → Frontend A ──┐
150
+ ├→ Single Backend API → Single Convex Deployment
151
+ Org B → Frontend B ──┤ (with API key isolation)
152
+ │
153
+ Org C → Frontend C ──┘
154
+
155
+ ✅ 3 orgs = 1 Convex deployment (cheap, centralized)
156
+ ```
157
+
158
+ ### 2. Platform Independence
159
+
160
+ **Before:**
161
+ - Web: Must use Convex React hooks
162
+ - Mobile: Must use Convex React Native SDK
163
+ - Desktop: Must use Convex Electron SDK
164
+ - CLI: Must use Convex Node SDK
165
+
166
+ ❌ Each platform needs Convex SDK
167
+
168
+ **After:**
169
+ - Web: HTTP fetch() or axios
170
+ - Mobile: HTTP client (works with any framework)
171
+ - Desktop: HTTP client (works with any framework)
172
+ - CLI: curl or HTTP client
173
+
174
+ ✅ Any platform that speaks HTTP works
175
+
176
+ ### 3. Team Organization
177
+
178
+ **Before:**
179
+ ```
180
+ Full-stack developer needs to know:
181
+ - Astro
182
+ - React
183
+ - Convex schema
184
+ - Convex queries/mutations
185
+ - Convex actions
186
+ - Effect.ts
187
+ - Business logic
188
+ ```
189
+
190
+ **After:**
191
+ ```
192
+ Frontend developer needs to know:
193
+ - Astro
194
+ - React
195
+ - API endpoints (documented)
196
+
197
+ Backend developer needs to know:
198
+ - Hono routes
199
+ - Effect.ts
200
+ - Convex schema
201
+ - Business logic
202
+ ```
203
+
204
+ ✅ Clear separation of concerns
205
+
206
+ ### 4. API Evolution
207
+
208
+ **Before:**
209
+ ```
210
+ Change Convex schema → Frontend breaks immediately
211
+ ❌ No versioning, no backwards compatibility
212
+ ```
213
+
214
+ **After:**
215
+ ```
216
+ /api/v1/tokens → Stable, never breaks
217
+ /api/v2/tokens → New version with improvements
218
+
219
+ Frontend chooses which version to use
220
+ ✅ Graceful deprecation, backwards compatible
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Migration Strategy
226
+
227
+ ### Phase 1: Backend API Creation (No Frontend Changes)
228
+
229
+ **Goal:** Build standalone Hono API that mirrors current Convex functions
230
+
231
+ **Tasks:**
232
+ 1. Create `/backend/api/` directory
233
+ 2. Implement Hono routes for all Convex queries/mutations
234
+ 3. Add API key authentication middleware
235
+ 4. Deploy to Cloudflare Workers
236
+ 5. Test all endpoints with Postman/curl
237
+
238
+ **Timeline:** 1-2 weeks
239
+
240
+ **Risk:** Low (frontend still works with Convex)
241
+
242
+ ---
243
+
244
+ ### Phase 2: Frontend API Client Library
245
+
246
+ **Goal:** Create abstraction layer in frontend that can switch between Convex and HTTP
247
+
248
+ **Tasks:**
249
+ 1. Create `/frontend/src/lib/api/client.ts`
250
+ 2. Implement API client with same interface as Convex hooks
251
+ 3. Add environment variable toggle: `USE_API_BACKEND=true/false`
252
+ 4. Test dual mode (frontend works with both)
253
+
254
+ **Timeline:** 1 week
255
+
256
+ **Risk:** Low (can toggle back to Convex if issues)
257
+
258
+ ---
259
+
260
+ ### Phase 3: Gradual Migration
261
+
262
+ **Goal:** Migrate frontend page by page from Convex hooks to API client
263
+
264
+ **Tasks:**
265
+ 1. Migrate `/blog` pages first (low risk)
266
+ 2. Migrate `/tokens` pages
267
+ 3. Migrate `/agents` pages
268
+ 4. Migrate authentication pages last (highest risk)
269
+
270
+ **Timeline:** 2-3 weeks
271
+
272
+ **Risk:** Medium (careful testing needed per page)
273
+
274
+ ---
275
+
276
+ ### Phase 4: Remove Convex from Frontend
277
+
278
+ **Goal:** Delete `frontend/convex/*` and all Convex dependencies
279
+
280
+ **Tasks:**
281
+ 1. Verify all pages use API client
282
+ 2. Remove Convex imports from `package.json`
283
+ 3. Delete `frontend/convex/` directory
284
+ 4. Update build process
285
+
286
+ **Timeline:** 1 week
287
+
288
+ **Risk:** Low (if Phase 3 done correctly)
289
+
290
+ ---
291
+
292
+ ## API Key Authentication
293
+
294
+ ### Key Types
295
+
296
+ **1. Secret Keys (Backend-to-Backend)**
297
+ ```
298
+ sk_live_1234567890abcdef
299
+ sk_test_1234567890abcdef
300
+ ```
301
+
302
+ **2. Publishable Keys (Frontend-Safe)**
303
+ ```
304
+ pk_live_1234567890abcdef
305
+ pk_test_1234567890abcdef
306
+ ```
307
+
308
+ ### Database Schema
309
+
310
+ **New Entity Type: `api_key`**
311
+
312
+ ```typescript
313
+ {
314
+ type: "api_key",
315
+ name: "Production API Key for Org A",
316
+ properties: {
317
+ keyPrefix: "sk_live", // or "sk_test", "pk_live", "pk_test"
318
+ keyHash: "sha256(...)", // Hashed key (never store plaintext!)
319
+ keyHint: "...def", // Last 3 chars for display
320
+ orgId: "org_123", // Which org owns this key
321
+ scopes: [ // What can this key do?
322
+ "tokens:read",
323
+ "tokens:write",
324
+ "agents:read",
325
+ "agents:write"
326
+ ],
327
+ rateLimit: {
328
+ requests: 1000, // Max requests per minute
329
+ period: 60 // Period in seconds
330
+ },
331
+ expiresAt: 1735689600000, // Optional expiration
332
+ lastUsedAt: null,
333
+ createdBy: "user_123",
334
+ environment: "production" // or "development"
335
+ },
336
+ status: "active", // or "revoked"
337
+ createdAt: 1704067200000,
338
+ updatedAt: 1704067200000
339
+ }
340
+ ```
341
+
342
+ ### Middleware Implementation
343
+
344
+ **Backend: API Key Validation Middleware**
345
+
346
+ ```typescript
347
+ // backend/api/middleware/auth.ts
348
+ import { Context, Next } from "hono";
349
+ import { createHash } from "crypto";
350
+ import { ConvexHttpClient } from "convex/browser";
351
+ import { api } from "convex/_generated/api";
352
+
353
+ export async function validateApiKey(c: Context, next: Next) {
354
+ // Extract API key from header
355
+ const authHeader = c.req.header("Authorization");
356
+
357
+ if (!authHeader || !authHeader.startsWith("Bearer ")) {
358
+ return c.json({ error: "Missing API key" }, 401);
359
+ }
360
+
361
+ const apiKey = authHeader.replace("Bearer ", "");
362
+
363
+ // Validate key format
364
+ if (!apiKey.match(/^(sk|pk)_(live|test)_[a-zA-Z0-9]{24}$/)) {
365
+ return c.json({ error: "Invalid API key format" }, 401);
366
+ }
367
+
368
+ // Hash the key
369
+ const keyHash = createHash("sha256").update(apiKey).digest("hex");
370
+
371
+ // Query Convex for matching key
372
+ const convex = new ConvexHttpClient(process.env.CONVEX_URL!);
373
+ const keyEntity = await convex.query(api.queries.apiKeys.validate, {
374
+ keyHash
375
+ });
376
+
377
+ if (!keyEntity) {
378
+ return c.json({ error: "Invalid API key" }, 401);
379
+ }
380
+
381
+ if (keyEntity.status !== "active") {
382
+ return c.json({ error: "API key revoked" }, 401);
383
+ }
384
+
385
+ // Check expiration
386
+ if (keyEntity.properties.expiresAt && Date.now() > keyEntity.properties.expiresAt) {
387
+ return c.json({ error: "API key expired" }, 401);
388
+ }
389
+
390
+ // Check scopes (if route requires specific scope)
391
+ const requiredScope = c.req.param("scope");
392
+ if (requiredScope && !keyEntity.properties.scopes.includes(requiredScope)) {
393
+ return c.json({ error: "Insufficient permissions" }, 403);
394
+ }
395
+
396
+ // Rate limiting check
397
+ const rateLimitKey = `rate_limit:${keyEntity._id}`;
398
+ const currentCount = await getRateLimitCount(rateLimitKey);
399
+
400
+ if (currentCount >= keyEntity.properties.rateLimit.requests) {
401
+ return c.json({ error: "Rate limit exceeded" }, 429);
402
+ }
403
+
404
+ // Increment rate limit counter
405
+ await incrementRateLimit(rateLimitKey, keyEntity.properties.rateLimit.period);
406
+
407
+ // Update last used timestamp (async, don't wait)
408
+ convex.mutation(api.mutations.apiKeys.updateLastUsed, {
409
+ keyId: keyEntity._id
410
+ }).catch(console.error);
411
+
412
+ // Attach org context to request
413
+ c.set("orgId", keyEntity.properties.orgId);
414
+ c.set("keyScopes", keyEntity.properties.scopes);
415
+ c.set("apiKeyId", keyEntity._id);
416
+
417
+ await next();
418
+ }
419
+ ```
420
+
421
+ **Frontend: API Client with Key**
422
+
423
+ ```typescript
424
+ // frontend/src/lib/api/client.ts
425
+ export class ApiClient {
426
+ private baseUrl: string;
427
+ private apiKey: string;
428
+
429
+ constructor(apiKey: string, baseUrl?: string) {
430
+ this.apiKey = apiKey;
431
+ this.baseUrl = baseUrl || import.meta.env.PUBLIC_API_URL;
432
+ }
433
+
434
+ private async request<T>(
435
+ endpoint: string,
436
+ options: RequestInit = {}
437
+ ): Promise<T> {
438
+ const url = `${this.baseUrl}${endpoint}`;
439
+
440
+ const response = await fetch(url, {
441
+ ...options,
442
+ headers: {
443
+ "Content-Type": "application/json",
444
+ "Authorization": `Bearer ${this.apiKey}`,
445
+ ...options.headers,
446
+ },
447
+ });
448
+
449
+ if (!response.ok) {
450
+ const error = await response.json();
451
+ throw new ApiError(error.error, response.status);
452
+ }
453
+
454
+ return response.json();
455
+ }
456
+
457
+ // Tokens API
458
+ tokens = {
459
+ get: (id: string) =>
460
+ this.request<Token>(`/api/v1/tokens/${id}`),
461
+
462
+ list: (params?: { orgId?: string; limit?: number }) =>
463
+ this.request<Token[]>(`/api/v1/tokens?${new URLSearchParams(params)}`),
464
+
465
+ create: (data: CreateTokenInput) =>
466
+ this.request<Token>("/api/v1/tokens", {
467
+ method: "POST",
468
+ body: JSON.stringify(data),
469
+ }),
470
+
471
+ purchase: (id: string, amount: number) =>
472
+ this.request<PurchaseResult>(`/api/v1/tokens/${id}/purchase`, {
473
+ method: "POST",
474
+ body: JSON.stringify({ amount }),
475
+ }),
476
+ };
477
+
478
+ // Agents API
479
+ agents = {
480
+ get: (id: string) =>
481
+ this.request<Agent>(`/api/v1/agents/${id}`),
482
+
483
+ list: () =>
484
+ this.request<Agent[]>("/api/v1/agents"),
485
+
486
+ create: (data: CreateAgentInput) =>
487
+ this.request<Agent>("/api/v1/agents", {
488
+ method: "POST",
489
+ body: JSON.stringify(data),
490
+ }),
491
+ };
492
+
493
+ // Add more resource methods...
494
+ }
495
+
496
+ // Export singleton with environment API key
497
+ export const api = new ApiClient(
498
+ import.meta.env.PUBLIC_API_KEY || ""
499
+ );
500
+ ```
501
+
502
+ **Usage in Frontend:**
503
+
504
+ ```astro
505
+ ---
506
+ // frontend/src/pages/tokens/[id].astro
507
+ import { api } from "@/lib/api/client";
508
+ import Layout from "@/layouts/Layout.astro";
509
+
510
+ const { id } = Astro.params;
511
+ const token = await api.tokens.get(id);
512
+ ---
513
+
514
+ <Layout title={token.name}>
515
+ <h1>{token.name}</h1>
516
+ <p>Balance: {token.properties.balance}</p>
517
+ </Layout>
518
+ ```
519
+
520
+ ---
521
+
522
+ ## File Structure Changes
523
+
524
+ ### Before (Coupled)
525
+
526
+ ```
527
+ frontend/
528
+ ├── convex/ # ❌ Remove entire directory
529
+ │ ├── _generated/
530
+ │ ├── mutations/
531
+ │ ├── queries/
532
+ │ ├── schema.ts
533
+ │ └── http.ts
534
+ ├── src/
535
+ │ ├── components/
536
+ │ │ └── TokenCard.tsx # Uses useQuery(api.tokens.get)
537
+ │ └── pages/
538
+ │ └── tokens/[id].astro # Uses ConvexHttpClient
539
+ └── package.json # Includes "convex": "^1.x.x"
540
+
541
+ backend/
542
+ └── convex/ # Only Convex deployment
543
+ ```
544
+
545
+ ### After (Separated)
546
+
547
+ ```
548
+ frontend/
549
+ ├── src/
550
+ │ ├── lib/
551
+ │ │ └── api/
552
+ │ │ ├── client.ts # ✅ API client (no Convex)
553
+ │ │ ├── types.ts # ✅ Type definitions
554
+ │ │ └── errors.ts # ✅ Error handling
555
+ │ ├── components/
556
+ │ │ └── TokenCard.tsx # ✅ Uses api.tokens.get()
557
+ │ └── pages/
558
+ │ └── tokens/[id].astro # ✅ Uses api.tokens.get()
559
+ ├── .env # PUBLIC_API_KEY=pk_live_xxx
560
+ └── package.json # ❌ No Convex dependency
561
+
562
+ backend/
563
+ ├── api/ # ✅ New Hono API
564
+ │ ├── routes/
565
+ │ │ ├── tokens.ts # /api/v1/tokens/*
566
+ │ │ ├── agents.ts # /api/v1/agents/*
567
+ │ │ ├── auth.ts # /api/v1/auth/*
568
+ │ │ └── index.ts # Route aggregation
569
+ │ ├── middleware/
570
+ │ │ ├── auth.ts # API key validation
571
+ │ │ ├── cors.ts # CORS handling
572
+ │ │ ├── rateLimit.ts # Rate limiting
573
+ │ │ └── logging.ts # Request logging
574
+ │ ├── services/ # Effect.ts business logic
575
+ │ │ ├── tokens/
576
+ │ │ ├── agents/
577
+ │ │ └── auth/
578
+ │ └── index.ts # Hono app entry point
579
+ ├── convex/ # Existing Convex backend
580
+ │ ├── queries/
581
+ │ │ └── apiKeys.ts # ✅ New: API key queries
582
+ │ ├── mutations/
583
+ │ │ └── apiKeys.ts # ✅ New: API key mutations
584
+ │ └── schema.ts # ✅ Add api_key entity type
585
+ └── wrangler.toml # Cloudflare Workers config
586
+ ```
587
+
588
+ ---
589
+
590
+ ## Implementation Steps
591
+
592
+ ### Step 1: Create API Key Entity Type
593
+
594
+ **File: `backend/convex/schema.ts`**
595
+
596
+ Add to existing schema:
597
+
598
+ ```typescript
599
+ export default defineSchema({
600
+ // ... existing entities table
601
+
602
+ entities: defineTable({
603
+ type: v.string(), // Add "api_key" as new type
604
+ name: v.string(),
605
+ properties: v.any(),
606
+ status: v.optional(v.union(
607
+ v.literal("active"),
608
+ v.literal("inactive"),
609
+ v.literal("draft"),
610
+ v.literal("published"),
611
+ v.literal("archived"),
612
+ v.literal("revoked"), // ✅ Add for API keys
613
+ )),
614
+ createdAt: v.number(),
615
+ updatedAt: v.number(),
616
+ deletedAt: v.optional(v.number()),
617
+ })
618
+ .index("by_type", ["type"])
619
+ .index("by_status", ["status"])
620
+ .index("by_key_hash", ["properties.keyHash"]), // ✅ Add for fast lookup
621
+
622
+ // ... rest of schema
623
+ });
624
+ ```
625
+
626
+ ### Step 2: Create API Key Queries
627
+
628
+ **File: `backend/convex/queries/apiKeys.ts`**
629
+
630
+ ```typescript
631
+ import { query } from "../_generated/server";
632
+ import { v } from "convex/values";
633
+
634
+ export const validate = query({
635
+ args: { keyHash: v.string() },
636
+ handler: async (ctx, args) => {
637
+ const apiKey = await ctx.db
638
+ .query("entities")
639
+ .withIndex("by_key_hash", (q) =>
640
+ q.eq("properties.keyHash", args.keyHash)
641
+ )
642
+ .filter((q) => q.eq(q.field("type"), "api_key"))
643
+ .first();
644
+
645
+ return apiKey;
646
+ },
647
+ });
648
+
649
+ export const listByOrg = query({
650
+ args: { orgId: v.string() },
651
+ handler: async (ctx, args) => {
652
+ const keys = await ctx.db
653
+ .query("entities")
654
+ .withIndex("by_type", (q) => q.eq("type", "api_key"))
655
+ .filter((q) => q.eq(q.field("properties.orgId"), args.orgId))
656
+ .collect();
657
+
658
+ // Don't return keyHash (security)
659
+ return keys.map(key => ({
660
+ ...key,
661
+ properties: {
662
+ ...key.properties,
663
+ keyHash: undefined, // Remove sensitive data
664
+ }
665
+ }));
666
+ },
667
+ });
668
+ ```
669
+
670
+ ### Step 3: Create API Key Mutations
671
+
672
+ **File: `backend/convex/mutations/apiKeys.ts`**
673
+
674
+ ```typescript
675
+ import { mutation } from "../_generated/server";
676
+ import { v } from "convex/values";
677
+ import { createHash, randomBytes } from "crypto";
678
+
679
+ export const create = mutation({
680
+ args: {
681
+ orgId: v.string(),
682
+ name: v.string(),
683
+ scopes: v.array(v.string()),
684
+ environment: v.union(v.literal("production"), v.literal("development")),
685
+ },
686
+ handler: async (ctx, args) => {
687
+ // Generate random API key
688
+ const prefix = args.environment === "production" ? "sk_live" : "sk_test";
689
+ const random = randomBytes(18).toString("base64url");
690
+ const apiKey = `${prefix}_${random}`;
691
+
692
+ // Hash the key for storage
693
+ const keyHash = createHash("sha256").update(apiKey).digest("hex");
694
+ const keyHint = apiKey.slice(-3);
695
+
696
+ // Create entity
697
+ const keyId = await ctx.db.insert("entities", {
698
+ type: "api_key",
699
+ name: args.name,
700
+ properties: {
701
+ keyPrefix: prefix,
702
+ keyHash,
703
+ keyHint,
704
+ orgId: args.orgId,
705
+ scopes: args.scopes,
706
+ rateLimit: {
707
+ requests: 1000,
708
+ period: 60,
709
+ },
710
+ environment: args.environment,
711
+ lastUsedAt: null,
712
+ },
713
+ status: "active",
714
+ createdAt: Date.now(),
715
+ updatedAt: Date.now(),
716
+ });
717
+
718
+ // Return plaintext key ONLY this once
719
+ return {
720
+ id: keyId,
721
+ apiKey, // ⚠️ Show user - never shown again!
722
+ keyHint,
723
+ };
724
+ },
725
+ });
726
+
727
+ export const revoke = mutation({
728
+ args: { keyId: v.id("entities") },
729
+ handler: async (ctx, args) => {
730
+ await ctx.db.patch(args.keyId, {
731
+ status: "revoked",
732
+ updatedAt: Date.now(),
733
+ });
734
+ },
735
+ });
736
+
737
+ export const updateLastUsed = mutation({
738
+ args: { keyId: v.id("entities") },
739
+ handler: async (ctx, args) => {
740
+ const key = await ctx.db.get(args.keyId);
741
+ if (!key) return;
742
+
743
+ await ctx.db.patch(args.keyId, {
744
+ properties: {
745
+ ...key.properties,
746
+ lastUsedAt: Date.now(),
747
+ },
748
+ updatedAt: Date.now(),
749
+ });
750
+ },
751
+ });
752
+ ```
753
+
754
+ ### Step 4: Create Hono API Backend
755
+
756
+ **File: `backend/api/index.ts`**
757
+
758
+ ```typescript
759
+ import { Hono } from "hono";
760
+ import { cors } from "hono/cors";
761
+ import { logger } from "hono/logger";
762
+ import { validateApiKey } from "./middleware/auth";
763
+ import tokensRoutes from "./routes/tokens";
764
+ import agentsRoutes from "./routes/agents";
765
+ import authRoutes from "./routes/auth";
766
+
767
+ const app = new Hono();
768
+
769
+ // Middleware
770
+ app.use("*", logger());
771
+ app.use("/api/*", cors({
772
+ origin: [
773
+ "http://localhost:4321",
774
+ "https://*.pages.dev",
775
+ process.env.FRONTEND_URL || "",
776
+ ].filter(Boolean),
777
+ credentials: true,
778
+ }));
779
+
780
+ // Health check (no auth required)
781
+ app.get("/health", (c) => c.json({ status: "ok" }));
782
+
783
+ // API routes (auth required)
784
+ app.use("/api/*", validateApiKey);
785
+ app.route("/api/v1/tokens", tokensRoutes);
786
+ app.route("/api/v1/agents", agentsRoutes);
787
+ app.route("/api/v1/auth", authRoutes);
788
+
789
+ // 404 handler
790
+ app.notFound((c) => c.json({ error: "Not found" }, 404));
791
+
792
+ // Error handler
793
+ app.onError((err, c) => {
794
+ console.error(err);
795
+ return c.json({ error: "Internal server error" }, 500);
796
+ });
797
+
798
+ export default app;
799
+ ```
800
+
801
+ **File: `backend/api/routes/tokens.ts`**
802
+
803
+ ```typescript
804
+ import { Hono } from "hono";
805
+ import { ConvexHttpClient } from "convex/browser";
806
+ import { api } from "../../convex/_generated/api";
807
+
808
+ const app = new Hono();
809
+ const convex = new ConvexHttpClient(process.env.CONVEX_URL!);
810
+
811
+ // GET /api/v1/tokens/:id
812
+ app.get("/:id", async (c) => {
813
+ const tokenId = c.req.param("id");
814
+ const orgId = c.get("orgId"); // From API key middleware
815
+
816
+ const token = await convex.query(api.queries.entities.get, { id: tokenId });
817
+
818
+ if (!token || token.type !== "token") {
819
+ return c.json({ error: "Token not found" }, 404);
820
+ }
821
+
822
+ // Check ownership
823
+ if (token.properties.orgId !== orgId) {
824
+ return c.json({ error: "Unauthorized" }, 403);
825
+ }
826
+
827
+ return c.json(token);
828
+ });
829
+
830
+ // POST /api/v1/tokens/:id/purchase
831
+ app.post("/:id/purchase", async (c) => {
832
+ const tokenId = c.req.param("id");
833
+ const { amount } = await c.req.json();
834
+ const orgId = c.get("orgId");
835
+
836
+ // Call Convex mutation
837
+ const result = await convex.mutation(api.mutations.tokens.purchase, {
838
+ tokenId,
839
+ amount,
840
+ orgId,
841
+ });
842
+
843
+ return c.json(result);
844
+ });
845
+
846
+ // Add more routes...
847
+
848
+ export default app;
849
+ ```
850
+
851
+ ### Step 5: Create Frontend API Client
852
+
853
+ **File: `frontend/src/lib/api/client.ts`**
854
+
855
+ ```typescript
856
+ export class ApiError extends Error {
857
+ constructor(message: string, public status: number) {
858
+ super(message);
859
+ this.name = "ApiError";
860
+ }
861
+ }
862
+
863
+ export class ApiClient {
864
+ private baseUrl: string;
865
+ private apiKey: string;
866
+
867
+ constructor(apiKey: string, baseUrl?: string) {
868
+ this.apiKey = apiKey;
869
+ this.baseUrl = baseUrl || import.meta.env.PUBLIC_API_URL;
870
+ }
871
+
872
+ private async request<T>(
873
+ endpoint: string,
874
+ options: RequestInit = {}
875
+ ): Promise<T> {
876
+ const url = `${this.baseUrl}${endpoint}`;
877
+
878
+ const response = await fetch(url, {
879
+ ...options,
880
+ headers: {
881
+ "Content-Type": "application/json",
882
+ "Authorization": `Bearer ${this.apiKey}`,
883
+ ...options.headers,
884
+ },
885
+ });
886
+
887
+ if (!response.ok) {
888
+ const error = await response.json();
889
+ throw new ApiError(error.error, response.status);
890
+ }
891
+
892
+ return response.json();
893
+ }
894
+
895
+ tokens = {
896
+ get: (id: string) =>
897
+ this.request<Token>(`/api/v1/tokens/${id}`),
898
+
899
+ purchase: (id: string, amount: number) =>
900
+ this.request<PurchaseResult>(`/api/v1/tokens/${id}/purchase`, {
901
+ method: "POST",
902
+ body: JSON.stringify({ amount }),
903
+ }),
904
+ };
905
+
906
+ agents = {
907
+ get: (id: string) =>
908
+ this.request<Agent>(`/api/v1/agents/${id}`),
909
+
910
+ list: () =>
911
+ this.request<Agent[]>("/api/v1/agents"),
912
+ };
913
+ }
914
+
915
+ // Singleton instance
916
+ export const api = new ApiClient(
917
+ import.meta.env.PUBLIC_API_KEY || ""
918
+ );
919
+ ```
920
+
921
+ ### Step 6: Update Frontend Pages
922
+
923
+ **Before:**
924
+
925
+ ```astro
926
+ ---
927
+ // frontend/src/pages/tokens/[id].astro
928
+ import { ConvexHttpClient } from "convex/browser";
929
+ import { api as convexApi } from "@/convex/_generated/api";
930
+
931
+ const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
932
+ const token = await convex.query(convexApi.entities.get, { id: Astro.params.id });
933
+ ---
934
+ ```
935
+
936
+ **After:**
937
+
938
+ ```astro
939
+ ---
940
+ // frontend/src/pages/tokens/[id].astro
941
+ import { api } from "@/lib/api/client";
942
+
943
+ const token = await api.tokens.get(Astro.params.id);
944
+ ---
945
+ ```
946
+
947
+ ### Step 7: Remove Convex from Frontend
948
+
949
+ **Delete:**
950
+ ```bash
951
+ rm -rf frontend/convex/
952
+ rm frontend/convex.config.ts
953
+ ```
954
+
955
+ **Update `package.json`:**
956
+ ```diff
957
+ {
958
+ "dependencies": {
959
+ - "convex": "^1.x.x",
960
+ - "@convex-dev/resend": "^x.x.x",
961
+ "astro": "^5.14.0"
962
+ }
963
+ }
964
+ ```
965
+
966
+ ---
967
+
968
+ ## Testing Strategy
969
+
970
+ ### 1. Backend API Tests
971
+
972
+ ```typescript
973
+ // backend/api/__tests__/tokens.test.ts
974
+ import { describe, it, expect } from "vitest";
975
+ import app from "../index";
976
+
977
+ describe("Tokens API", () => {
978
+ it("should require API key", async () => {
979
+ const res = await app.request("/api/v1/tokens/123");
980
+ expect(res.status).toBe(401);
981
+ });
982
+
983
+ it("should fetch token with valid key", async () => {
984
+ const res = await app.request("/api/v1/tokens/123", {
985
+ headers: {
986
+ Authorization: `Bearer ${process.env.TEST_API_KEY}`,
987
+ },
988
+ });
989
+ expect(res.status).toBe(200);
990
+ });
991
+
992
+ it("should enforce org isolation", async () => {
993
+ const res = await app.request("/api/v1/tokens/org-b-token", {
994
+ headers: {
995
+ Authorization: `Bearer ${process.env.ORG_A_API_KEY}`,
996
+ },
997
+ });
998
+ expect(res.status).toBe(403);
999
+ });
1000
+ });
1001
+ ```
1002
+
1003
+ ### 2. Frontend Integration Tests
1004
+
1005
+ ```typescript
1006
+ // frontend/src/lib/api/__tests__/client.test.ts
1007
+ import { describe, it, expect, vi } from "vitest";
1008
+ import { ApiClient } from "../client";
1009
+
1010
+ describe("ApiClient", () => {
1011
+ it("should add Authorization header", async () => {
1012
+ const fetchMock = vi.fn().mockResolvedValue({
1013
+ ok: true,
1014
+ json: async () => ({ id: "123" }),
1015
+ });
1016
+ global.fetch = fetchMock;
1017
+
1018
+ const client = new ApiClient("sk_test_123");
1019
+ await client.tokens.get("123");
1020
+
1021
+ expect(fetchMock).toHaveBeenCalledWith(
1022
+ expect.any(String),
1023
+ expect.objectContaining({
1024
+ headers: expect.objectContaining({
1025
+ Authorization: "Bearer sk_test_123",
1026
+ }),
1027
+ })
1028
+ );
1029
+ });
1030
+
1031
+ it("should throw ApiError on failure", async () => {
1032
+ global.fetch = vi.fn().mockResolvedValue({
1033
+ ok: false,
1034
+ status: 404,
1035
+ json: async () => ({ error: "Not found" }),
1036
+ });
1037
+
1038
+ const client = new ApiClient("sk_test_123");
1039
+ await expect(client.tokens.get("999")).rejects.toThrow("Not found");
1040
+ });
1041
+ });
1042
+ ```
1043
+
1044
+ ---
1045
+
1046
+ ## Deployment Changes
1047
+
1048
+ ### Before (Coupled)
1049
+
1050
+ ```
1051
+ 1. Deploy frontend to Cloudflare Pages
1052
+ - Includes Convex SDK
1053
+ - WebSocket connection to Convex
1054
+
1055
+ 2. Deploy Convex backend
1056
+ - convex deploy
1057
+ ```
1058
+
1059
+ ### After (Separated)
1060
+
1061
+ ```
1062
+ 1. Deploy backend API to Cloudflare Workers
1063
+ - cd backend/api
1064
+ - wrangler deploy
1065
+ - Output: https://api.yourdomain.com
1066
+
1067
+ 2. Deploy Convex backend
1068
+ - cd backend/convex
1069
+ - convex deploy
1070
+ - Output: https://your-deployment.convex.cloud
1071
+
1072
+ 3. Deploy frontend to Cloudflare Pages
1073
+ - cd frontend
1074
+ - Set env: PUBLIC_API_URL=https://api.yourdomain.com
1075
+ - Set env: PUBLIC_API_KEY=pk_live_xxx
1076
+ - Build and deploy
1077
+ ```
1078
+
1079
+ ### Environment Variables
1080
+
1081
+ **Backend (`backend/api/.env`):**
1082
+ ```bash
1083
+ CONVEX_URL=https://your-deployment.convex.cloud
1084
+ FRONTEND_URL=https://yourdomain.com
1085
+ ```
1086
+
1087
+ **Frontend (`frontend/.env`):**
1088
+ ```bash
1089
+ PUBLIC_API_URL=https://api.yourdomain.com
1090
+ PUBLIC_API_KEY=pk_live_1234567890abcdef
1091
+ ```
1092
+
1093
+ ---
1094
+
1095
+ ## Security Considerations
1096
+
1097
+ ### 1. API Key Storage
1098
+
1099
+ **❌ Never:**
1100
+ - Store API keys in git
1101
+ - Use secret keys (`sk_*`) in frontend
1102
+ - Log API keys in console
1103
+ - Return key hash in API responses
1104
+
1105
+ **✅ Always:**
1106
+ - Use publishable keys (`pk_*`) in frontend
1107
+ - Use secret keys (`sk_*`) only in backend
1108
+ - Hash keys before storing (SHA-256)
1109
+ - Show plaintext key only once at creation
1110
+ - Rotate keys regularly
1111
+
1112
+ ### 2. Rate Limiting
1113
+
1114
+ **Implementation:**
1115
+ ```typescript
1116
+ // backend/api/middleware/rateLimit.ts
1117
+ import { Context, Next } from "hono";
1118
+
1119
+ const rateLimitMap = new Map<string, { count: number; resetAt: number }>();
1120
+
1121
+ export async function rateLimit(c: Context, next: Next) {
1122
+ const keyId = c.get("apiKeyId");
1123
+ const limit = c.get("keyRateLimit");
1124
+
1125
+ const now = Date.now();
1126
+ const key = `rate_limit:${keyId}`;
1127
+ const current = rateLimitMap.get(key);
1128
+
1129
+ if (current && now < current.resetAt) {
1130
+ if (current.count >= limit.requests) {
1131
+ return c.json(
1132
+ {
1133
+ error: "Rate limit exceeded",
1134
+ resetAt: new Date(current.resetAt).toISOString(),
1135
+ },
1136
+ 429
1137
+ );
1138
+ }
1139
+ current.count++;
1140
+ } else {
1141
+ rateLimitMap.set(key, {
1142
+ count: 1,
1143
+ resetAt: now + limit.period * 1000,
1144
+ });
1145
+ }
1146
+
1147
+ await next();
1148
+ }
1149
+ ```
1150
+
1151
+ ### 3. CORS Configuration
1152
+
1153
+ **Backend:**
1154
+ ```typescript
1155
+ app.use("/api/*", cors({
1156
+ origin: (origin) => {
1157
+ // Allow specific domains
1158
+ const allowed = [
1159
+ "http://localhost:4321",
1160
+ "https://yourdomain.com",
1161
+ "https://*.pages.dev",
1162
+ ];
1163
+
1164
+ return allowed.some(pattern =>
1165
+ new RegExp(pattern.replace("*", ".*")).test(origin)
1166
+ ) ? origin : null;
1167
+ },
1168
+ credentials: true,
1169
+ }));
1170
+ ```
1171
+
1172
+ ---
1173
+
1174
+ ## Migration Checklist
1175
+
1176
+ ### Backend Setup
1177
+ - [ ] Add `api_key` entity type to schema
1178
+ - [ ] Create API key queries in `backend/convex/queries/apiKeys.ts`
1179
+ - [ ] Create API key mutations in `backend/convex/mutations/apiKeys.ts`
1180
+ - [ ] Deploy schema changes to Convex
1181
+ - [ ] Create test API key via mutation
1182
+ - [ ] Create `backend/api/` directory structure
1183
+ - [ ] Implement Hono routes for all resources
1184
+ - [ ] Add API key validation middleware
1185
+ - [ ] Add rate limiting middleware
1186
+ - [ ] Add CORS middleware
1187
+ - [ ] Deploy API to Cloudflare Workers
1188
+ - [ ] Test all endpoints with Postman/curl
1189
+ - [ ] Set up monitoring and logging
1190
+
1191
+ ### Frontend Setup
1192
+ - [ ] Create `frontend/src/lib/api/client.ts`
1193
+ - [ ] Create `frontend/src/lib/api/types.ts`
1194
+ - [ ] Create `frontend/src/lib/api/errors.ts`
1195
+ - [ ] Add `PUBLIC_API_URL` to `.env`
1196
+ - [ ] Add `PUBLIC_API_KEY` to `.env`
1197
+ - [ ] Update 1 page to test API client
1198
+ - [ ] Verify API client works in development
1199
+ - [ ] Migrate all pages to use API client
1200
+ - [ ] Remove all Convex imports from components
1201
+ - [ ] Delete `frontend/convex/` directory
1202
+ - [ ] Remove Convex from `package.json`
1203
+ - [ ] Update build process
1204
+ - [ ] Test full frontend in production
1205
+
1206
+ ### Documentation
1207
+ - [ ] Update `CLAUDE.md` with new architecture
1208
+ - [ ] Document API endpoints (OpenAPI/Swagger)
1209
+ - [ ] Create API key management guide
1210
+ - [ ] Update deployment instructions
1211
+ - [ ] Create troubleshooting guide
1212
+
1213
+ ---
1214
+
1215
+ ## Rollback Plan
1216
+
1217
+ If separation fails, rollback is easy:
1218
+
1219
+ 1. Keep `frontend/convex/` in git (don't delete until verified)
1220
+ 2. Use environment variable to toggle:
1221
+ ```typescript
1222
+ const USE_API_BACKEND = import.meta.env.PUBLIC_USE_API_BACKEND === "true";
1223
+
1224
+ const data = USE_API_BACKEND
1225
+ ? await api.tokens.get(id)
1226
+ : await convex.query(api.entities.get, { id });
1227
+ ```
1228
+ 3. If issues arise, set `PUBLIC_USE_API_BACKEND=false`
1229
+
1230
+ ---
1231
+
1232
+ ## Success Metrics
1233
+
1234
+ **Technical:**
1235
+ - [ ] Frontend has zero Convex dependencies
1236
+ - [ ] All API endpoints return < 200ms
1237
+ - [ ] Rate limiting enforces limits correctly
1238
+ - [ ] API key validation works for all scopes
1239
+ - [ ] CORS configured correctly
1240
+ - [ ] 100% test coverage on API routes
1241
+
1242
+ **Business:**
1243
+ - [ ] Multiple frontends can use same backend
1244
+ - [ ] API versioning supports breaking changes gracefully
1245
+ - [ ] Multi-tenancy works (org isolation)
1246
+ - [ ] Mobile/desktop can use same API
1247
+ - [ ] API documentation is complete
1248
+
1249
+ ---
1250
+
1251
+ ## Timeline
1252
+
1253
+ **Total Duration:** 6-8 weeks
1254
+
1255
+ **Week 1-2:** Backend API creation
1256
+ **Week 3:** Frontend API client library
1257
+ **Week 4-5:** Gradual frontend migration
1258
+ **Week 6:** Remove Convex from frontend
1259
+ **Week 7:** Testing and bug fixes
1260
+ **Week 8:** Documentation and deployment
1261
+
1262
+ ---
1263
+
1264
+ ## Next Steps
1265
+
1266
+ 1. **Review this plan** with team
1267
+ 2. **Create GitHub project** with tasks
1268
+ 3. **Set up test environment** for API backend
1269
+ 4. **Begin Phase 1:** Backend API creation
1270
+
1271
+ ---
1272
+
1273
+ ## Questions to Resolve
1274
+
1275
+ 1. **API Versioning:** Start with `/api/v1` or wait until v2 needed?
1276
+ 2. **Real-time Updates:** How to handle without Convex subscriptions? (WebSocket, SSE, polling?)
1277
+ 3. **Batch Operations:** Should API support batching multiple operations?
1278
+ 4. **GraphQL:** Consider GraphQL instead of REST?
1279
+ 5. **API Gateway:** Use Cloudflare API Gateway for additional features?
1280
+
1281
+ ---
1282
+
1283
+ ## Conclusion
1284
+
1285
+ This separation transforms ONE from a tightly-coupled monolith into a flexible, API-first platform that can:
1286
+
1287
+ - ✅ Serve multiple frontends from one backend
1288
+ - ✅ Support web, mobile, desktop, CLI
1289
+ - ✅ Enable multi-tenancy with API key isolation
1290
+ - ✅ Version API independently
1291
+ - ✅ Scale frontend and backend separately
1292
+
1293
+ The key is **gradual migration** with the ability to rollback at any point. By following this plan step-by-step, we minimize risk while achieving maximum architectural flexibility.